Spinnaker Pipeline: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=External= * https://spinnaker.io/docs/concepts/pipelines/ =Internal= * Spinnaker Concepts =Overview= Pipelines are the tools for deploying an...")
 
Line 4: Line 4:
* [[Spinnaker_Concepts#Pipeline|Spinnaker Concepts]]
* [[Spinnaker_Concepts#Pipeline|Spinnaker Concepts]]
=Overview=
=Overview=
Pipelines are the tools for deploying an application in Spinnaker. A pipeline consists of a sequence of [[#Stage|stages]]. [[#Parameter|Parameters]] can be passed from stage to stage. Pipelines can be triggered manually via the UI or [[Spinnaker_Executing_a_Pipeline_in_Command_Line#Overview|command line]], or can be configured to be [[#Trigger|triggered]] by an event such as a Jenkins job completing, a new Docker image appearing in the registry, a cron schedule or a stage in another pipeline. The state of an executed pipeline can be visualized as JSON by going to Pipelines → Select a pipeline → Select an Execution → Execution Details → View as JSON:
Pipelines are the tools for deploying an application in Spinnaker. A pipeline consists of a sequence of [[Spinnaker_Concepts#Stage|stages]]. [[#Parameter|Parameters]] can be passed from stage to stage. Pipelines can be triggered manually via the UI or [[Spinnaker_Executing_a_Pipeline_in_Command_Line#Overview|command line]], or can be configured to be [[#Trigger|triggered]] by an event such as a Jenkins job completing, a new Docker image appearing in the registry, a cron schedule or a stage in another pipeline. The state of an executed pipeline can be visualized as JSON by going to Pipelines → Select a pipeline → Select an Execution → Execution Details → View as JSON:
<span id='Pipeline_State'></span><syntaxhighlight lang='json'>
<span id='Pipeline_State'></span><syntaxhighlight lang='json'>
{
{

Revision as of 02:03, 31 May 2023

External

Internal

Overview

Pipelines are the tools for deploying an application in Spinnaker. A pipeline consists of a sequence of stages. Parameters can be passed from stage to stage. Pipelines can be triggered manually via the UI or command line, or can be configured to be triggered by an event such as a Jenkins job completing, a new Docker image appearing in the registry, a cron schedule or a stage in another pipeline. The state of an executed pipeline can be visualized as JSON by going to Pipelines → Select a pipeline → Select an Execution → Execution Details → View as JSON:

{
  "id": "112[...]X",
  "type": "PIPELINE",
  "application": "smoke",
  "name": "Test Docker Trigger",
  "buildTime": 1645824168644,
  "startTime": 1645824168714,
  "endTime": 1645824185005,
  "canceled": false,
  "limitConcurrent": true,
  "keepWaitingPipelines": false,
  "status": "SUCCEEDED",
  "origin": "api",
  "spelEvaluator": "v4",
  "pipelineConfigId": "35[...]a1",
  "authentication": {
    "user": "...",
    "allowedAccounts": []
  },
  "trigger": {
    "id": "...",
    "type": "docker",
    ...
  },
  "stages": [
    {
      "id": "11F[...]1",
      "refId": "2",
      "type": "bakeManifest",
      "name": "Render Helm",
      "startTime": 1645824168750,
      "endTime": 1645824171026,
      "status": "SUCCEEDED",
      "context": {...},
      "outputs": {...},
      "tasks": {...},
    },
    ...
  ],
  "notifications": [],
  "initialConfig": {},
  "systemNotifications": []
}

Pipeline Status

  • Running
  • Awaiting Judgement
  • Terminal
  • Succeeded
  • Not Started
  • Canceled
  • Stopped
  • Paused
  • Buffered

Pipeline Context

Also see stage context.

Pipeline Template

Pipeline Template

Pipeline Configuration

Execution Options

Disable concurrent pipeline executions (only run one at a time)
Do not automatically cancel pipelines waiting in queue

If concurrent pipeline execution is disabled, then the pipelines that are in the waiting queue will get canceled when the next execution starts. The pipeline can be configured to keep them in the queue.

Automated Triggers

Parameters

A pipeline can define a set of parameters. They can added with "Add Parameter" in the UI. The parameters are useful when the pipeline is executed as result of a Pipeline stage, to pass configuration to the pipeline, or when the pipeline is executed manually, in which case the parameters are present on the UI when launching the pipeline. If the pipeline is thought about as a function, then the pipeline parameters are similar to function's parameters, and the values provided in the UI are the function arguments.

Pipeline Parameters.png

Each parameter has a name and a label.

The name identifies the parameter in the pipeline state. For manual triggering via UI, the parameter name and value are available as:

{
  "type": "PIPELINE",
  "trigger": {
    "type": "manual",
    "parameters": {
      "helm_chart_version": "1.0.0"
    },
  },
  "stages": [
    [...]
  ],
  [...]
}

The label is displayed by the UI by the text control associated with the parameter, when the user triggers the pipeline manually and it should be composed in such a way that it provides additional information to the user.

If the parameter is marked as Required, then the UI displays the text control associated with the parameter with a "required" asterisk by the Label, and the "Run" button does not become available until all "required" parameter values are filled out. The "Description" is rendered when the cursor hovers over the question mark icon.

Parameter UI.png

Each parameter may have options.

Pin all parameters or Pin Parameter If checked, the parameter(s) will be shown in a pipeline execution view, otherwise it will be collapsed by default.

Once the pipeline is triggered manually, the parameters whose values are specified in the UI can be retrieved by the pipeline stages using SpEL:

"helm.com/something/something-else-${execution.trigger.parameters.helm_chart_version}.tgz"

The documentation advertises that something similar to this should work but it did not last time I tried:

"helm.com/something/something-else-${trigger['helm_chart_version']}"

For more details; see:

A tag set by a trigger

Pipeline Variable

Aslo see:

SpEL Expressions | Variable

Pipeline Operations