kubernetesspinnakerspinnaker-halyard

Spinnaker pipeline name environment variable


I've spinnaker with kubernetes manifest v2. Now, I'm creating spinnaker pipeline with manifest files in which I'd like to have namespace named as applicationName-pipelineName.

I'm looking for spinnaker environment variable for pipeline name which I can use in manifest file to would append in file.

Ex. I'm using docker registry latest tag as imageName:${trigger['tag']}

similarly something like

apiVersion: v1
kind: Namespace
metadata:
  name: appName-${pipelineName}

please advise. Thanks.


Solution

  • During pipeline runtime you have following parameters available:
    ${execution.id} - unique id of execution;
    ${execution.name} - name of pipeline used during creation;
    ${execution.pipelineConfigId} - unique id for pipeline across whole Spinnaker instance, it also could be set to something meaningful if you create pipeline using API.

    Do not forget that namespace's name is very sensitive to case and non-alphanumerical symbols. Such functions like #alphanumerical(string) and ${java.lang.String.toLowerCase()} will be very helpful.

    You may find this reference useful - Pipeline Expression Reference.