小编Sag*_*hav的帖子

有没有办法在 GitLab CI 作业中使用 OR 条件满足需求

我正在尝试使用“.gitlab.ci.yml”文件中的“needs”为前一阶段作业创建具有“OR”条件的作业依赖项,但无法找到解决方案。

.gitlab-ci.yml 文件 ->

stages:
  - build
  - test
  - deploy


Build_job:      
  stage: build
  script:
    - echo "hello from build job"

Test_job1:
  stage: test
  script:
    - echo "Start test 1"
  when: manual

Test_job2:
  stage: test
  script:
    - echo "Start test 2"
  when: manual

Deploy_job:
  stage: deploy
  script:
    - echo "Start deploying the job"
  when: manual
    needs:
      - job: Test_job1
        optional: true
      - job: Test_job2
        optional: true
Run Code Online (Sandbox Code Playgroud)

我的目标是要么通过Test_job1要么Test_job2通过Deploy_job应该启用。但是使用上面的代码,我无法这样做,因为Deploy_job只有当前两个测试作业都通过时才启用。 管道状态

有没有办法可以像这样使用某些东西needs: [Test_job1 or Test_job2] …

gitlab gitlab-ci

17
推荐指数
1
解决办法
1万
查看次数

如何抑制/忽略 tflint 警告

我第一次使用 tflint 扫描我的 terraform 代码。为此,我创建了 shell 脚本来执行 tflint 命令,但是,在执行 tflint 作业时,我收到一些 [WARN] 消息。我不确定它们是如何生成的。有办法抑制吗?

tflint 命令已成功执行,并且还在我的 terraform 代码中显示可能的问题/通知。

我正在使用下面的 Github 工作流程操作;

      - name: Setup TFLint
        uses: terraform-linters/setup-tflint@v1
        with:
          tflint_version: v0.26.0

      - name: Lint Terraform Code
        run: scripts/tflint.sh
        shell: bash
        continue-on-error: false
Run Code Online (Sandbox Code Playgroud)

“.tflint.hcl”文件 ->

plugin "aws" {
  enabled = true
  version = "0.12.0"
  source  = "github.com/terraform-linters/tflint-ruleset-aws"
}

rule "terraform_naming_convention" {
  enabled = true
}

rule "terraform_unused_declarations" {
  enabled = true
}

rule "terraform_deprecated_index" {
  enabled = true
}

rule "terraform_documented_outputs" {
  enabled …
Run Code Online (Sandbox Code Playgroud)

lint terraform github-actions

6
推荐指数
2
解决办法
2万
查看次数

true 和 false 结果表达式必须具有一致的类型。给定的表达式分别是字符串和数字的列表

我正在尝试使用 terraform 代码创建中转网关 VPC 附件,但是,当我执行 terraform 计划时出现以下错误;\nterraform 版本为 0.12

\n

错误:-

\n
\xe2\x94\x82 Error: Inconsistent conditional result types\n\xe2\x94\x82\n\xe2\x94\x82   on vpn-dynamic\\main.tf line 67, in resource "aws_ec2_transit_gateway_vpc_attachment" "tgw_vpc_attachment":\n\xe2\x94\x82   67:   subnet_ids         = lower(var.transit_gateway) == "enabled" ? var.tgw_subnet_ids : 0\n\xe2\x94\x82     \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\n\xe2\x94\x82     \xe2\x94\x82 var.tgw_subnet_ids is a list of string, known only after apply\n\xe2\x94\x82     \xe2\x94\x82 var.transit_gateway is a string, known only after apply\n\xe2\x94\x82\n\xe2\x94\x82 The true and false result expressions must have consistent types. The given expressions are list of      \n\xe2\x94\x82 string and number, respectively.\n
Run Code Online (Sandbox Code Playgroud)\n

main.tf:- …

amazon-web-services terraform

1
推荐指数
1
解决办法
2万
查看次数