Trigger Jenkins job from Airflow

Viewed 1453

I am trying to trigger Jenkins job from Airflow. I have added connection details - Host as "https://jenkins.optum.com/abc/". Addded Username, Password and Port details. Connection Id is 'Airflow_Jenkins'. Jenkins Multibranch pipeline job name is 'Airflow_Audit. When I try to run the task getting below error:

[2020-04-08 11:41:25,535] {logging_mixin.py:95} INFO - [2020-04-08 11:41:25,535] {jenkins_hook.py:44} INFO - Trying to connect to http://https://jenkins.optum.com/abc/:80 [2020-04-08 11:41:25,540] {init.py:1580} ERROR - HTTPConnectionPool(host='https', port=80): Max retries exceeded with url: /jenkins.optum.com/abc/:80/crumbIssuer/api/json (Caused by NewConnectionError(': Failed to establish a new connection: [Errno -2] Name or service not known',))

Below is my code:

job_trigger = JenkinsJobTriggerOperator(
  dag=dag,
  task_id="trigger_job",
  job_name="Airflow_Audit",
  #parameters={"first_parameter":"a_value", "second_parameter":"18"},
  #parameters="resources/paremeter.json", You can also pass a path to a json file containing your param
  jenkins_connection_id="Airflow_Jenkins" #The connection must be configured first
)
1 Answers
Related