gpt4 book ai didi

docker - Gitlab 部署脚本 - envsubst : command not found

转载 作者:行者123 更新时间:2023-12-05 02:04:45 25 4
gpt4 key购买 nike

我有一个带有 CI/CD 管道的 gitlab 存储库。它有 deploy.sh 脚本,它运行顺利,直到 envsubst 命令:

#!/bin/bash

set -e
<...>
# deploy via ssh
SSH="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=ERROR -l $SSH_USER
$HOST"

echo "create project dir"
$SSH "mkdir -p $PROJECT_ROOT"

echo "create env file"
envsubst < $CI_ENVIRONMENT_NAME.tmpl.env | $SSH "cat > ${PROJECT_ROOT}/${CI_ENVIRONMENT_NAME}.env"

作业因错误而失败:

create env file
./deploy.sh: line 65: envsubst: command not found

'.gitlab-ci.yml' 文件的标题:

image: docker:latest
services:
- docker:dind

最佳答案

作为DavidMaze指出,我将“gettext”包添加到“.gitlab-ci.yml”文件中:

deploy-on-server:
stage: deploy
when: manual
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- apk update && apk add bash
- apk update && apk add gettext
<...>

关于docker - Gitlab 部署脚本 - envsubst : command not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64112268/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com