gpt4 book ai didi

circleci - 如何在 CircleCI 步骤之间传递动态参数

转载 作者:行者123 更新时间:2023-12-03 08:04:10 27 4
gpt4 key购买 nike

我将在 CircleCI 作业的第一步中生成一个 UID。有没有办法将此值存储为可供后续步骤访问的“管道参数”?另外,有没有办法在作业之间传递此类动态参数?

类似这样的事情

jobs:
build:
steps:
- run:
name: Generate UID
command: |
UID=$(date +%s)
<< pipeline.parameters.UID >> = UID # Store UID in the job context

- run:
name: Run Tests
command: |
UID = << pipeline.parameters.UID >> # Retrieve UID from the job context
./do_something.sh ${UID}

我似乎无法在 CircleCI 文档中找到确切的答案。看过

我可能已经接近解决方案,但我感到陷入困境并感谢任何帮助。

最佳答案

您可以使用临时环境。要写入和读取的变量:

steps:  
- run:
name: Post release to GitHub repo
command: |
set -e
rel_id=$(./scripts/post-internal-release.sh)
echo "export REL_ID='$rel_id'" >> $BASH_ENV

读回它:

run:  
name: Upload mapping files to github
command: |
./scripts/upload_mapping_to_github.sh ${REL_ID}

我写了一个comprehensive guide在像这样的边缘情况

关于circleci - 如何在 CircleCI 步骤之间传递动态参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72953046/

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