CircleCI
The following code sample demonstrates how to integrate Dagger with CircleCI.
.circleci/config.yml
yaml
version: 2.1
jobs:
build:
docker:
- image: cimg/base:2024.01
environment: # for GitHub, GitLab, BitBucket only
CIRCLE_PIPELINE_NUMBER: << pipeline.number >> # for GitHub, GitLab, BitBucket only
CIRCLE_PIPELINE_TRIGGER_LOGIN: << pipeline.trigger_parameters.gitlab.user_username >> # for GitLab only
CIRCLE_PIPELINE_REPO_URL: << pipeline.trigger_parameters.gitlab.repo_url >> # for GitLab only
CIRCLE_PIPELINE_REPO_FULL_NAME: << pipeline.trigger_parameters.gitlab.repo_name >> # for GitLab only
steps:
- checkout
- setup_remote_docker
- run:
name: Install Dagger CLI
command: curl -fsSL https://dl.dagger.io/dagger/install.sh | BIN_DIR=$HOME/.local/bin sh
- run:
# assumes a Go project
# modify to use different function(s) as needed
name: Call Dagger Function
command: dagger -m github.com/kpenfound/dagger-modules/golang@v0.2.0 call build --project=. --args=.
# for ephemeral runners only: override the default docker stop timeout and
# give the Dagger Engine more time to push cache data to Dagger Cloud
- run:
name: Stop Dagger Engine
command: docker stop -t 300 $(docker ps --filter name="dagger-engine-*" -q)
when: always
workflows:
dagger:
jobs:
- build
# assumes the Dagger Cloud token is
# in a project environment variable named DAGGER_CLOUD_TOKEN