From fbf4e8c6463ed10613f7e0312746b15dc8bf7d25 Mon Sep 17 00:00:00 2001 From: Antonio Gamez Diaz Date: Mon, 8 Jan 2024 13:04:51 +0100 Subject: [PATCH] Fix unbound variable Signed-off-by: Antonio Gamez Diaz --- cmd/apprepository-controller/Dockerfile | 4 ++-- cmd/asset-syncer/Dockerfile | 4 ++-- cmd/kubeapps-apis/Dockerfile | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/apprepository-controller/Dockerfile b/cmd/apprepository-controller/Dockerfile index a78831e9ab1..68d88b508c6 100644 --- a/cmd/apprepository-controller/Dockerfile +++ b/cmd/apprepository-controller/Dockerfile @@ -16,7 +16,7 @@ ARG lint # https://github.com/golangci/golangci-lint/releases ARG GOLANGCILINT_VERSION="1.55.2" -RUN if [ ! -z "$lint" ]; then \ +RUN if [ ! -z ${lint:-} ]; then \ go install github.com/golangci/golangci-lint/cmd/golangci-lint@v$GOLANGCILINT_VERSION && \ # Run golangci-lint to detect issues golangci-lint run --timeout=10m ./cmd/apprepository-controller/... && \ @@ -27,7 +27,7 @@ RUN if [ ! -z "$lint" ]; then \ # https://github.com/golang/go/issues/27719#issuecomment-514747274 RUN --mount=type=cache,target=/go/pkg/mod \ --mount=type=cache,target=/root/.cache/go-build \ - GOPROXY="https://proxy.golang.org,direct" CGO_ENABLED=0 go build -installsuffix cgo -ldflags "-X github.com/vmware-tanzu/kubeapps/cmd/apprepository-controller/cmd.version=$VERSION" ./cmd/apprepository-controller + GOPROXY="https://proxy.golang.org,direct" CGO_ENABLED=0 go build -installsuffix cgo -ldflags "-X github.com/vmware-tanzu/kubeapps/cmd/apprepository-controller/cmd.version=${VERSION:-}" ./cmd/apprepository-controller FROM scratch COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ diff --git a/cmd/asset-syncer/Dockerfile b/cmd/asset-syncer/Dockerfile index 96700706aa6..b232c93339d 100644 --- a/cmd/asset-syncer/Dockerfile +++ b/cmd/asset-syncer/Dockerfile @@ -16,7 +16,7 @@ ARG lint # https://github.com/golangci/golangci-lint/releases ARG GOLANGCILINT_VERSION="1.55.2" -RUN if [ ! -z "$lint" ]; then \ +RUN if [ ! -z ${lint:-} ]; then \ go install github.com/golangci/golangci-lint/cmd/golangci-lint@v$GOLANGCILINT_VERSION && \ # Run golangci-lint to detect issues golangci-lint run --timeout=10m ./cmd/asset-syncer/... && \ @@ -27,7 +27,7 @@ RUN if [ ! -z "$lint" ]; then \ # https://github.com/golang/go/issues/27719#issuecomment-514747274 RUN --mount=type=cache,target=/go/pkg/mod \ --mount=type=cache,target=/root/.cache/go-build \ - GOPROXY="https://proxy.golang.org,direct" CGO_ENABLED=0 go build -installsuffix cgo -ldflags "-X github.com/vmware-tanzu/kubeapps/cmd/asset-syncer/cmd.version=$VERSION" ./cmd/asset-syncer + GOPROXY="https://proxy.golang.org,direct" CGO_ENABLED=0 go build -installsuffix cgo -ldflags "-X github.com/vmware-tanzu/kubeapps/cmd/asset-syncer/cmd.version=${VERSION:-}" ./cmd/asset-syncer FROM scratch COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ diff --git a/cmd/kubeapps-apis/Dockerfile b/cmd/kubeapps-apis/Dockerfile index 7c7f865729a..30f9d91d7ae 100644 --- a/cmd/kubeapps-apis/Dockerfile +++ b/cmd/kubeapps-apis/Dockerfile @@ -22,7 +22,7 @@ ARG GOLANGCILINT_VERSION="1.55.2" ARG GRPC_HEALTH_PROBE_VERSION="0.4.24" # Install lint tools -RUN if [ ! -z "$lint" ]; then \ +RUN if [ ! -z ${lint:-} ]; then \ go install github.com/golangci/golangci-lint/cmd/golangci-lint@v$GOLANGCILINT_VERSION; \ fi @@ -43,7 +43,7 @@ RUN --mount=type=cache,target=/go/pkg/mod \ COPY pkg pkg COPY cmd cmd -RUN if [ ! -z "$lint" ]; then \ +RUN if [ ! -z ${lint:-} ]; then \ # Run golangci-lint to detect issues golangci-lint run --timeout=10m ./cmd/kubeapps-apis/... && \ golangci-lint run --timeout=10m ./pkg/...; \