Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ jobs:
fetch-depth: 1
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
uses: docker/setup-qemu-action@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@v4
-
name: Local docker build (non-root image)
uses: docker/build-push-action@v6
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile
Expand All @@ -42,7 +42,7 @@ jobs:
tags: openfaas/faas-cli:${{ github.sha }}
-
name: Test for multi-arch build
uses: docker/build-push-action@v6
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ jobs:
echo "IMAGE_PREFIX"=$(echo "ghcr.io/$GITHUB_REPOSITORY" | awk '{print tolower($1)}' | sed -e "s/:refs//") >> $GITHUB_ENV
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
uses: docker/setup-qemu-action@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@v4
- name: Login to Container Registry
uses: docker/login-action@v3
uses: docker/login-action@v4
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
-
name: Build and Push container images (non-root)
uses: docker/build-push-action@v6
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile
Expand All @@ -63,7 +63,7 @@ jobs:
${{ env.IMAGE_PREFIX }}:latest
-
name: Build and Push container images (root)
uses: docker/build-push-action@v6
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile
Expand All @@ -80,7 +80,7 @@ jobs:
${{ env.IMAGE_PREFIX }}:latest-root
-
name: Build binaries for multiple environments
uses: docker/build-push-action@v6
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile.redist
Expand Down
9 changes: 9 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Rules

faas-cli is a REST client for OpenFaaS - CE, Standard, Enterprise and Edge (faasd)

The CLI is written in Go, to see verbose output for HTTP calls run "FAAS_DEBUG=1"

You must never push code, or commit code. The user does that. You may suggest a Chris Beams style commit message.

All go code must be formatted after editing, do not apply formatting to vendor.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM ghcr.io/openfaas/license-check:0.4.2 as license-check

Check warning on line 1 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 1 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 1 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 1 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

# Build stage
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.25 as builder
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.26 as builder

Check warning on line 4 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 4 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 4 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 4 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

ARG TARGETPLATFORM
ARG BUILDPLATFORM
Expand Down Expand Up @@ -40,7 +40,7 @@
-o faas-cli


FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine:3.22.1 as root

Check warning on line 43 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior

RedundantTargetPlatform: Setting platform to predefined ${TARGETPLATFORM:-linux/amd64} in FROM is redundant as this is the default behavior More info: https://docs.docker.com/go/dockerfile/rule/redundant-target-platform/

Check warning on line 43 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 43 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 43 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior

RedundantTargetPlatform: Setting platform to predefined ${TARGETPLATFORM:-linux/amd64} in FROM is redundant as this is the default behavior More info: https://docs.docker.com/go/dockerfile/rule/redundant-target-platform/

Check warning on line 43 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 43 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior

RedundantTargetPlatform: Setting platform to predefined ${TARGETPLATFORM:-linux/amd64} in FROM is redundant as this is the default behavior More info: https://docs.docker.com/go/dockerfile/rule/redundant-target-platform/

Check warning on line 43 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 43 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior

RedundantTargetPlatform: Setting platform to predefined ${TARGETPLATFORM:-linux/amd64} in FROM is redundant as this is the default behavior More info: https://docs.docker.com/go/dockerfile/rule/redundant-target-platform/

ARG REPO_URL

Expand All @@ -57,11 +57,11 @@
ENTRYPOINT [ "faas-cli" ]

# Release stage
FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine:3.21.0 as release

Check warning on line 60 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior

RedundantTargetPlatform: Setting platform to predefined ${TARGETPLATFORM:-linux/amd64} in FROM is redundant as this is the default behavior More info: https://docs.docker.com/go/dockerfile/rule/redundant-target-platform/

Check warning on line 60 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 60 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 60 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior

RedundantTargetPlatform: Setting platform to predefined ${TARGETPLATFORM:-linux/amd64} in FROM is redundant as this is the default behavior More info: https://docs.docker.com/go/dockerfile/rule/redundant-target-platform/

Check warning on line 60 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 60 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior

RedundantTargetPlatform: Setting platform to predefined ${TARGETPLATFORM:-linux/amd64} in FROM is redundant as this is the default behavior More info: https://docs.docker.com/go/dockerfile/rule/redundant-target-platform/

Check warning on line 60 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 60 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior

RedundantTargetPlatform: Setting platform to predefined ${TARGETPLATFORM:-linux/amd64} in FROM is redundant as this is the default behavior More info: https://docs.docker.com/go/dockerfile/rule/redundant-target-platform/

ARG REPO_URL

LABEL org.opencontainers.image.source $REPO_URL

Check warning on line 64 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "LABEL key=value" should be used instead of legacy "LABEL key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/

Check warning on line 64 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "LABEL key=value" should be used instead of legacy "LABEL key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/

Check warning on line 64 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "LABEL key=value" should be used instead of legacy "LABEL key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/

Check warning on line 64 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "LABEL key=value" should be used instead of legacy "LABEL key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/

RUN apk --no-cache add ca-certificates git

Expand Down
21 changes: 16 additions & 5 deletions commands/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package commands

import (
"context"
"encoding/json"
"fmt"
"io"
"os"
Expand All @@ -30,17 +31,19 @@ func init() {
describeCmd.Flags().StringVarP(&token, "token", "k", "", "Pass a JWT token to use instead of basic auth")
describeCmd.Flags().StringVarP(&functionNamespace, "namespace", "n", "", "Namespace of the function")
describeCmd.Flags().BoolVarP(&verbose, "verbose", "v", false, "Enable verbose output")
describeCmd.Flags().BoolVarP(&jsonOutput, "json", "j", false, "Output function details as JSON")

faasCmd.AddCommand(describeCmd)
}

var describeCmd = &cobra.Command{
Use: "describe FUNCTION_NAME [--gateway GATEWAY_URL]",
Use: "describe FUNCTION_NAME [--gateway GATEWAY_URL] [--json]",
Short: "Describe an OpenFaaS function",
Long: `Display details of an OpenFaaS function`,
Example: `faas-cli describe figlet
faas-cli describe env --gateway http://127.0.0.1:8080
faas-cli describe echo -g http://127.0.0.1.8080`,
Example: ` faas-cli describe figlet
faas-cli describe env --gateway http://127.0.0.1:8080
faas-cli describe echo -g http://127.0.0.1.8080
faas-cli describe env --json`,
PreRunE: preRunDescribe,
RunE: runDescribe,
}
Expand Down Expand Up @@ -115,7 +118,15 @@ func runDescribe(cmd *cobra.Command, args []string) error {
AsyncURL: asyncURL,
}

printFunctionDescription(cmd.OutOrStdout(), funcDesc, verbose)
if jsonOutput {
data, err := json.MarshalIndent(funcDesc, "", " ")
if err != nil {
return fmt.Errorf("failed to marshal JSON: %w", err)
}
fmt.Fprintln(cmd.OutOrStdout(), string(data))
} else {
printFunctionDescription(cmd.OutOrStdout(), funcDesc, verbose)
}

return nil
}
Expand Down
10 changes: 5 additions & 5 deletions commands/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ var generateCmd = &cobra.Command{
Use: "generate --api=openfaas.com/v1 --yaml stack.yaml --tag sha --namespace=openfaas-fn",
Short: "Generate Kubernetes CRD YAML file",
Long: `The generate command creates kubernetes CRD YAML file for functions`,
Example: `faas-cli generate --api=openfaas.com/v1 --yaml stack.yaml | kubectl apply -f -
faas-cli generate --api=openfaas.com/v1 -f stack.yaml
faas-cli generate --api=serving.knative.dev/v1 -f stack.yaml
faas-cli generate --api=openfaas.com/v1 --namespace openfaas-fn -f stack.yaml
faas-cli generate --api=openfaas.com/v1 -f stack.yaml --tag branch -n openfaas-fn`,
Example: ` faas-cli generate --api=openfaas.com/v1 --yaml stack.yaml | kubectl apply -f -
faas-cli generate --api=openfaas.com/v1 -f stack.yaml
faas-cli generate --api=serving.knative.dev/v1 -f stack.yaml
faas-cli generate --api=openfaas.com/v1 --namespace openfaas-fn -f stack.yaml
faas-cli generate --api=openfaas.com/v1 -f stack.yaml --tag branch -n openfaas-fn`,
PreRunE: preRunGenerate,
RunE: runGenerate,
}
Expand Down
Loading
Loading