Skip to main content

Exec Action

Exec action allows you to executes a command or a script file on the target host. The type of scripts executed include:

  • Bash scripts
  • Powershell scripts
scale-deployment.yaml
apiVersion: mission-control.flanksource.com/v1
kind: Playbook
metadata:
name: scale-deployment
spec:
description: Scale deployment
configs:
- type: Kubernetes::Deployment
tags:
environment: staging
parameters:
- name: replicas
label: The new desired number of replicas.
approval:
type: any
approvers:
people:
- admin@local
teams:
- DevOps
actions:
- name: 'scale deployment'
exec:
script: kubectl scale --replicas={{.params.replicas}} --namespace={{.config.tags.namespace}} deployment {{.config.name}}
FieldDescriptionSchemeRequiredTemplatable
scriptScript can be an inline script or a path to a script that needs to be executed. Executed via Powershell on windows and via bash on Darwin and Linux.stringtruetrue
connectionsConnections for some CLIsExecConnection
artifactsSpecify what artifacts generated by the exec action needs to be saved[]Artifact
envSpecify environment variables that are available to exec processes[]EnvVar
checkoutCheckout details the git repository that should be mounted to the process[]GitCheckout

Exec Connection

Exec connections allow you to specify credentials for a list of CLI tools that are needed by your scripts. Eg: You can specify the AWS connection name and the credential files along with the necessary environment variables will be setup on the host running the script.

FieldDescriptionTypeRequired
awsAWS connectionAWSConnection
gcpGCP connectionGCPConnection
azureAzure connectionAzureConnection

Artifact

FieldDescriptionTypeRequired
pathPath or glob.stringtrue

Read more ...

Git Checkout

For authentication, either provide the connection name or the basic auth or the certificate.

FieldDescriptionTypeRequired
urlGit repository URL.stringtrue
connectionSpecify the connection name to use for git authentication (if required)EnvVar
usernameGit auth username.EnvVar
passwordGit auth password.EnvVar
certificateGit auth certificate.EnvVar
destinationDestination is the full path to where the contents of the URL should be downloaded to. If left empty, the sha256 hash of the URL will be used as the dir name.string

Templating

Scripts can be templated. The script template receives a environment variable that contain details about the corresponding config, check or component and the parameter(if applicable).

FieldDescriptionSchema
configConfig passed to the playbookConfigItem
componentComponent passed to the playbookComponent
checkCanary Check passed to the playbookCheck
paramsUser provided parameters to the playbookmap[string]string