Skip to content

run

The run task executes a bash script.

Examples

Send a Slack notification.

- run: |
    curl -d "text=Experiment is complete. New version is promoted." -d "channel=C123456" \
    -H "Authorization: Bearer xoxb-not-a-real-token-this-will-not-work" \
    -X POST https://slack.com/api/chat.postMessage  

Trigger a GitHub Actions workflow.

- run: |
    echo xoxb-not-a-real-token-this-will-not-work > token.txt
    gh auth login --with-token < token.txt
    gh repo clone my-repo
    cd my-repo
    gh workflow run promote.yaml -R github.com/me/my-repo

Run a kubectl command.

- run: |
    kubectl apply -f new-version-of-my-app.yaml -n my-app-namespace

If SLOs are not satisfied by version numbered 1, rollback. This is an example of conditional task execution.

- task: assess-app-versions
  ...
- if: not SLOsBy(1)
  run: |
    kubectl rollout undo deployment/my-app-deployment

Temp dir

The script in the run task has a pre-defined environment variable called TEMP_DIR which points to a temp directory. This directory can be used for processing temporary files.

- run: |
    cd $TEMP_DIR
    echo "hello" > world.txt

Available commands

When running experiments on your local machine, any command that is available in your PATH can be used as part of the run task. When running experiments within the Iter8 container (this is the case when running Iter8 experiments inside Kubernetes), in addition to the iter8 executable, the Iter8 container also includes kubectl, kustomize, helm, yq, git, curl, and gh, all of which can be used as part of the run task.

- run: |
    kustomize build hello/world/folder > manifest.yaml
    kubectl apply -f manifest.yaml
    helm upgrade my-app helm/chart --install
    yq -i a=b manifest.yaml
    git clone https://github.com/iter8-tools/iter8.git
    gh pr create
    curl https://iter8.tools -O $SCARCH_DIR/i.html
Back to top