Dagger Go SDK in CI
- GitHub Actions
- CircleCI
- GitLab
- Jenkins
.github/workflows/dagger.yml
name: dagger
on:
push:
branches: [main]
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19
- uses: actions/checkout@v3
- name: Run Dagger pipeline
run: go run main.go
.circleci/config.yml
version: 2.1
jobs:
build:
docker:
- image: cimg/go:1.19
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Dagger Pipeline
command: go run main.go
workflows:
dagger:
jobs:
- build
.gitlab-ci.yml
.docker:
image: golang:1.19-alpine
services:
- docker:${DOCKER_VERSION}-dind
variables:
DOCKER_HOST: tcp://docker:2376
DOCKER_TLS_VERIFY: '1'
DOCKER_TLS_CERTDIR: '/certs'
DOCKER_CERT_PATH: '/certs/client'
DOCKER_DRIVER: overlay2
DOCKER_VERSION: '20.10.16'
.dagger:
extends: [.docker]
before_script:
- apk add docker-cli
build:
extends: [.dagger]
script:
- go run main.go
Jenkinsfile
pipeline {
agent { label 'dagger' }
stages {
stage("dagger") {
steps {
sh '''
go run main.go
'''
}
}
}
}
Requires docker
client and go
installed on your Jenkins agent, a Docker host available (can be docker:dind
), and agents labeled in Jenkins with dagger
.