You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2022/06/03 10:35:03 UTC

[airflow] branch main updated: Migrate Jenkins example DAGs to new design #22451 (#24138)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 5bd64183f9 Migrate Jenkins example DAGs to new design #22451 (#24138)
5bd64183f9 is described below

commit 5bd64183f95e11f47d6b7bc54a4c0d0f74ab5ea6
Author: chethanuk-plutoflume <ch...@tessian.com>
AuthorDate: Fri Jun 3 11:34:55 2022 +0100

    Migrate Jenkins example DAGs to new design #22451 (#24138)
---
 airflow/providers/jenkins/example_dags/__init__.py      | 17 -----------------
 docs/apache-airflow-providers-jenkins/index.rst         |  2 +-
 .../providers/jenkins}/example_jenkins_job_trigger.py   | 11 ++++++++++-
 3 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/airflow/providers/jenkins/example_dags/__init__.py b/airflow/providers/jenkins/example_dags/__init__.py
deleted file mode 100644
index 217e5db960..0000000000
--- a/airflow/providers/jenkins/example_dags/__init__.py
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
diff --git a/docs/apache-airflow-providers-jenkins/index.rst b/docs/apache-airflow-providers-jenkins/index.rst
index 9a23555000..f9fec0645e 100644
--- a/docs/apache-airflow-providers-jenkins/index.rst
+++ b/docs/apache-airflow-providers-jenkins/index.rst
@@ -37,7 +37,7 @@ Content
     :maxdepth: 1
     :caption: Resources
 
-    Example DAGs <https://github.com/apache/airflow/tree/main/airflow/providers/jenkins/example_dags>
+    Example DAGs <https://github.com/apache/airflow/tree/main/tests/system/providers/jenkins>
     PyPI Repository <https://pypi.org/project/apache-airflow-providers-jenkins/>
     Installing from sources <installing-providers-from-sources>
 
diff --git a/airflow/providers/jenkins/example_dags/example_jenkins_job_trigger.py b/tests/system/providers/jenkins/example_jenkins_job_trigger.py
similarity index 91%
rename from airflow/providers/jenkins/example_dags/example_jenkins_job_trigger.py
rename to tests/system/providers/jenkins/example_jenkins_job_trigger.py
index ce2c8ac5ef..248beafe55 100644
--- a/airflow/providers/jenkins/example_dags/example_jenkins_job_trigger.py
+++ b/tests/system/providers/jenkins/example_jenkins_job_trigger.py
@@ -15,6 +15,7 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+import os
 from datetime import datetime
 
 from requests import Request
@@ -25,9 +26,11 @@ from airflow.providers.jenkins.hooks.jenkins import JenkinsHook
 from airflow.providers.jenkins.operators.jenkins_job_trigger import JenkinsJobTriggerOperator
 
 JENKINS_CONNECTION_ID = "your_jenkins_connection"
+ENV_ID = os.environ.get("SYSTEM_TESTS_ENV_ID")
+DAG_ID = "test_jenkins"
 
 with DAG(
-    "test_jenkins",
+    DAG_ID,
     default_args={
         "retries": 1,
         "concurrency": 8,
@@ -65,3 +68,9 @@ with DAG(
 
     # Task dependency created via `XComArgs`:
     #   job_trigger >> grab_artifact_from_jenkins()
+
+
+from tests.system.utils import get_test_run  # noqa: E402
+
+# Needed to run the example DAG with pytest (see: tests/system/README.md#run_via_pytest)
+test_run = get_test_run(dag)