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

Downloaded go source is not cleaned up - repository reports "dirty" #143

Closed
rustydb opened this issue Dec 1, 2023 · 0 comments
Closed

Comments

@rustydb
Copy link
Contributor

rustydb commented Dec 1, 2023

Using 'ghcr.io/wangyoucao577/go-release-action:v1.40', the downloaded go source is not cleaned up and left in the repository clone.

Our Go app's build appends "-dirty" to the version string if uncommitted files exist. This has been handy to validate whether the build was from a developer or a clean checkout.

The problem can be observed here:

  • Line 218 shows go-linux.tar.gz appearing in git status -s
  • Line 241 shows the LDFLAG reporting the undesired value of "dirty": github.com/Cray-HPE/gru/pkg/version.GitTreeState='dirty''

I've worked around this by adding rm -rf go-*.tar.gz to a pre_command for the action parameters. Alternatively I could've added this to our .gitignore. Doing this results in a "clean" report:

  • line 217 shows removal of the downloaded source tar
  • Line 241 shows the LDFLAG reporting the desired "clean" value: github.com/Cray-HPE/gru/pkg/version.GitTreeState='clean'

It seems more proper that the process responsible for downloading the new file also be responsible for removing or hiding it. Ensuring that the repo clone is clean, and unadulterated.

rustydb added a commit to rustydb/go-release-action that referenced this issue Dec 1, 2023
Downloads go source into a temporary location, outside of the cloned project source repository. This keeps the cloned repository clean by reporting no new files or changes in `git status`.
rustydb added a commit to Cray-HPE/gru that referenced this issue Dec 1, 2023
The GitHub action we use is downloading the go source code to the
project's checked out clone. This is causing our `GitTreeState` to
always report as "dirty."

The file in question is always named `go-linux.tar.gz` (even on Windows
and Mac), since this is incorrect we can preemptively remove the tar
using a glob.
rustydb added a commit to Cray-HPE/gru that referenced this issue Dec 1, 2023
The GitHub action we use is downloading the go source code to the
project's checked out clone. This is causing our `GitTreeState` to
always report as "dirty."

The file in question is always named `go-linux.tar.gz` (even on Windows
and Mac), since this is incorrect we can preemptively remove the tar
using a glob.
rustydb added a commit to Cray-HPE/gru that referenced this issue Dec 1, 2023
The GitHub action we use is downloading the go source code to the
project's checked out clone. This is causing our `GitTreeState` to
always report as "dirty."

The file in question is always named `go-linux.tar.gz` (even on Windows
and Mac), since this is incorrect we can preemptively remove the tar
using a glob.
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

No branches or pull requests

1 participant