【问题标题】:Terraform executable not discovered by teamcity agentteamcity 代理未发现 Terraform 可执行文件
【发布时间】:2020-02-07 19:17:32
【问题描述】:

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

但是,terraform init 不断失败并显示 terraform: Command not found error

[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 sn-p

    @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 管道上,它找不到提取的 terraform。 此外,在 Makefile 中使用 echo * 列出目录中存在的所有文件,我确实看到 terraform 存在于同一路径中。

任何帮助将不胜感激。

【问题讨论】:

    标签: docker makefile teamcity terraform


    【解决方案1】:

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

    【讨论】:

    • 哦,那太傻了!谢谢你的建议,成功了
    猜你喜欢
    • 2012-06-06
    • 2017-03-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-15
    • 1970-01-01
    • 1970-01-01
    • 2022-08-19
    • 2017-09-02
    相关资源
    最近更新 更多