我有一个 Circle CI 环境,我想在其中动态分配上下文以部署到 4 个不同的环境。
理想情况下,我想使用管道参数设置上下文,有什么想法可以实现这一点吗?
举例说明我希望如何实现这一目标:
parameters:
test-contxt:
type: string
default: "staging"
build-test-on-prod-pr:
jobs:
- build-api:
context:
- "<< pipeline.parameters.test-context >>"
- test-api:
context:
- "<< pipeline.parameters.test-context >>"
- deploy-api:
context:
- "<< pipeline.parameters.test-context >>"
Run Code Online (Sandbox Code Playgroud)
尝试这种方法会导致以下错误:
#!/bin/sh -eo pipefail
# Error calling workflow: 'build-test-on-prod-pr'
# Unknown variable(s): test-context
Run Code Online (Sandbox Code Playgroud)
所以我在问题中发布的示例确实有效,我犯的错误是参数中的拼写错误。不过,我会保留这个问题,以防它有帮助。我还删除了引号,但我认为这并不重要。
parameters:
test-context:
type: string
default: "staging"
build-test-on-prod-pr:
jobs:
- build-api:
context:
- << pipeline.parameters.test-context >>
- test-api:
context:
- << pipeline.parameters.test-context >>
- deploy-api:
context:
- << pipeline.parameters.test-context >>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
892 次 |
最近记录: |