摘自CircleCI配置文件:
deploy:
machine:
enabled: true
steps:
- run:
name: AWS EC2 deploy
command: |
ssh -o "StrictHostKeyChecking no" ubuntu@xxx.xxx.xxx.xxx "cd ~/circleci-aws; git pull; npm i; npm run build; pm2 restart build/server如何将命令分解为多行?在下面的语法中尝试过,但它只运行第一个命令:
deploy:
machine:
enabled: true
steps:
- run:
name: Deploy
command: |
ssh -o StrictHostKeyChecking=no ubuntu@xxx.xxx.xxx.xxx
cd ~/circleci-aws
git pull
npm i
npm run build
pm2 restart build/server发布于 2018-08-04 19:45:42
您需要将这些其他命令作为args传递给shell (如bash):
ssh -o StrictHostKeyChecking=no ubuntu@xxx.xxx.xxx.xxx bash -c '
cd ~/circleci-aws
git pull
npm i
npm run build
pm2 restart build/server'发布于 2020-05-06 14:40:24
这是一个旧的,但它有很多意见,所以我发现似乎值得分享。
在CircleCI docs (https://circleci.com/docs/2.0/configuration-reference/#shorthand-syntax)中,它们表示在使用运行速记语法时,还可以执行多行操作。
如下所示
- run: |
git add --all
git commit -am "a commit message"
git push问题的例子和这两个命令之间的区别是,命令在"run“下,而不是”命令“下。
发布于 2022-09-13 20:22:35
来自这里
steps:
- run: |
s3cmd --access_key ${<< parameters.access-key >>} \\
--secret_key ${<< parameters.secret-key >>} \\
<< parameters.command >>https://stackoverflow.com/questions/51672067
复制相似问题