如何 运行 在亚特兰蒂斯的一个目录上进行多个工作流程

how to run multiple workflow on one dir in Atlantis

在我的用例中,我有一个包含 2 个文件的目录,当发生变化时,我在哪里调用两个 atlanis 工作流 files.But 我收到以下错误

parsing atlantis.yaml: there are two or more projects with dir: "/dirabc " workspace: "default" that are not all named; they must have a 'name' key so they can be targeted for apply's separately

atlantis.yaml 如下所示

version: 2

projects:

- dir: /dirabc
  workflow: terragrunt-workflow-file1
  apply_requirements: [approved]
  autoplan:
    when_modified: ["file1.tf"]
    enabled: true
- dir: /dirabc
  workflow: terragrunt-workflow-file2
  apply_requirements: [approved]
  autoplan:
    when_modified: ["file2.tf"]
    enabled: true

workflows:
  terragrunt-workflow-aurora-file1:
    plan:
      steps:
        - run: rm -rf .terraform
        - run: terragrunt plan -no-color --terragrunt-non-interactive --target module.file1
    apply:
      steps:
        - run: terragrunt apply -no-color --terragrunt-non-interactive -auto-approve --target module.file1
  terragrunt-workflow-aurora-file2:
    plan:
      steps:
        - run: rm -rf .terraform
        - run: terragrunt plan -no-color --terragrunt-non-interactive --target module.file2
    apply:
      steps:
        - run: terragrunt apply -no-color --terragrunt-non-interactive -auto-approve --target module.file2

我们如何 运行 同一目录中的多个工作流程对不同的文件进行更改。 我还删除了步骤 'rm -rf .terrafrom' 仍然在 'atlantis plan'

上出现相同的错误

当目录相同时,我们可以添加名称,例如:

version: 2

projects:

- dir: /dirabc
  name: file1
  workflow: terragrunt-workflow-file1
  apply_requirements: [approved]
  autoplan:
    when_modified: ["file1.tf"]
    enabled: true
- dir: /dirabc
  name: file2
  workflow: terragrunt-workflow-file2
  apply_requirements: [approved]
  autoplan:
    when_modified: ["file2.tf"]
    enabled: true

workflows:
  terragrunt-workflow-aurora-file1:
    plan:
      steps:
        - run: terragrunt plan -no-color --terragrunt-non-interactive --target module.file1
    apply:
      steps:
        - run: terragrunt apply -no-color --terragrunt-non-interactive -auto-approve --target module.file1
  terragrunt-workflow-aurora-file2:
    plan:
      steps:
        - run: terragrunt plan -no-color --terragrunt-non-interactive --target module.file2
    apply:
      steps:
        - run: terragrunt apply -no-color --terragrunt-non-interactive -auto-approve --target module.file2
``