terraform-switcher
terraform-switcher copied to clipboard
Static build of `tfswitch` unavailable?
I have just installed the latest release of tfswitch
on my CI container based on alpine 3.14 and the command wouldn't run.
While debugging, I discovered that tfswitch
is a dynamically built binary instead of a statically built one.
Please find below a comparison of the outputs of the ldd
command from within my container:
/opt/terraform-switcher-0.13.1201 # ldd /opt/terraform-0.11.14/terraform-0.11
/lib/ld-musl-x86_64.so.1: /opt/terraform-0.11.14/terraform-0.11: Not a valid dynamic program
/opt/terraform-switcher-0.13.1201 # ldd tfswitch
/lib64/ld-linux-x86-64.so.2 (0x7f642eb4c000)
libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f642eb4c000)
libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f642eb4c000)
/opt/terraform-switcher-0.13.1201 #
Can we provide static binaries in the releases page for downloads starting with the previous release please?
For others hitting the same issue, I have used the following snippet for now:
RUN TERRAFORM_SWITCHER_VERSION="0.13.1201" \
&& mkdir -p "/opt/terraform-switcher" \
&& cd "/opt/terraform-switcher" \
&& curl -sLO https://github.com/warrensbox/terraform-switcher/archive/refs/tags/${TERRAFORM_SWITCHER_VERSION}.tar.gz \
&& tar xzf 0.13.1201.tar.gz \
&& cd terraform-switcher-0.13.1201 \
&& CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build \
&& mv terraform-switcher ../tfswitch \
&& go clean -x -r -cache -modcache -testcache \
&& cd .. && rm -rf \
terraform-switcher-0.13.1201 0.13.1201.tar.gz \
/root/.cache \
/tmp/* \
/usr/share/doc \
/usr/share/doc-base \
/usr/share/man \
/var/tmp/*
# Put terrafom-switcher into the environment
ENV PATH="/opt/terraform-switcher:${PATH}"
...
...
RUN ..
&& echo "---- Terraform 0.10.8" \
&& tfswitch 0.10.8 && terraform --version \
&& echo "---- Terraform 0.11.6" \
&& tfswitch 0.11.14 && terraform --version \
&& echo "---- Terraform 0.13.6" \
&& tfswitch 0.13.6 && terraform --version \
&& echo "---- Terraform 1.1.2" \
&& tfswitch 1.1.2 && terraform --version \
Bump, anyone?
@yermulnik did your pr #353 possibly fix this issue?
Hopefully (and most probably) yes. Though that feature hasn't yet been released (as the release automation is borked a bit — I notified @warrensbox about it, though not sure when he will be able to look into it again).
I'm using temp:
curl -L https://raw.githubusercontent.com/warrensbox/terraform-switcher/release/install.sh > install.sh chmod +x install.sh ./install.sh "0.13.1300"
I'm using temp:
For what?
The most recent before v1 is 0.13.1308
and, to the best of my knowledge, none of the released versions are statically built.
I'm using temp:
For what? The most recent before v1 is
0.13.1308
and, to the best of my knowledge, none of the released versions are statically built.
this work too with
echo "Download tfswitch"
#curl -L https://raw.githubusercontent.com/warrensbox/terraform-switcher/release/install.sh | bash
curl -L https://raw.githubusercontent.com/warrensbox/terraform-switcher/release/install.sh > install.sh
chmod +x install.sh
./install.sh "0.13.1308"
@yermulnik our release pipeline is now working. Can we confirm that this issue is solved and can therefor be closed?
I guess, yes. Closing now.