CI/CD Integration

GitLab CI

Run Shiro workflows in GitLab CI/CD pipelines with native GitLab integration.

Basic Setup

Add Shiro to your .gitlab-ci.yml:

yaml
.gitlab-ci.yml

stages:
  - test
  - deploy

variables:
  SHIRO_VERSION: "latest"

# Install Shiro in before_script
default:
  before_script:
    - wget -O /usr/local/bin/shiro https://github.com/rajitk13/shiro-automation/releases/download/${SHIRO_VERSION}/shiro-linux-amd64
    - chmod +x /usr/local/bin/shiro

test-workflow:
  stage: test
  script:
    - shiro run
  artifacts:
    when: always
    paths:
      - workflow-results.json

deploy:
  stage: deploy
  script:
    - shiro run -workflow .shiro/workflows/deploy.json
  only:
    - main

Docker Image

Use the pre-built Docker image to avoid downloading in each job:

yaml
test:
  stage: test
  image: ghcr.io/rajitk13/shiro-automation:latest
  script:
    - shiro run

With State Storage

Persist state across jobs using GitLab artifacts:

yaml
workflow:
  stage: test
  script:
    - shiro run -state-store gitlab -fresh
  artifacts:
    when: always
    paths:
      - .shiro/state/

resume-workflow:
  stage: deploy
  when: manual
  needs: [workflow]
  script:
    - shiro run -state-store gitlab
  artifacts:
    when: always
    paths:
      - .shiro/state/

Human-in-Loop Approvals

Implement approval workflows with Slack notifications:

yaml
{
  "id": "request_approval",
  "type": "slack.notify",
  "pause": true,
  "config": {
    "webhook_url": "{{env.SLACK_WEBHOOK_URL}}",
    "channel": "#deployments",
    "message": "Review deployment to production",
    "gitlab_pipeline_url": "{{env.CI_SERVER_URL}}/{{env.CI_PROJECT_ID}}/-/pipelines/{{env.CI_PIPELINE_ID}}"
  }
}