我有以下工作流程部分:
jobs:
terraform:
name: 'Terraform'
runs-on: ubuntu-latest
steps:
# Checkout the module repository to the GitHub Actions runner
- name: Checkout Modules
uses: actions/checkout@v3
with:
repository: myaccount/myrepo
- name: Show Filesystem1
run: ls -l -R
- name: Checkout Client
uses: actions/checkout@v3
- name: Show Filesystem2
run: ls -l -R
当我在步骤1和2中检查运行器上的文件系统时,得到以下结果:
.:
total 4
drwxr-xr-x 6 runner docker 4096 Apr 7 12:55 modules
./modules:
total 16
drwxr-xr-x 3 runner docker 4096 Apr 7 12:55 client_network
drwxr-xr-x 2 runner docker 4096 Apr 7 12:55 databases
drwxr-xr-x 2 runner docker 4096 Apr 7 12:55 storage
drwxr-xr-x 2 runner docker 4096 Apr 7 12:55 virtualmachines
./modules/client_network:
total 40
drwxr-xr-x 2 runner docker 4096 Apr 7 12:55 gateway
-rw-r--r-- 1 runner docker 4538 Apr 7 12:55 main.tf
-rw-r--r-- 1 runner docker 203 Apr 7 12:55 outputs.tf
-rw-r--r-- 1 runner docker 23347 Apr 7 12:55 variables.tf
,对于第二步:
.:
total 24
-rw-r--r-- 1 runner docker 1291 Apr 7 12:52 keyvault.tf
-rw-r--r-- 1 runner docker 3538 Apr 7 12:52 main-1.tf
-rw-r--r-- 1 runner docker 638 Apr 7 12:52 outputs.tf
-rw-r--r-- 1 runner docker 387 Apr 7 12:52 provider.tf
-rw-r--r-- 1 runner docker 56 Apr 7 12:52 terraform.tfvars
-rw-r--r-- 1 runner docker 2020 Apr 7 12:52 variables.tf
结果实质上是模块文件夹被擦除,并且terrform应用将失败,因为在main-1中引用了模块文件夹。Tf没了。我不知道如何实现这两个存储库并排。
谢谢!
可以使用Checkout多个repos(并排)
- name: Checkout Modules
uses: actions/checkout@v3
with:
repository: myaccount/myrepo
path: modules
- name: Checkout Client
uses: actions/checkout@v3
with:
path: client