warrensbox / tgswitch

Manage terragrunt versions - the tgswitch command line tool lets you switch between different versions of terragrunt
http://tgswitch.warrensbox.com
MIT License
147 stars 32 forks source link

Unable to download new version through the proxy #132

Open asvinours opened 2 years ago

asvinours commented 2 years ago

Hello,

I noticed that the behavior of tgswitch is different depending if the version selection is interactive or not.

Example:

root@14c36018b7f9:/data# ls
terragrunt.hcl
root@14c36018b7f9:/data# tgswitch
Terragrunt file found: /data/terragrunt.hcl
Reading required version from constraint: ~> 0.38
Matched version: 0.39.0
Downloading https://warrensbox.github.io/terragunt-versions-list/index.json/v0.39.0/terragrunt_linux_amd64 to terragrunt_linux_amd64
Downloading ...
9339 bytes downloaded.
Switched terragrunt to version "0.39.0" 

root@14c36018b7f9:/data# terragrunt version
/usr/local/bin/terragrunt: line 1: syntax error near unexpected token `newline'
/usr/local/bin/terragrunt: line 1: `<!DOCTYPE html>'

but if using interactive mode:

root@50d1fa5608b5:/data# ls -l
total 0
root@50d1fa5608b5:/data# tgswitch
✔ 0.39.0
Downloading https://github.com/gruntwork-io/terragrunt/releases/download/v0.39.0/terragrunt_linux_amd64 to terragrunt_linux_amd64
Downloading ...
35393268 bytes downloaded.
Switched terragrunt to version "0.39.0" 

root@50d1fa5608b5:/data# terragrunt --version
terragrunt version v0.39.0

The mirror URL specified here does not seem to be able to handle the latest releases automatically.

This is causing issues as a new release of terragrunt means all our CI pipelines are now failing.

Note: Ideally tgswitch would return an error if the download URL is not a 200, so we can see there's a download issue before executing terragrunt

dracut5 commented 2 years ago

The same problem: wanted to manage versions in terragrunt.hcl, but got an error.