diff --git a/Dockerfile b/Dockerfile index d6bda9b8029f..3b15636f611f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,7 @@ ARG GIT_TREE_STATE=unknown FROM golang:1.22-alpine3.19 as builder +# libc-dev to build openapi-gen RUN apk update && apk add --no-cache \ git \ make \ @@ -12,6 +13,7 @@ RUN apk update && apk add --no-cache \ wget \ curl \ gcc \ + libc-dev \ bash \ mailcap diff --git a/Makefile b/Makefile index f5f08f2dba45..3a6e3471ea36 100644 --- a/Makefile +++ b/Makefile @@ -107,9 +107,9 @@ ifndef $(GOPATH) endif # -- file lists -ARGOEXEC_PKGS := $(shell echo cmd/argoexec && go list -f '{{ join .Deps "\n" }}' ./cmd/argoexec/ | grep 'argoproj/argo-workflows/v3/' | cut -c 39-) -CLI_PKGS := $(shell echo cmd/argo && go list -f '{{ join .Deps "\n" }}' ./cmd/argo/ | grep 'argoproj/argo-workflows/v3/' | cut -c 39-) -CONTROLLER_PKGS := $(shell echo cmd/workflow-controller && go list -f '{{ join .Deps "\n" }}' ./cmd/workflow-controller/ | grep 'argoproj/argo-workflows/v3/' | cut -c 39-) +ARGOEXEC_PKG_FILES := $(shell go list -f '{{ join .Deps "\n" }}' ./cmd/argoexec/ | grep 'argoproj/argo-workflows/v3/' | xargs go list -f '{{ range $$file := .GoFiles }}{{ print $$.ImportPath "/" $$file "\n" }}{{ end }}' | cut -c 39-) +CLI_PKG_FILES := $(shell go list -f '{{ join .Deps "\n" }}' ./cmd/argo/ | grep 'argoproj/argo-workflows/v3/' | xargs go list -f '{{ range $$file := .GoFiles }}{{ print $$.ImportPath "/" $$file "\n" }}{{ end }}' | cut -c 39-) +CONTROLLER_PKG_FILES := $(shell go list -f '{{ join .Deps "\n" }}' ./cmd/workflow-controller/ | grep 'argoproj/argo-workflows/v3/' | xargs go list -f '{{ range $$file := .GoFiles }}{{ print $$.ImportPath "/" $$file "\n" }}{{ end }}' | cut -c 39-) TYPES := $(shell find pkg/apis/workflow/v1alpha1 -type f -name '*.go' -not -name openapi_generated.go -not -name '*generated*' -not -name '*test.go') CRDS := $(shell find manifests/base/crds -type f -name 'argoproj.io_*.yaml') SWAGGER_FILES := pkg/apiclient/_.primary.swagger.json \ @@ -183,16 +183,16 @@ dist/argo-windows-amd64: GOARGS = GOOS=windows GOARCH=amd64 dist/argo-windows-%.gz: dist/argo-windows-% gzip --force --keep dist/argo-windows-$*.exe -dist/argo-windows-%: server/static/files.go $(CLI_PKGS) go.sum +dist/argo-windows-%: server/static/files.go $(CLI_PKG_FILES) go.sum CGO_ENABLED=0 $(GOARGS) go build -v -gcflags '${GCFLAGS}' -ldflags '${LDFLAGS} -extldflags -static' -o $@.exe ./cmd/argo dist/argo-%.gz: dist/argo-% gzip --force --keep dist/argo-$* -dist/argo-%: server/static/files.go $(CLI_PKGS) go.sum +dist/argo-%: server/static/files.go $(CLI_PKG_FILES) go.sum CGO_ENABLED=0 $(GOARGS) go build -v -gcflags '${GCFLAGS}' -ldflags '${LDFLAGS} -extldflags -static' -o $@ ./cmd/argo -dist/argo: server/static/files.go $(CLI_PKGS) go.sum +dist/argo: server/static/files.go $(CLI_PKG_FILES) go.sum ifeq ($(shell uname -s),Darwin) # if local, then build fast: use CGO and dynamic-linking go build -v -gcflags '${GCFLAGS}' -ldflags '${LDFLAGS}' -o $@ ./cmd/argo @@ -210,7 +210,7 @@ clis: dist/argo-linux-amd64.gz dist/argo-linux-arm64.gz dist/argo-linux-ppc64le. .PHONY: controller controller: dist/workflow-controller -dist/workflow-controller: $(CONTROLLER_PKGS) go.sum +dist/workflow-controller: $(CONTROLLER_PKG_FILES) go.sum ifeq ($(shell uname -s),Darwin) # if local, then build fast: use CGO and dynamic-linking go build -gcflags '${GCFLAGS}' -v -ldflags '${LDFLAGS}' -o $@ ./cmd/workflow-controller @@ -222,7 +222,7 @@ workflow-controller-image: # argoexec -dist/argoexec: $(ARGOEXEC_PKGS) go.sum +dist/argoexec: $(ARGOEXEC_PKG_FILES) go.sum ifeq ($(shell uname -s),Darwin) CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -gcflags '${GCFLAGS}' -v -ldflags '${LDFLAGS} -extldflags -static' -o $@ ./cmd/argoexec else @@ -605,6 +605,8 @@ pkg/apis/workflow/v1alpha1/openapi_generated.go: $(GOPATH)/bin/openapi-gen $(TYP --input-dirs github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1 \ --output-package github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1 \ --report-filename pkg/apis/api-rules/violation_exceptions.list + # Force the timestamp to be up to date + touch $@ # Delete the link [ -e ./v3 ] && rm -rf v3 @@ -618,6 +620,8 @@ pkg/apis/workflow/v1alpha1/zz_generated.deepcopy.go: $(TYPES) github.com/argoproj/argo-workflows/v3/pkg/client github.com/argoproj/argo-workflows/v3/pkg/apis \ workflow:v1alpha1 \ --go-header-file ./hack/custom-boilerplate.go.txt + # Force the timestamp to be up to date + touch $@ # Delete the link [ -e ./v3 ] && rm -rf v3 @@ -663,7 +667,7 @@ docs/fields.md: api/openapi-spec/swagger.json $(shell find examples -type f) hac env ARGO_SECURE=false ARGO_INSECURE_SKIP_VERIFY=false ARGO_SERVER= ARGO_INSTANCEID= go run ./hack/docs fields # generates several other files -docs/cli/argo.md: $(CLI_PKGS) go.sum server/static/files.go hack/docs/cli.go +docs/cli/argo.md: $(CLI_PKG_FILES) go.sum server/static/files.go hack/docs/cli.go go run ./hack/docs cli # docs