For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
      • AstroFully-managed data operations, powered by Apache Airflow.
      • Astro Private CloudRun Airflow-as-a-service in your environment.
      • Professional ServicesExpert Airflow services for your enterprise's success.
    • Tools
      • Cosmos
      • Orbiter
      • CLI
      • AI SDK
      • Agents
      • Blueprint
      • UpdatesThe State of Airflow 2026See the insights from over 5,800 data practitioners in the full report. Download Now ➔
  • Customers
  • Docs
    • Insights
      • Blog
      • Webinars
      • Resource Library
      • Events
    • Education
      • Academy
      • What is Airflow?
  • Pricing
Get Started Free
    • Overview
      • Overview
      • Authenticate an automation tool
        • Develop a CI/CD workflow
          • Template options
          • Jenkins
          • GitLab
          • AWS S3 bucket
          • AWS CodeBuild
          • Azure DevOps
          • GCS bucket
          • Bitbucket
          • CircleCI
          • Drone
          • Harness
      • Astro Terraform Provider
    • Book Office Hours

Product

  • Platform Overview
  • Astro
  • Astro Observe
  • Astro Private Cloud
  • Security & Trust
  • Pricing

Tools & Services

  • Cosmos
  • Docs
  • Professional Services
  • Product Updates

Use Cases

  • AI Ops
  • Data Observability
  • ETL/ELT
  • ML Ops
  • Operational Analytics
  • All Use Cases

Industries

  • Financial Services
  • Gaming
  • Retail
  • Manufacturing
  • Healthcare
  • All Industries

Resources

  • Academy
  • eBooks & Guides
  • Blog
  • Webinars
  • Events
  • The Data Flowcast Podcast
  • All Resources

Airflow

  • What is Airflow
  • Airflow on Astro
  • Airflow 3.0
  • Airflow Upgrades
  • Airflow Use Cases
  • Airflow 2.x End of Life

Company

  • Our Story
  • Customers
  • Newsroom
  • Careers
  • Contact

Support

  • Knowledge Base
  • Status
  • Contact Support
GitHubYouTubeLinkedInx
  • Legal
  • Privacy
  • Terms of Service
  • Consent Preferences

  • Do Not Sell or Share My Personal information
  • Limit the Use Of My Sensitive Personal Information

Apache Airflow®, Airflow, and the Airflow logo are trademarks of the Apache Software Foundation. Copyright © Astronomer 2026. All rights reserved.

LogoLogo
On this page
  • Prerequisites
  • Image deploy templates
  • Configuration requirements
  • Dag deploy templates
  • Single branch implementation
Automation & CI/CDCI/CDCI/CD templates

Astro CI/CD templates for Jenkins

Edit this page
Built with

Use the following CI/CD templates to automate deploying Apache Airflow dags from a Git repository to Astro with Jenkins.

The following templates for Jenkins are available:

  • Image deploy templates
  • dag deploy templates

Each template type supports multiple implementations. If you have one Deployment and one environment on Astro, use the single branch implementation. If you have multiple Deployments that support development and production environments, use the multiple branch implementation. If your team builds custom Docker images, use the custom image implementation.

For more information on each template or to configure your own, see Template overview. To learn more about CI/CD on Astro, see Choose a CI/CD strategy.

Prerequisites

  • An Astro project hosted in a Git repository that Jenkins can access.
  • An Astro Deployment.
  • A Deployment API token, Workspace API token, or Organization API token.
  • Access to Jenkins.

Each CI/CD template implementation might have additional requirements.

Image deploy templates

Single branch
Multiple branch
Custom Image

To automate code deploys to a single Deployment using Jenkins, complete the following setup in a Git-based repository hosting an Astro project:

  1. In your Jenkins pipeline configuration, add the following environment variables:

    • ASTRO_API_TOKEN: The value for your Workspace or Organization API token.
    • ASTRONOMER_DEPLOYMENT_ID: The Deployment ID of your production deployment

    To set environment variables in Jenkins, on the Jenkins Dashboard go to Manage Jenkins > Configure System > Global Properties > Environment Variables > Add. To see Jenkins documentation on environment variables click here

    Be sure to set the value for your API token as secret.

  2. At the root of your Astro Git repository, add a Jenkinsfile that includes the following script:

pipeline {
agent any
stages {
stage('Deploy to Astronomer') {
when {
expression {
return env.GIT_BRANCH == "origin/main"
}
}
steps {
checkout scm
sh '''
curl -LJO https://github.com/astronomer/astro-cli/releases/download/v1.38.0/astro_1.38.0_linux_amd64.tar.gz
tar -zxvf astro_1.38.0_linux_amd64.tar.gz astro && rm astro_1.38.0_linux_amd64.tar.gz
./astro deploy env.ASTRONOMER_DEPLOYMENT_ID
'''
}
}
}
post {
always {
cleanWs()
}
}
}

This Jenkinsfile triggers a code push to Astro every time a commit or pull request is merged to the main branch of your repository.

Dag deploy templates

The dag deploy template uses the --dags flag in the Astro CLI to push dag changes to Astro. These CI/CD pipelines deploy your dags only when files in your dags folder are modified, and they deploy the rest of your Astro project as a Docker image when other files or directories are modified. For more information about the benefits of this workflow, see Deploy dags only.

If you stage multiple commits to dag files and push them all at once to your remote branch, the template only deploys dag code changes from the most recent commit. It will miss any code changes made in previous commits.

To avoid this, either push commits individually or configure your repository to Squash commits for pull requests that merge multiple commits simultaneously.

Single branch implementation

Use the following template to implement dag-only deploys to a single Deployment using Jenkins.

  1. In your Jenkins pipeline configuration, add the following parameters:

    • ASTRO_API_TOKEN: The value for your Workspace or Organization API token.
    • ASTRONOMER_DEPLOYMENT_ID: The Deployment ID of your production deployment

    Be sure to set the values for your API token as secret.

  2. At the root of your Git repository, add a Jenkinsfile that includes the following script:

pipeline {
agent any
stages {
stage('Dag Only Deploy to Astronomer') {
when {
expression {
return env.GIT_BRANCH == "origin/main"
}
}
steps {
checkout scm
sh '''
curl -LJO https://github.com/astronomer/astro-cli/releases/download/v1.38.0/astro_1.38.0_linux_amd64.tar.gz
tar -zxvf astro_1.38.0_linux_amd64.tar.gz astro && rm astro_1.38.0_linux_amd64.tar.gz
files=($(git diff-tree HEAD --name-only --no-commit-id))
find="dags"
if [[ ${files[*]} =~ (^|[[:space:]])"$find"($|[[:space:]]) && ${#files[@]} -eq 1 ]]; then
./astro deploy env.ASTRONOMER_DEPLOYMENT_ID --dags;
else
./astro deploy env.ASTRONOMER_DEPLOYMENT_ID;
fi
'''
}
}
}
post {
always {
cleanWs()
}
}
}