{"id":6988,"library":"apache-airflow-providers-jenkins","title":"Apache Airflow Jenkins Provider","description":"The Apache Airflow Jenkins Provider package integrates Apache Airflow with Jenkins, a popular open-source automation server. It allows users to orchestrate and monitor Jenkins jobs directly from Airflow Directed Acyclic Graphs (DAGs), enabling seamless integration of CI/CD pipelines and data workflows. The current version is 4.2.5, and it follows the release cadence of the Apache Airflow provider ecosystem.","status":"active","version":"4.2.5","language":"en","source_language":"en","source_url":"https://github.com/apache/airflow/tree/main/airflow/providers/jenkins","tags":["Apache Airflow","Jenkins","Provider","ETL","Workflow Orchestration","CI/CD"],"install":[{"cmd":"pip install apache-airflow-providers-jenkins","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Core Apache Airflow installation is required to use this provider.","package":"apache-airflow","optional":false},{"reason":"Required for communicating with the Jenkins API.","package":"python-jenkins","optional":false},{"reason":"Optional dependency for certain compatibility features.","package":"apache-airflow-providers-common-compat","optional":true}],"imports":[{"symbol":"JenkinsHook","correct":"from airflow.providers.jenkins.hooks.jenkins import JenkinsHook"},{"symbol":"JenkinsJobTriggerOperator","correct":"from airflow.providers.jenkins.operators.jenkins_job_trigger import JenkinsJobTriggerOperator"},{"note":"Old contrib imports are deprecated and should use the new provider path for Airflow 2+.","wrong":"from airflow.contrib.sensors.jenkins_build_sensor import JenkinsBuildSensor","symbol":"JenkinsBuildSensor","correct":"from airflow.providers.jenkins.sensors.jenkins_build import JenkinsBuildSensor"}],"quickstart":{"code":"from __future__ import annotations\nimport pendulum\nfrom airflow.models.dag import DAG\nfrom airflow.providers.jenkins.operators.jenkins_job_trigger import JenkinsJobTriggerOperator\n\n# Ensure you have a Jenkins connection configured in Airflow UI:\n# Conn Id: jenkins_default\n# Conn Type: Jenkins\n# Host: http://your-jenkins-server.com:8080\n# Login: your_jenkins_username\n# Password: your_jenkins_password\n\nwith DAG(\n    dag_id='jenkins_job_example',\n    start_date=pendulum.datetime(2023, 1, 1, tz=\"UTC\"),\n    catchup=False,\n    schedule=None,\n    tags=['jenkins', 'example'],\n) as dag:\n    trigger_jenkins_job = JenkinsJobTriggerOperator(\n        task_id='trigger_my_jenkins_job',\n        jenkins_connection_id='jenkins_default',\n        job_name='my_sample_jenkins_job',\n        parameters={'PARAM1': 'value1', 'PARAM2': 'value2'},\n        allowed_jenkins_states=['SUCCESS', 'UNSTABLE'],\n        # Optional: You can also specify build_params for a specific build trigger\n        # build_params={'token': 'YOUR_JENKINS_JOB_TOKEN'}\n    )\n","lang":"python","description":"This quickstart demonstrates how to trigger a Jenkins job using the `JenkinsJobTriggerOperator`. Before running, configure a Jenkins connection named 'jenkins_default' in your Airflow UI with the appropriate Jenkins server URL, username, and password. The example assumes a Jenkins job named 'my_sample_jenkins_job' exists and accepts 'PARAM1' and 'PARAM2' as build parameters."},"warnings":[{"fix":"Upgrade your Apache Airflow environment to version 2.2.0 or higher before installing or upgrading to `apache-airflow-providers-jenkins` 3.0.0+.","message":"Provider version 3.0.0 and above explicitly requires Apache Airflow 2.2+. Attempting to install on older Airflow versions may lead to unexpected behavior or automatic Airflow upgrades.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Ensure your Apache Airflow is at least version 2.1.0. If upgrading from pre-2.1.0, manually run `airflow upgrade db` after the upgrade.","message":"Provider version 2.0.0 introduced breaking changes related to the removal of the `apply_default` decorator, requiring Airflow 2.1.0+. If your Airflow version is older, an automatic upgrade might occur, necessitating a manual `airflow upgrade db`.","severity":"breaking","affected_versions":">=2.0.0 <3.0.0"},{"fix":"For modern Airflow (2.x+), ensure you have a recent pip version (>=21.0). If encountering issues, try upgrading pip (`pip install --upgrade pip`) or in older environments, use `pip install --use-deprecated=legacy-resolver` or downgrade pip to `20.2.4`.","message":"When installing Airflow providers, especially with older pip versions (e.g., pip 20.3 in late 2020), dependency resolution issues might occur. This was due to changes in pip's dependency resolver.","severity":"gotcha","affected_versions":"<2.x.x of Apache Airflow core, and specific pip versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Update your import statements to use the correct provider path: `from airflow.providers.jenkins.operators.jenkins_job_trigger import JenkinsJobTriggerOperator`.","cause":"Using an outdated import path for Jenkins operators/hooks that were part of `airflow.contrib` in Airflow 1.x. In Airflow 2.x, these components moved to dedicated provider packages.","error":"ModuleNotFoundError: No module named 'airflow.contrib.operators.jenkins_operator'"},{"fix":"Navigate to `Admin -> Connections` in the Airflow UI, click `+` to create a new connection. Set `Conn Id` to `jenkins_default`, `Conn Type` to `Jenkins`, and fill in `Host`, `Login`, and `Password` for your Jenkins server.","cause":"The Jenkins connection specified in the operator's `jenkins_connection_id` parameter has not been configured in the Airflow UI or `airflow.cfg`.","error":"airflow.exceptions.AirflowException: The conn_id `jenkins_default` isn't defined."},{"fix":"Verify the `job_name` in your DAG matches an existing job in Jenkins. Also, ensure the Jenkins user configured in your Airflow connection has 'Build' and 'Read' permissions for that specific job.","cause":"The specified Jenkins job name either does not exist on the configured Jenkins server or the Jenkins user lacks the necessary permissions to access/trigger it.","error":"jenkins.JenkinsException: Error in request. Status code: 404"}]}