-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
workflows(atlantis-image): fix building and publishing of Docker images #1975
workflows(atlantis-image): fix building and publishing of Docker images #1975
Conversation
#1943 changed the way Docker images were built in GitHub Actions so multi-architecture Docker images now are built, but it unfortunately included a bug which means it hasn't worked yet on any released version of Atlantis. The problem is the change expected environment variables to be replaced in the regular YAML code instead of just the commands which are run. This attempts to fix that by instead using the template language available to access the same environment variable. This is based on the example provided in the documentation here: https://docs.github.com/en/actions/learn-github-actions/environment-variables.
@@ -49,13 +49,13 @@ jobs: | |||
- name: populate release version | |||
if: ${{ github.event_name == 'release'}} | |||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |||
- name: Build and push atlantis:$RELEASE_VERSION image | |||
- name: Build and push atlantis:${{ env.RELEASE_VERSION }} image |
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.
Interesting, I think this used to working fine at some point before.
But now when I looked back at 0.17.3 release build (https://github.com/runatlantis/atlantis/runs/3478283112), the RELEASE_VERSION shows unset in the log.
I dont think this is quite a right fix. You can see my test build in here, https://github.com/chenrui333/github-action-test/runs/4715966380
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.
This is the workflow ref, https://github.com/chenrui333/github-action-test/blob/main/.github/workflows/release.yml
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.
I don't quite follow you. The first release that happened since the changes from #1943 got merged was the version 0.17.6 release. You can see the job from that run here: https://github.com/runatlantis/atlantis/runs/4564698591?check_suite_focus=true.
The workflow you are linking to is running the docker build
command directly, which means environment variables are expanded. This was changed in .github/workflows/atlantis-image.yml in #1943 to instead use the docker/build-push-action
action, which doesn't expand environment variables, which is why the environment variable instead has to be accessed as via the template language.
Does that make sense?
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.
Aha, that makes total sense.
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 for the fix.
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.
@virgofx Did you use this image ghcr.io/runatlantis/atlantis:latest@sha256:66d431df3cd1893175abf7133aeef96f9ab212a3c260daf8ef2a54042259f503
? Mind creating a bug ticket?
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.
Almost positive that's what I used. Let me re-test real quick and confirm.
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.
Yep confirmed using
ghcr.io/runatlantis/atlantis:latest@sha256:66d431df3cd1893175abf7133aeef96f9ab212a3c260daf8ef2a54042259f503
results in:
standard_init_linux.go:228: exec user process caused: exec format error
I'll create a new issue.
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.
Confirmed. Spun out a new issue: #2001
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 @virgofx!
…es (runatlantis#1975) runatlantis#1943 changed the way Docker images were built in GitHub Actions so multi-architecture Docker images now are built, but it unfortunately included a bug which means it hasn't worked yet on any released version of Atlantis. The problem is the change expected environment variables to be replaced in the regular YAML code instead of just the commands which are run. This attempts to fix that by instead using the template language available to access the same environment variable. This is based on the example provided in the documentation here: https://docs.github.com/en/actions/learn-github-actions/environment-variables.
#1943 changed the way Docker images
were built in GitHub Actions so multi-architecture Docker images now are built,
but it unfortunately included a bug which means it hasn't worked yet on any
released version of Atlantis.
The problem is the change expected environment variables to be replaced in the
regular YAML code instead of just the commands which are run.
This attempts to fix that by instead using the template language available to
access the same environment variable.
This is based on the example provided in the documentation here:
https://docs.github.com/en/actions/learn-github-actions/environment-variables.