Examples

CI Pipeline

A realistic build → test → deploy pipeline using shell commands and environment variables.

Overview

This example chains four steps — checkout, build, test, and deploy — using the shell module. Steps run only when their dependencies succeed, giving you a safe, ordered pipeline.

Workflow File

json
{
  "name": "ci-pipeline",
  "description": "Build, test, and deploy",
  "inputs": {
    "environment": "staging",
    "image_tag": "{{env.COMMIT_SHA}}"
  },
  "steps": [
    {
      "id": "checkout",
      "type": "shell",
      "config": {
        "command": "git fetch --depth=1 && git checkout {{env.COMMIT_SHA}}"
      }
    },
    {
      "id": "build",
      "type": "shell",
      "config": {
        "command": "docker build -t myapp:{{inputs.image_tag}} .",
        "shell": "bash"
      },
      "depends_on": ["checkout"]
    },
    {
      "id": "test",
      "type": "shell",
      "config": {
        "command": "docker run --rm myapp:{{inputs.image_tag}} go test ./..."
      },
      "depends_on": ["build"]
    },
    {
      "id": "deploy",
      "type": "shell",
      "config": {
        "command": "kubectl set image deployment/myapp app=myapp:{{inputs.image_tag}} --namespace={{inputs.environment}}"
      },
      "depends_on": ["test"]
    }
  ]
}

Add to your CI

GitLab CI.gitlab-ci.yml
stages:
  - deploy

ci-pipeline:
  stage: deploy
  image: ghcr.io/rajitk13/shiro-automation:latest
  variables:
    GITLAB_TOKEN: $GL_TOKEN
  script:
    - shiro run
        -workflow .shiro/workflows/pipeline.json
        -config .shiro/config.yaml
        -state-store gitlab
  artifacts:
    paths:
      - .shiro/state/
    expire_in: 1 day
  only:
    - main
    - merge_requests
GitHub Actions.github/workflows/pipeline.yml
name: CI Pipeline

on:
  push:
    branches: [main]
  pull_request:

jobs:
  pipeline:
    runs-on: ubuntu-latest
    container:
      image: ghcr.io/rajitk13/shiro-automation:latest
    steps:
      - uses: actions/checkout@v4

      - name: Run Shiro pipeline
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          COMMIT_SHA: ${{ github.sha }}
        run: |
          shiro run \
            -workflow .shiro/workflows/pipeline.json \
            -config .shiro/config.yaml \
            -state-store github

      - uses: actions/upload-artifact@v4
        with:
          name: shiro-state
          path: .shiro/state/

Tips

  • • Use {{env.VAR}} to inject CI environment variables safely
  • • Add continue_on_error: true to a step to keep the pipeline running even on failure
  • • Parallel steps (no shared dependency) run concurrently automatically