Skip to content

fix(build): Invalid commit hash in docker image#535

Merged
ankitpokhrel merged 1 commit intomainfrom
fix-docker-build-hash
Dec 21, 2022
Merged

fix(build): Invalid commit hash in docker image#535
ankitpokhrel merged 1 commit intomainfrom
fix-docker-build-hash

Conversation

@ankitpokhrel
Copy link
Owner

@ankitpokhrel ankitpokhrel commented Dec 21, 2022

The commit hash is determined using this command during the build process. This is fine and works well. However, the docker image built in the CI has invalid git commit hash.

$ jira version
(Version="1.2.0", GitCommit="9d8a0afd75b68aa519367f93c240429117cc4090", CommitDate="2022-12-16T10:53:08+00:00", GoVersion="go1.18.3", Compiler="gc", Platform="darwin/amd64")

$ docker run -it --rm ghcr.io/ankitpokhrel/jira-cli:latest
~ # jira version
(Version="v1.2.0", GitCommit="4ae631faa92d59052320464d09e0f34842c5f971", CommitDate="2022-12-17T10:21:57+00:00", GoVersion="go1.17.11", Compiler="gc", Platform="linux/amd64")

$ git show 4ae631faa92d59052320464d09e0f34842c5f971
fatal: bad object 4ae631faa92d59052320464d09e0f34842c5f971

This happens because we are ignoring .github directory in .dockerignore. This results in creation of stash ref with a different hash each time we create a build in a CI.

Screen Shot 2022-12-21 at 4 43 48 PM

This PR fixes the above mentioned issue.

@ankitpokhrel ankitpokhrel merged commit c62ea63 into main Dec 21, 2022
@ankitpokhrel ankitpokhrel deleted the fix-docker-build-hash branch December 21, 2022 16:22
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.

1 participant