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

build: fix build terraform/opentofu build pathing #4439

Merged
merged 2 commits into from
Apr 19, 2024

Conversation

dylanhitt
Copy link
Contributor

@dylanhitt dylanhitt commented Apr 15, 2024

what

Fixes pathing when copying opentofu/terraform bins to release image

It seems in the deps container it symlinks to /tmp/build/{tofu,terraform}${version}. Not sure if that was intended and the COPY from deps was just forgotten 🤷. Let me know the intention and I can edit the PR.

Thanks

why

In the current on dev image the terraform bins do not exist:

➜  ~ docker run -it ghcr.io/runatlantis/atlantis:dev-debian bash
No files found in /docker-entrypoint.d/, skipping
atlantis@616313fed2f9:/$ terraform -v
bash: terraform: command not found
atlantis@616313fed2f9:/$ find -name terraform
find: './etc/ssl/private': Permission denied
find: './proc/tty/driver': Permission denied
find: './var/cache/ldconfig': Permission denied
find: './var/cache/apt/archives/partial': Permission denied
find: './root': Permission denied
atlantis@616313fed2f9:/$

vs previous

➜  ~ docker run -it ghcr.io/runatlantis/atlantis:latest bash
No files found in /docker-entrypoint.d/, skipping
a2c9ab7d1aee:/$ which terraform
/usr/local/bin/terraform
a2c9ab7d1aee:/$ find -name terraform
find: ./proc/tty/driver: Permission denied
./usr/local/bin/terraform
find: ./root: Permission denied
a2c9ab7d1aee:/$

tests

  • I have tested my changes by building locally validating the dirs/executabls
➜  atlantis git:(fix/build) ✗ docker run --rm -it --entrypoint bash hello:hello -c "ls -la /usr/local/bin/tofu* && which tofu && tofu -v"
-rwxr-xr-x 1 root root 75497472 Feb 22 12:14 /usr/local/bin/tofu
-rwxr-xr-x 1 root root 75497472 Feb 22 12:14 /usr/local/bin/tofu1.6.2
/usr/local/bin/tofu
OpenTofu v1.6.2
on linux_arm64
➜  atlantis git:(fix/build) ✗ docker run --rm -it --entrypoint bash hello:hello -c "ls -la /usr/local/bin/tofu* && which tofu && tofu -v"
-rwxr-xr-x 1 root root 75497472 Feb 22 12:14 /usr/local/bin/tofu
-rwxr-xr-x 1 root root 75497472 Feb 22 12:14 /usr/local/bin/tofu1.6.2
/usr/local/bin/tofu
OpenTofu v1.6.2
on linux_arm64

references

@dylanhitt dylanhitt requested review from a team as code owners April 15, 2024 22:08
@dylanhitt dylanhitt requested review from chenrui333, nitrocode and X-Guardian and removed request for a team April 15, 2024 22:08
@github-actions github-actions bot added the build Relating to how we build Atlantis label Apr 15, 2024
@jamengual
Copy link
Contributor

@nitrocode you recently worked on this, do you have any comments?

Copy link
Member

@nitrocode nitrocode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@nitrocode nitrocode merged commit cc994a3 into runatlantis:main Apr 19, 2024
26 checks passed
@nitrocode
Copy link
Member

Thanks for the contribution and the quick fix. I approved it earlier and forgot to merge

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

Successfully merging this pull request may close these issues.

3 participants