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}}
Field | Description | Scheme | Required | Templatable |
---|---|---|---|---|
script | Script 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. | string | true | true |
connections | Connections for some CLIs | ExecConnection | ||
artifacts | Specify what artifacts generated by the exec action needs to be saved | []Artifact | ||
env | Specify environment variables that are available to exec processes | []EnvVar | ||
checkout | Checkout 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.
Field | Description | Type | Required |
---|---|---|---|
aws | AWS connection | AWSConnection | |
gcp | GCP connection | GCPConnection | |
azure | Azure connection | AzureConnection |
Artifact
Field | Description | Type | Required |
---|---|---|---|
path | Path or glob. | string | true |
Git Checkout
For authentication, either provide the connection name or the basic auth or the certificate.
Field | Description | Type | Required |
---|---|---|---|
url | Git repository URL. | string | true |
connection | Specify the connection name to use for git authentication (if required) | Connection | |
username | Git auth username. | EnvVar | |
password | Git auth password. | EnvVar | |
certificate | Git auth certificate. | EnvVar | |
destination | Destination 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).
Field | Description | Schema |
---|---|---|
config | Config passed to the playbook | ConfigItem |
component | Component passed to the playbook | Component |
check | Canary Check passed to the playbook | Check |
params | User provided parameters to the playbook | map[string]string |
Action Result
Field | Description | Schema |
---|---|---|
stdout | string | |
stderr | string | |
exitCode | Process exit code | int |