-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(build): correct make
target deps for Go binaries
#13145
Conversation
08f593b
to
6f5b3d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Great write-up in the description.
3fd9d98
to
171c73d
Compare
During CI the generate go files (specifically This isn't the first time github's CI has had odd timestamp behaviour (#13023) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I have had this issue before of the binaries failing to update, but hadn't looked into it as it was fairly simple to workaround. Thanks for figuring out the issue! That it was only using directories is hard to tell from a quick glance
I left some small suggestions below that might optimize this
make
target deps for go binaries
make
target deps for go binariesmake
target deps for go binaries
3475901
to
dd5472c
Compare
The dependencies for the golang binaries are only dependent on the directories not the actual files. This means that if you just edit the file with vscode on a mac a rebuild doesn't rebuild the binary. Some editors update the timestamp of the directory as well, and then the old code works. See the last make in this for evidence of the problem ``` vscode ➜ ~/go/src/github.com/argoproj/argo-workflows (01bf1cfc8) $ make dist/workflow-controller GIT_COMMIT=01bf1cfc82834a5fc50bcba42cdacc0eb1fbcde1 GIT_BRANCH=HEAD GIT_TAG=untagged GIT_TREE_STATE=dirty RELEASE_TAG=false DEV_BRANCH=true VERSION=latest KUBECTX=k3d-k3s-default DOCKER_DESKTOP=false K3D=true DOCKER_PUSH=false RUN_MODE=local PROFILE=minimal AUTH_MODE=hybrid SECURE=false STATIC_FILES=false ALWAYS_OFFLOAD_NODE_STATUS=false UPPERIO_DB_DEBUG=0 LOG_LEVEL=debug NAMESPACED=true make: 'dist/workflow-controller' is up to date. vscode ➜ ~/go/src/github.com/argoproj/argo-workflows (01bf1cfc8) $ touch workflow/controller/controller.go vscode ➜ ~/go/src/github.com/argoproj/argo-workflows (01bf1cfc8) $ make dist/workflow-controller GIT_COMMIT=01bf1cfc82834a5fc50bcba42cdacc0eb1fbcde1 GIT_BRANCH=HEAD GIT_TAG=untagged GIT_TREE_STATE=dirty RELEASE_TAG=false DEV_BRANCH=true VERSION=latest KUBECTX=k3d-k3s-default DOCKER_DESKTOP=false K3D=true DOCKER_PUSH=false RUN_MODE=local PROFILE=minimal AUTH_MODE=hybrid SECURE=false STATIC_FILES=false ALWAYS_OFFLOAD_NODE_STATUS=false UPPERIO_DB_DEBUG=0 LOG_LEVEL=debug NAMESPACED=true CGO_ENABLED=0 go build -gcflags '' -v -ldflags '-X github.com/argoproj/argo-workflows/v3.version=latest -X github.com/argoproj/argo-workflows/v3.buildDate=2024-06-05T13:10:23Z -X github.com/argoproj/argo-workflows/v3.gitCommit=01bf1cfc82834a5fc50bcba42cdacc0eb1fbcde1 -X github.com/argoproj/argo-workflows/v3.gitTreeState=dirty -X github.com/argoproj/argo-workflows/v3.gitTag=untagged -extldflags -static' -o dist/workflow-controller ./cmd/workflow-controller github.com/argoproj/argo-workflows/v3/cmd/workflow-controller gitvscode ➜ ~/go/src/github.com/argoproj/argo-workflows (01bf1cfc8) $ git checkout HEAD~ -- Makefile vscode ➜ ~/go/src/github.com/argoproj/argo-workflows (01bf1cfc8) $ make dist/workflow-controller GIT_COMMIT=01bf1cfc82834a5fc50bcba42cdacc0eb1fbcde1 GIT_BRANCH=HEAD GIT_TAG=untagged GIT_TREE_STATE=dirty RELEASE_TAG=false DEV_BRANCH=true VERSION=latest KUBECTX=k3d-k3s-default DOCKER_DESKTOP=false K3D=true DOCKER_PUSH=false RUN_MODE=local PROFILE=minimal AUTH_MODE=hybrid SECURE=false STATIC_FILES=false ALWAYS_OFFLOAD_NODE_STATUS=false UPPERIO_DB_DEBUG=0 LOG_LEVEL=debug NAMESPACED=true make: 'dist/workflow-controller' is up to date. vscode ➜ ~/go/src/github.com/argoproj/argo-workflows (01bf1cfc8) $ touch workflow/controller/controller.go vscode ➜ ~/go/src/github.com/argoproj/argo-workflows (01bf1cfc8) $ make dist/workflow-controller GIT_COMMIT=01bf1cfc82834a5fc50bcba42cdacc0eb1fbcde1 GIT_BRANCH=HEAD GIT_TAG=untagged GIT_TREE_STATE=dirty RELEASE_TAG=false DEV_BRANCH=true VERSION=latest KUBECTX=k3d-k3s-default DOCKER_DESKTOP=false K3D=true DOCKER_PUSH=false RUN_MODE=local PROFILE=minimal AUTH_MODE=hybrid SECURE=false STATIC_FILES=false ALWAYS_OFFLOAD_NODE_STATUS=false UPPERIO_DB_DEBUG=0 LOG_LEVEL=debug NAMESPACED=true make: 'dist/workflow-controller' is up to date. ``` Signed-off-by: Alan Clucas <[email protected]>
This doesn't make it into the final image, just the builder image Because we now depend on the .go files we need to be able to rebuild `pkg/apis/workflow/v1alpha1/openapi_generated.go`, who's make target depends upon `/go/bin/openapi-gen` which needs libc-dev to build. Signed-off-by: Alan Clucas <[email protected]>
Signed-off-by: Alan Clucas <[email protected]>
Signed-off-by: Alan Clucas <[email protected]>
dd5472c
to
4aa5c55
Compare
make
target deps for go binariesmake
target deps for Go binaries
Fixes the makefile when editing files under certain circumstances.
Motivation
@Adrien-D was editing the files using vscode on a Mac and finding that although kit was attempting a rebuild when his file was saved the result was not running.
This was tracked down to
make dist/argo
(he was working on the server component) reporting'dist/argo' is up to date.
The binary targets only depend upon the timestamps of the package subdirectories, not the timestamps of the
.go
files within.Modifications
This file changes the dependencies for the three golang binaries in the makefile to be the .go files under all the packages, rather than just the package directories
libc-dev doesn't make it into the final image, just the builder image. Because we now depend on the .go files we need to be able to rebuild
pkg/apis/workflow/v1alpha1/openapi_generated.go
, who's make target depends upon/go/bin/openapi-gen
which needs libc-dev to build.Verification
See the last make in this for evidence of the problem, and the second for proof it works.
This works well under native linux and under the .devcontainer docker.
If someone could verify the
xargs+find
invocation I use actually works under native Mac, that would be good. I know MacOS ships with some horrifically outdated unix tools.