Skip to content
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: Docker Test CI errors #384

Closed
wants to merge 1 commit into from
Closed

Conversation

docapotamus
Copy link
Contributor

@docapotamus docapotamus commented Feb 18, 2023

I am trying to resolve the VCS tagging issue in the CI pipline.

The change in Go is documented here: https://go.dev/doc/go1.18. I am unsure why this is failing in the pipeline when it works locally running the same commands.

@docapotamus docapotamus changed the title Test CI error Test VCS CI error Feb 18, 2023
@docapotamus
Copy link
Contributor Author

docapotamus commented Feb 18, 2023

Passing -buildvcs=false is incorrect in the pipeline as that uses Go 1.17 where this isn't available.

The Dockerfile uses Go 1.19 where this is available and causes an error. I presume because there is some issue with it inside a Docker build.

I beleive this may be due to the .git folder being excluded from the Docker build. I guess the best way to handle this is to check the Go version and append the flag.

Update

The go command now embeds version control information in binaries. It includes the currently checked-out revision, commit time, and a flag indicating whether edited or untracked files are present. Version control information is embedded if the go command is invoked in a directory within a Git, Mercurial, Fossil, or Bazaar repository, and the main package and its containing main module are in the same repository. This information may be omitted using the flag -buildvcs=false.

The .git directory is explicitly excluded from Docker via the .dockerignore file. However when built via docker compose the src directory is mounted as a volume and contains the .git directory. I'm still not 100% what's the nicest way to resolve this.

@docapotamus docapotamus changed the title Test VCS CI error Fix: Docker Test CI errors Feb 18, 2023
@docapotamus
Copy link
Contributor Author

docapotamus commented Feb 18, 2023

I presume the actual issue has something to do with permissions to the .git folder but I can't be sure. All steps recreated on my Mac where correct.

Without changing to much I allowed adding additional build FLAGS and in the case of the Dockerfile disabled buildvcs. Outside of compose the .git directory wouldn't be copied in via a normal docker build.

Not sure if this is the best solution but it works. Ideally the Go compiler would do the right thing but with the test being via Docker compose I wasn't sure what was best.

@amacneil any thoughts?

By settings `GO_ADDITIONAL_FLAGS` additional parameters can be passed to
the compiler.
@amacneil
Copy link
Owner

Thanks for the links. Unclear why this started failing now - I guess due to an updated git binary somehow.

I figured out a solution that maintains the vcs information (#385).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants