admin管理员组文章数量:1401425
I want to perform a few terraform tasks in my Gitlab CI but the terragrunt executable is not found. Here is the job:
staging_graphql_terraform_validate:
stage: validate
image: alpine/terragrunt:1.3.6
only:
- staging
dependencies:
- staging_graphql_build_sources
script:
- cd $LAMBDA_FROM_S3_TO_GRAPHQL_STAGING_ROOT
- set -a && source .env && set +a
- terragrunt init
- terragrunt validate
And here is the output:
Running with gitlab-runner 15.7.0~beta.151.gfb1fb1dd (fb1fb1dd)
on Gitlab runner SSD 7Y_tnzJ9
Preparing the "docker" executor
00:02
Using Docker executor with image alpine/terragrunt:1.3.6 ...
Pulling docker image alpine/terragrunt:1.3.6 ...
Using docker image sha256:90f6e0a08150002555ec8ff494e30f4ee59a88c5b6c5e260b42ee13d2ee4dabd for alpine/terragrunt:1.3.6 with digest alpine/terragrunt@sha256:7c4c0839360376d431c1d036a374d139b2921087d1fac2d9cf2f5aafdb2e9199 ...
Preparing environment
00:01
Running on runner-7ytnzj9-project-32-concurrent-0 via ip-172-31-42-240...
Getting source from Git repository
00:02
Fetching changes with git depth set to 20...
Reinitialized existing Git repository in /builds/infrastructure/live/.git/
Checking out f762fa94 as mag-1608-create-a-ci-to-deploy-new-versions-on-staging-and-prod...
Removing staging/lambda-from-s3-to-graphql/.env
Removing staging/lambda-from-s3-to-graphql/source.zip
Removing staging/lambda-from-s3-to-graphql/src/node_modules/
Removing staging/lambda-from-s3-to-graphql/src/package-lock.json
Skipping Git submodules setup
Downloading artifacts
00:03
Downloading artifacts for staging_graphql_build_sources (56295)...
Downloading artifacts from coordinator... ok id=56295 responseStatus=200 OK token=glcbt-64
Executing "step_script" stage of the job script
00:01
Using docker image sha256:90f6e0a08150002555ec8ff494e30f4ee59a88c5b6c5e260b42ee13d2ee4dabd for alpine/terragrunt:1.3.6 with digest alpine/terragrunt@sha256:7c4c0839360376d431c1d036a374d139b2921087d1fac2d9cf2f5aafdb2e9199 ...
/bin/bash: line 161: terragrunt: command not found
$ cd $LAMBDA_FROM_S3_TO_GRAPHQL_STAGING_ROOT
$ set -a && source .env && set +a
$ terragrunt init
Cleaning up project directory and file based variables
00:02
ERROR: Job failed: exit code 1
I tried to add export PATH=/usr/local/bin:$PATH
in various places without success.
I also successfully ran the job by manually installing everything on an ubuntu:latest image but i need to run terragrunt commands in a lot of jobs and this is very repetitive (I could use a global before_script for that ...) and time consuming.
staging_graphql_terraform_validate:
stage: validate
only:
- staging
dependencies:
- staging_graphql_build_sources
before_script:
- apt-get update && apt-get install -y wget unzip
- wget .3.6/terraform_1.3.6_linux_amd64.zip
- unzip terraform_1.3.6_linux_amd64.zip
- mv terraform /usr/local/bin/
- chmod +x /usr/local/bin/terraform
- wget .42.5/terragrunt_linux_amd64
- mv terragrunt_linux_amd64 /usr/local/bin/terragrunt
- chmod +x /usr/local/bin/terragrunt
script:
- cd $LAMBDA_FROM_S3_TO_GRAPHQL_STAGING_ROOT
- set -a && source .env && set +a
- export PATH=/usr/local/bin:$PATH && terragrunt init && terragrunt validate
本文标签: terraformPATH issue with docker runner in GitlabCIStack Overflow
版权声明:本文标题:terraform - PATH issue with docker runner in Gitlab-CI - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744246944a2597062.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论