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

tf-download-url value seems to strip the path and only use the hostname. #4778

Closed
Doormatty opened this issue Jul 23, 2024 · 2 comments · Fixed by hashicorp/hc-install#234 or #4805
Closed
Labels
bug Something isn't working

Comments

@Doormatty
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Overview of the Issue

Upgraded from v0.27.1 to v0.28.4, after upgrade I was no longer able to download Terraform from my Artifactory mirror of hashicorp-releases

Reproduction Steps

  • Use Atlantis version v0.28.4
  • Set tf-download-url to use a url with a path - example--tf-download-url="https://myartifactory.company.com:443/artifactory/hashicorp-remote"
  • Run atlantis plan
  • Get error error downloading terraform version 1.9.2: failed to download ZIP archive from "https://myartifactory.company.com:443/terraform/1.9.2/terraform_1.9.2_linux_amd64.zip": 404 Not Found: Downloading terraform Version 1.9.2

I can manually download the correct version from my Artifactory cache without issue:
wget -q https://myartifactory.company.com/artifactory/hashicorp-remote/terraform/1.9.2/terraform_1.9.2_linux_amd64.zip

Logs

Logs
2024/07/23 17:09:35 [DEBUG] GET https://myartifactory.company.com:443/artifactory/hashicorp-remote/terraform/1.9.2/index.json
2024/07/23 17:09:35 [DEBUG] GET https://myartifactory.company.com:443/artifactory/hashicorp-remote/terraform/1.9.2/terraform_1.9.2_SHA256SUMS.72D7468F.sig
2024/07/23 17:09:35 [DEBUG] GET https://myartifactory.company.com:443/artifactory/hashicorp-remote/terraform/1.9.2/terraform_1.9.2_SHA256SUMS
2024/07/23 17:09:35 [DEBUG] GET https://myartifactory.company.com:443/terraform/1.9.2/terraform_1.9.2_linux_amd64.zip
2024-07-23 10:09:35.724	
{"level":"error","ts":"2024-07-23T17:09:35.724Z","caller":"events/instrumented_project_command_runner.go:78","msg":"Error running plan operation: error downloading terraform version 1.9.2: failed to download ZIP archive from \"https://myartifactory.company.com:443/terraform/1.9.2/terraform_1.9.2_linux_amd64.zip\": 404 Not Found: Downloading terraform Version 1.9.2
","json":{"repo":"repo_name","pull":"1"},"stacktrace":"github.com/runatlantis/atlantis/server/events.RunAndEmitStats
	github.com/runatlantis/atlantis/server/events/instrumented_project_command_runner.go:78
github.com/runatlantis/atlantis/server/events.(*InstrumentedProjectCommandRunner).Plan
	github.com/runatlantis/atlantis/server/events/instrumented_project_command_runner.go:38
github.com/runatlantis/atlantis/server/events.runProjectCmds
	github.com/runatlantis/atlantis/server/events/project_command_pool_executor.go:48
github.com/runatlantis/atlantis/server/events.(*PlanCommandRunner).run
	github.com/runatlantis/atlantis/server/events/plan_command_runner.go:263
github.com/runatlantis/atlantis/server/events.(*PlanCommandRunner).Run
	github.com/runatlantis/atlantis/server/events/plan_command_runner.go:307
github.com/runatlantis/atlantis/server/events.(*DefaultCommandRunner).RunCommentCommand
	github.com/runatlantis/atlantis/server/events/command_runner.go:367"}

Environment details

Service file:

[Unit]
Description=Atlantis Service
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=always
RestartSec=1
User=root
Environment="ATLANTIS_GITLAB_USER=${GITLAB_USER}" "ATLANTIS_GITLAB_WEBHOOK_SECRET=${GITLAB_WEBHOOK_SECRET}" "ATLANTIS_GITLAB_TOKEN=${GITLAB_TOKEN}" "ATLANTIS_GITLAB_HOSTNAME=${GITLAB_HOSTNAME}" "ATLANTIS_REPO_ALLOWLIST=${REPO_ALLOWLIST}" "ATLANTIS_REPO_CONFIG=${ATLANTIS_CONFIG_PATH}" "ATLANTIS_ATLANTIS_URL=${ATLANTIS_URL}"
ExecStart=/usr/local/bin/atlantis server \
--tf-download=true \
--tf-download-url="https://myartifactory.company.com:443/artifactory/hashicorp-remote" \
--default-tf-version="v0.14.11"

[Install]
WantedBy=multi-user.target
@james0209
Copy link
Contributor

@Doormatty I've created a PR upstream in hc-install which should fix this. Once merged, hc-install version used in Atlantis go.mod will then need bumping.

hashicorp/hc-install#234

@Doormatty
Copy link
Author

My children shall sing songs of your glory!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants