1

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.

Tamizharasan
  • 293
  • 1
  • 5
  • 18

2 Answers2

2

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

Pavan
  • 21
  • 3
1

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

RocketRaccoon
  • 2,559
  • 1
  • 21
  • 30