Skip to main content

Stage Types

Learn about the different stage types available in Sluice pipelines.

Stage Types

Sluice pipelines support several stage types, each designed for a specific purpose in your CI/CD workflow.

Source Stage

The source stage clones your code from a Git repository. It’s typically the first stage in a pipeline.

- name: source
  type: source
  config:
    repository: https://github.com/your-org/your-repo
    branch: main

Configuration Options

OptionTypeRequiredDescription
repositorystringYesGit repository URL (HTTPS or SSH)
branchstringNoBranch to clone (default: main)
tagstringNoSpecific tag to checkout
commitstringNoSpecific commit SHA to checkout
pathstringNoSubdirectory to use as workspace root
depthnumberNoClone depth (default: 1 for shallow clone)

Authentication

For private repositories, configure credentials:

config:
  repository: [email protected]:your-org/private-repo.git
  credentials:
    type: ssh
    secretRef: git-ssh-key

Build Stage

The build stage creates container images using Docker.

- name: build
  type: build
  config:
    dockerfile: ./Dockerfile
    context: .
    image: registry.example.com/my-app
    tag: latest
    push: true

Configuration Options

OptionTypeRequiredDescription
dockerfilestringYesPath to Dockerfile
contextstringYesBuild context directory
imagestringYesImage name (without tag)
tagstringNoImage tag (default: latest)
buildArgsobjectNoBuild-time variables
targetstringNoTarget stage for multi-stage builds
pushbooleanNoPush to registry after build (default: true)
cachebooleanNoUse layer caching (default: true)

Build Arguments

Pass build-time variables:

config:
  dockerfile: ./Dockerfile
  context: .
  image: my-app
  buildArgs:
    NODE_ENV: production
    API_URL: https://api.example.com

Test Stage

The test stage runs automated tests against your code.

- name: test
  type: test
  config:
    image: node:18
    commands:
      - npm ci
      - npm test

Configuration Options

OptionTypeRequiredDescription
imagestringYesContainer image to run tests in
commandsarrayYesList of commands to execute
workdirstringNoWorking directory (default: /workspace)
envobjectNoEnvironment variables
timeoutstringNoTest timeout (default: 30m)

Parallel Testing

Run multiple test suites in parallel:

- name: test
  type: test
  config:
    parallel:
      - name: unit
        image: node:18
        commands:
          - npm run test:unit
      - name: integration
        image: node:18
        commands:
          - npm run test:integration

Deploy Stage

The deploy stage pushes your application to infrastructure.

Kubernetes Deployment

- name: deploy
  type: deploy
  config:
    type: kubernetes
    namespace: production
    manifests:
      - ./k8s/deployment.yaml
      - ./k8s/service.yaml
    wait: true

Helm Deployment

- name: deploy
  type: deploy
  config:
    type: helm
    chart: ./charts/my-app
    release: my-app
    namespace: production
    values:
      replicaCount: 3
      image:
        tag: '{{.Version}}'

Configuration Options

OptionTypeRequiredDescription
typestringYesDeployment type (kubernetes, helm)
namespacestringNoTarget namespace
manifestsarrayConditionalKubernetes manifest files
chartstringConditionalHelm chart path or repo
releasestringConditionalHelm release name
valuesobjectNoHelm values to override
waitbooleanNoWait for rollout (default: true)
timeoutstringNoRollout timeout

Approve Stage

The approve stage pauses the pipeline for manual approval.

- name: approve-production
  type: approve
  config:
    message: 'Deploy to production?'
    approvers:
      - [email protected]
    timeout: '24h'

Configuration Options

OptionTypeRequiredDescription
messagestringNoMessage shown to approvers
approversarrayNoList of allowed approvers
timeoutstringNoTime before auto-rejection
autoApproveobjectNoAuto-approve conditions

Auto-Approval

Automatically approve based on conditions:

config:
  message: 'Deploy to staging?'
  autoApprove:
    branches:
      - develop
      - feature/*

Stage Ordering

Stages run sequentially in the order they’re defined. Each stage starts only after the previous stage completes successfully.

stages:
  - name: source # Runs first
    type: source
  - name: build # Runs after source
    type: build
  - name: test # Runs after build
    type: test
  - name: approve # Runs after test
    type: approve
  - name: deploy # Runs after approval
    type: deploy

Next Steps