Teamcity代理未发现Terraform可执行文件

问题描述 投票:0回答:1

我正在编写一个Teamcity管道,其中我使用terraform启动一些AWS实例。我的管道使用docker一步一步调用所有步骤

但是,terraform初始化因terraform不断失败:找不到命令错误

[11:05:00][Step 2/6] Initialising terraform
[11:05:00][Step 2/6] terraform init
[11:05:00][Step 2/6] Makefile:41: recipe for target 'terraformApply' failed
[11:05:00][Step 2/6] make: terraform: Command not found

这是我的Makefile的terraformApply代码段

    @echo Download terraform
    # ${CURDIR}
    wget https://releases.hashicorp.com/terraform/0.12.20/terraform_0.12.20_linux_amd64.zip
    unzip -o terraform_0.12.20_linux_amd64.zip
    @echo Terraform downloaded
    # @echo Current Directory
    # ${CURDIR}
    sleep 60
    @echo *
    @echo Initialising terraform
    terraform init
    ## sudo terraform/terraform plan
    @echo Terraform initialised
    TF_VAR_AWS_ACCESS_KEY="****" TF_VAR_AWS_SECRET_KEY="****" terraform apply -auto-approve
    @echo Terraform setup done

我的管道在linux代理上运行。

我直接在Linux机器上运行了这个Makefile,效果很好。但是,在teamcity管道上无法找到提取的地形。另外,使用Makefile中的echo *列出目录中存在的所有文件,但我确实看到同一路径中存在terraform。

任何帮助将不胜感激。

docker makefile teamcity terraform
1个回答
0
投票

默认情况下,基于Linux的系统不会在当前工作目录中搜索二进制文件。提取terraform后,需要将其称为./terraform init

© www.soinside.com 2019 - 2024. All rights reserved.