无法创建运行另一个流水线的 Spinnaker 流水线模板。

huangapple go评论104阅读模式
英文:

Couldn't create spinnaker pipeline template which runs another pipeline

问题

In the above template, you are referring to the pipeline ID. To make it dynamic and templated, you can use Spinnaker's expression language. Here's an example of how you can modify the pipeline JSON:

在上述模板中,您正在引用管道ID。要使其动态和可模板化,您可以使用Spinnaker的表达式语言。以下是如何修改管道JSON的示例:

{
    ...
    {
        "application": "app-stack",
        "failPipeline": true,
        "name": "Run pipeline",
        "pipeline": "${trigger['resolvedPipelineId']}", // Use an expression here
        "pipelineParameters": {},
        "refId": "6",
        "requisiteStageRefIds": [
            "5"
        ],
        "type": "pipeline",
        "waitForCompletion": true
    }
    ...
}

In this modified JSON, I've used the ${trigger['resolvedPipelineId']} expression to make the pipeline field dynamic. You can set resolvedPipelineId dynamically when triggering the pipeline, and it will replace ${trigger['resolvedPipelineId']} during runtime.

英文:

I am new to spinnaker and started writing pipeline templates for all tools and applications in our organization. In one scenario I have to run a pipeline from another pipeline and I want both pipelines to need to be templated so that I can create pipelines based on the deployment environment.

But when I am referring the pipeline from the calling pipeline I have to map the ID of the pipeline.

{
        ...
        {
            "application": "app-stack",
            "failPipeline": true,
            "name": "Run pipeline",
            "pipeline": "615da201-9652-4ce2-8039-21163d5f99d4",
            "pipelineParameters": {},
            "refId": "6",
            "requisiteStageRefIds": [
            "5"
            ],
            "type": "pipeline",
            "waitForCompletion": true
        }
        ],
        "triggers": [],
        "updateTs": "1578057441000"
    }
}

In the above template, I am referring to the pipeline ID. But how can I make it to dynamic so that it can be templated.

答案1

得分: 2

"Template it as "${#pipelineId("pipeline_name")}" this will return the pipeline Id in UUID format." 可以翻译为:"将其模板化为 "${#pipelineId("pipeline_name")}",这将返回以UUID格式表示的管道ID。"

英文:

Template it as "${#pipelineId("pipeline_name")}" this will return the pipeline Id in UUID format.

答案2

得分: 1

在我们的公司中,我们避免使用管道模板,只使用sponnet。它帮助我们提供有意义的标识符,可以轻松从任何地方引用,并且可以动态创建。因此,例如,您可以使pipelinename相等。阶段的标识符也一样。

从您的问题中不清楚您遇到了什么问题。您不需要在 JSON 中指定管道标识符来引用它,只需要名称。要执行某些操作与您的子管道,通常只需要applicationexecutionId,可能还需要stage.id

英文:

In our company we are avoided pipeline templates and uses sponnet only. It helps us to provide meaningful ids which are easy to refer from anywhere and could be dynamically created. So as result you can make pipeline and name be equal for example. Same for the stage's ids applied.

From your question not clear what issue do you have. You don't need to specify pipeline id in json to refer to it, only name. For performing some actions with your child pipeline you usually need only application and executionId and may be stage.id

huangapple
  • 本文由 发表于 2020年1月3日 23:06:36
  • 转载请务必保留本文链接:https://go.coder-hub.com/59580890.html
  • spinnaker
  • spinnaker-halyard
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定