Skip to main content

CI Using Command Line

Use the raw Dagger command when your CI provider is not GitHub Actions, or when you want to own all surrounding shell steps yourself.

This mode clones the target repository inside Dagger, so the CI runner does not need to mount the repository into the module.

For pull-request validation:

RUSH_DELIVERY_MODULE=github.com/BootstrapLaboratory/rush-delivery@v0.3.4
DEPLOY_ENV_FILE="${RUNNER_TEMP}/dagger-validate.env"
SOURCE_REPOSITORY_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"

cat > "${DEPLOY_ENV_FILE}" <<EOF
GITHUB_ACTOR=${GITHUB_ACTOR}
GITHUB_REPOSITORY=${GITHUB_REPOSITORY}
GITHUB_TOKEN=${GITHUB_TOKEN}
EOF

dagger -m "${RUSH_DELIVERY_MODULE}" call validate \
--git-sha="${GITHUB_SHA}" \
--event-name="${GITHUB_EVENT_NAME}" \
--pr-base-sha="${PR_BASE_SHA}" \
--deploy-env-file="${DEPLOY_ENV_FILE}" \
--toolchain-image-provider=github \
--toolchain-image-policy=pull-or-build \
--rush-cache-provider=github \
--rush-cache-policy=pull-or-build \
--source-mode=git \
--source-repository-url="${SOURCE_REPOSITORY_URL}" \
--source-ref="${GITHUB_REF}" \
--source-auth-token-env=GITHUB_TOKEN

pull-or-build is the recommended PR policy. It pulls existing GHCR artifacts when they are present, builds locally on miss, and never publishes from the PR run.

For release workflow runs:

RUSH_DELIVERY_MODULE=github.com/BootstrapLaboratory/rush-delivery@v0.3.4
RUNTIME_FILES_DIR="${RUNNER_TEMP}/rush-delivery-runtime-files"
DEPLOY_ENV_FILE="${RUNNER_TEMP}/dagger-deploy.env"
SOURCE_REPOSITORY_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"

mkdir -p "${RUNTIME_FILES_DIR}"
cp "${GCP_CREDENTIALS_FILE}" "${RUNTIME_FILES_DIR}/gcp-credentials.json"

cat > "${DEPLOY_ENV_FILE}" <<EOF
GCP_PROJECT_ID=${GCP_PROJECT_ID}
GITHUB_ACTOR=${GITHUB_ACTOR}
GITHUB_REPOSITORY=${GITHUB_REPOSITORY}
GITHUB_TOKEN=${GITHUB_TOKEN}
EOF

dagger -m "${RUSH_DELIVERY_MODULE}" call workflow \
--git-sha="${GITHUB_SHA}" \
--event-name="${GITHUB_EVENT_NAME}" \
--force-targets-json="${FORCE_TARGETS_JSON:-[]}" \
--deploy-tag-prefix=deploy/prod \
--artifact-prefix=deploy-target \
--environment=prod \
--dry-run=false \
--deploy-env-file="${DEPLOY_ENV_FILE}" \
--toolchain-image-provider=github \
--toolchain-image-policy=lazy \
--rush-cache-provider=github \
--rush-cache-policy=lazy \
--source-mode=git \
--source-repository-url="${SOURCE_REPOSITORY_URL}" \
--source-ref="${GITHUB_REF}" \
--source-auth-token-env=GITHUB_TOKEN \
--runtime-files="${RUNTIME_FILES_DIR}" \
--docker-socket=/var/run/docker.sock

Use Local Runs when you need to test changes that have not been pushed to the remote repository yet.

For all callable module inputs, see the Public Dagger API.