Skip to main content

Azure DevOps Pipeline Action

This action allows you to invoke pipelines in your Azure DevOps project.

invoke-azure-devops-pipeline.yaml
---
apiVersion: mission-control.flanksource.com/v1
kind: Playbook
metadata:
name: invoke-azure-devops-pipelines
namespace: default
spec:
parameters:
- name: project
label: Project name
default: Demo1
- name: pipeline
label: Pipeline ID
actions:
- name: Invoke pipeline
azureDevopsPipeline:
org: flanksource
project: '{{.params.project}}'
token:
valueFrom:
secretKeyRef:
name: azure-devops
key: token
pipeline:
id: '{{.params.pipeline}}'
FieldDescriptionScheme
name*

Step Name

string

org*

Azure DevOps org name

string

pipeline*

Azure pipeline to invoke

Pipeline

project*

Azure DevOps project name

string

token*

Azure DevOps PAT

EnvVar

parameters

Pipeline parameters

Parameters

delay

A delay before running the action e.g. 8h

Duration or CEL with Playbook Context

filter

Conditionally run an action

CEL with Playbook Context

runsOn

Which runner (agent) to run the action on

[]Agent

templatesOn

Where templating (and secret management) of actions should occur

host or agent

timeout

Timeout on this action.

Duration

Pipeline

FieldDescriptionSchemeRequiredTemplatable
idPipeline ID.stringtruetrue
versionPipeline version.stringfalsetrue

Parameters

FieldDescriptionSchemeRequiredTemplatable
resourcesThe resources the run requires.map[string]anyfalsetrue
templateParametersThe template parameters the run requires.map[string]anyfalsetrue
variablesThe variables the run requires.map[string]anyfalsetrue
stagesToSkipThe stages to skip.[]stringfalsetrue

Templating

CEL Expressions

The following variables can be used within the CEL expressions of filter, if, delays and parameters.default:

FieldDescriptionSchema
configConfig passed to the playbookConfigItem
componentComponent passed to the playbookComponent
checkCanary Check passed to the playbookCheck
playbookPlaybook passed to the playbookPlaybook
runCurrent runRun
paramsUser provided parameters to the playbookmap[string]any
requestWebhook requestWebhook Request
envEnvironment variables defined on the playbookmap[string]any
user.nameName of the user who invoked the actionstring
user.emailEmail of the user who invoked the actionstring
agent.idID of the agent the resource belongs to.string
agent.nameName of the agent the resource belongs to.string
Conditionally Running Actions

Playbook actions can be selectively executed based on CEL expressions. These expressions must either return

  • a boolean value (true indicating run the action & skip the action otherwise)
  • or a special function among the ones listed below
FunctionDescription
always()run no matter what; even if the playbook is cancelled/fails
failure()run if any of the previous actions failed
skip()skip running this action
success()run only if all previous actions succeeded (default)
timeout()run only if any of the previous actions timed out
delete-kubernetes-pod.yaml
---
apiVersion: mission-control.flanksource.com/v1
kind: Playbook
metadata:
name: notify-send-with-filter
spec:
parameters:
- name: message
label: The message for notification
default: '{{.config.name}}'
configs:
- types:
- Kubernetes::Pod
actions:
- name: Send notification
exec:
script: notify-send "{{.config.name}} was created"
- name: Bad script
exec:
script: deltaforce
- name: Send all success notification
if: success() # this filter practically skips this action as the second action above always fails
exec:
script: notify-send "Everything went successfully"
- name: Send notification regardless
if: always()
exec:
script: notify-send "a Pod config was created"
Defaulting Parameters
delete-kubernetes-pod.yaml
mission-control.flanksource.com/v1 kind: Playbook metadata: name: edit spec:
title: 'Edit Kustomize Resource' icon: flux parameters: //highligh-next-line
- default: 'chore: update $(.config.type)/$(.config.name)' name:
commit_message ```
</div>
</details>

### Go Templating

When templating `actions` with [Go Templates](/reference/scripting/gotemplate), the context variables are available as fields of the template's context object `.` eg `.config`, `.user.email`

<details summary="Templating Actions">
<div>
```yaml title="delete-kubernetes-pod.yaml"
file=../../../modules/mission-control/fixtures/playbooks/scale-deployment.yaml{' '}
{16}

Functions

FunctionDescriptionReturn
getLastAction()Returns the result of the action that just runAction Specific
getAction({action})Return the result of a specific actionAction Specific
Reusing Action Results
action-results.yaml
file=../../../modules/mission-control/fixtures/playbooks/action-result.yaml