首页 > 解决方案 > 单个 GitLab CI 作业的多个 terraform 报告

问题描述

有没有人尝试上传由具有多个计划输出的单个作业生成的 terraform 报告工件?

例子:

terraform:plan:
  image: my-tf-container
  stage: terraform
  tags: [docker]
  script:
    - |
      echo -e '{
                 "create": 0,
                 "update": 2,
                 "delete": 0
               }' > ./plan-summary-0.json
    - |
      echo -e '{
                       "create": 1,
                       "update": 2,
                       "delete": 4
                     }' > ./plan-summary-1.json
  artifacts:
    reports:
      terraform:
      - "./plan-summary-0.json"
      - "./plan-summary-1.json"

在管道日志中,我收到以下错误:

Uploading artifacts...
./plan-summary-0.json: found 1 matching files and directories 
./plan-summary-1.json: found 1 matching files and directories 
WARNING: Uploading artifacts as "terraform" to coordinator... failed  id=164225 responseStatus=500 Internal Server Error status=500 token=******
WARNING: Retrying...                                context=artifacts-uploader error=invalid argument
WARNING: Uploading artifacts as "terraform" to coordinator... failed  id=164225 responseStatus=500 Internal Server Error status=500 token=*****
WARNING: Retrying...                                context=artifacts-uploader error=invalid argument
WARNING: Uploading artifacts as "terraform" to coordinator... failed  id=164225 responseStatus=500 Internal Server Error status=500 token=*****
FATAL: invalid argument                            
Cleaning up file based variables
00:01 ERROR: Job failed: exit code 1

标签: gitlabterraformgitlab-ci

解决方案


从 gitlab 文档看起来不太可能,这是多个报告的示例(同时保持 gitlab ci yaml 优化):https ://docs.gitlab.com/ee/user/infrastructure/mr_integration.html#multiple-terraform-plan -报告


推荐阅读