Skip to main content

Exec

Executes a bash (linux) or powershell (windows) script. The check is considered passing if the script exits with 0

apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
name: exec-check
spec:
interval: 30
exec:
- description: 'exec dummy check'
script: |
echo "hello"
name: exec-pass-check
test:
expr: 'results.Stdout == "hello"'
FieldDescriptionSchemeRequired
scriptScript can be a inline script or a path to a script that needs to be executed. On windows executed via Powershell and in darwin and linux executed using bash.stringYes
nameName of the check, must be unique within the canarystringYes
artifactsSpecify what files/folders generated by the script needs to be archived[]Artifact
checkoutSpecify git repository to mount to the exec process[]GitCheckout
connectionsSetup connections for the script (eg: aws credentials)ExecConnection
envSetup environment variables that are accessible to the exec process[]EnvVar
namespaceNamespace of the checkstring
descriptionDescription for the checkstring
iconIcon for overwriting default icon on the dashboardstring
labelsLabels for checkmap[string]string
metricsMetrics to export from[]Metrics
testEvaluate whether a check is healthyExpression
displayExpression to change the formatting of the displayExpression
transformTransform data from a check into multiple individual checksExpression
Docker Image variants

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

See artifacts

Git Checkout

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

FieldDescriptionTypeRequired
urlGit repository URL.stringtrue
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