【问题标题】:Gitlab CloudFormation Integration PipelineGitlab CloudFormation 集成管道
【发布时间】:2024-01-05 03:06:01
【问题描述】:

描述:尝试创建一个简单的管道以在 aws 帐户中创建 cloudformation 堆栈。 看起来它找不到下面文档中引用的脚本,但我认为 gitlab 13.9 现在支持 cloudformation cli 命令?

Gitlab 版本:13.9

CI/CD 变量设置: 在此处查看所需的。 https://docs.gitlab.com/ee/ci/cloud_deployment/

gitlab yaml 文件
变量: 地区:us-east-2 CI_AW​​S_CF_STACK_NAME: 'gitlabTestStack' CI_AW​​S_CF_CREATE_STACK_FILE: 'aws/aws-test-stack.yaml'

deploy:
  stage: deploy
  image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest  
  script:
    - gl-cloudprovision create-stack

输出

    on PDOCK009-Runner-TestAutomation6 UrKKxyCW
Preparing the "docker" executor
Using Docker executor with image registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest ...
Pulling docker image registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest ...
Using docker image sha256:a39347bds862894f38dabf38f1fddfa0avbc1dc3070ca12400fd0a8d33e7178 for registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest ...
Preparing environment
Running on runner-urkkxycw-project-1427-concurrent-0 via 9cdf65ce059d...
Getting source from Git repository
00:01
Fetching changes with git depth set to 50...
Initialized empty Git repository in /builds/jackoneill/aws-deploy/.git/
Created fresh repository.
From <URL>
 * [new ref]         fbf7a9b966f0be1e2db8fbf7a983c02c90ed8saxc2323x -> refs/pipelines/65421
 * [new branch]      master     -> origin/master
Checking out fbf7a9 master...
Skipping Git submodules setup
Restoring cache
Downloading artifacts
00:02
Running before_script and script
00:02
$ gl-cloudprovision create-stack
/usr/bin/bash: line 103: gl-cloudprovision: command not found
Running after_script
Uploading artifacts for failed job
00:02
ERROR: Job failed: exit code 1

【问题讨论】:

    标签: gitlab gitlab-ci


    【解决方案1】:

    看来您需要将图像更改为

    image: 'registry.gitlab.com/gitlab-org/cloud-deploy/aws-cloudformation:latest'
    

    和脚本来自

    - gl-cloudprovision create-stack
    

    - gl-cloudformation create-stack
    

    【讨论】:

    • 您会添加文档链接吗?