Examples

This section contains a number of examples.

Traditional Build

This example shows your traditional clone, test, build, deploy, and report for a project.

tasks:
  clone-source:
    type: podman/run
    image: docker.io/rwgrim/docker-noop
  run-linter:
    type: podman/run
    image: docker.io/rwgrim/docker-noop
  run-tests:
    type: podman/run
    image: docker.io/rwgrim/docker-noop
  build:
    type: podman/run
    image: docker.io/rwgrim/docker-noop
  deploy-dev:
    type: podman/run
    image: docker.io/rwgrim/docker-noop
  deploy-docs:
    type: podman/run
    image: docker.io/rwgrim/docker-noop
  report-build-status:
    type: podman/run
    image: docker.io/rwgrim/docker-noop
plans:
  default:
    stages:
      - name: prepare
        tasks:
          - clone-source
      - name: testing
        tasks:
          - run-linter
          - run-tests
      - name: build
        tasks:
          - build
      - name: deploy
        tasks:
          - deploy-dev
          - deploy-docs
        concurrent: true
      - name: report
        tasks:
          - report-build-status
        run: always

Metaplans

You can use metaplans to group seperate plans into a single plan.

default-plan: everything

tasks:
  one:
    type: podman/run
    image: docker.io/alpine:edge
    command: echo one
  two:
    type: podman/run
    image: docker.io/alpine:edge
    command: echo two

plans:
  plan1:
    stages:
      - tasks:
          - one
  plan2:
    stages:
      - tasks:
          - two

meta-plans:
  default:
    plans:
      - plan1
      - plan2

Login/Logout

This example logs into the registry at the start of the plan and regardless of the result of the plan will always logout before exiting. It also will look for the REGISTRY_USERNAME and REGISTRY_PASSWORD on the host to keep them out of convey.yml.

environment:
  - REGISTRY_HOSTNAME=registry.example.com
  - REGISTRY_USERNAME
  - REGISTRY_PASSWORD
tasks:
  login:
    type: registry/login
    server: ${REGISTRY_HOSTNAME}
    username: ${REGISTRY_USERNAME}
    password: ${REGISTRY_PASSWORD}
  logout:
    type: registry/logout
    server: ${REGISTRY_HOSTNAME}
plans:
  default:
    stages:
      - tasks:
          - login
      - tasks:
          - logout
        run: always