Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unzip problems in Gitlab CI pipeline

I have a simple step with Gitlab CI to install Terraform on an Alpine based image:

step_1:
  stage: stage_x
  image: alpine/doctl:latest
  script:
    - wget https://releases.hashicorp.com/terraform/1.2.8/terraform_1.2.8_linux_amd64.zip
    - unzip terraform_1.2.8_linux_amd64.zip
    - mv terraform /usr/bin/terraform
    - terraform version

When executed, I have this error from the unzip command:

unzip: 'terraform' exists but is not a regular file

I tried this command over the same image in my machine and it works fine.
Any ideas?

like image 427
Deoxyseia Avatar asked Oct 15 '25 23:10

Deoxyseia


1 Answers

One way to overcome your issue is to use the -d option of unzip in order to unzip Terraform in the folder /usr/bin directly:

-d DIR Extract into DIR

Source: unzip --help

This way, you can also drop the mv line totally.

So, your step becomes:

step_1:
  stage: stage_x
  image: alpine/doctl:latest
  script:
    - wget https://releases.hashicorp.com/terraform/1.2.8/terraform_1.2.8_linux_amd64.zip
    - unzip terraform_1.2.8_linux_amd64.zip -d /usr/bin
    - terraform version
like image 149
β.εηοιτ.βε Avatar answered Oct 18 '25 19:10

β.εηοιτ.βε



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!