From 0e947ebe4bff036f57558986f645a5f72f0ad841 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?I=C3=B1igo=20Moreno?= <inigo.moreno@tecnalia.com>
Date: Wed, 6 Oct 2021 17:09:36 +0200
Subject: [PATCH] Make deploy jobs only when ddeploy.yaml exists

---
 ci-templates/auto-rules/no-default.yml   | 12 ++++++------
 ci-templates/industrial-ci-templates.yml |  1 +
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/ci-templates/auto-rules/no-default.yml b/ci-templates/auto-rules/no-default.yml
index 9646c7b..1012ebb 100644
--- a/ci-templates/auto-rules/no-default.yml
+++ b/ci-templates/auto-rules/no-default.yml
@@ -56,24 +56,24 @@ industrial_ci_noetic:
 
 industrial_kinetic_deploy:
   extends: .ddeploy
-  variables:
-    ROS_DISTRO: kinetic
   rules:
     - if: $DEPLOY && $DEFAULT_DISTRO == "kinetic"
+      exists: ddeploy.yaml
     - if: $DEPLOY && $BUILD_KINETIC
+      exists: ddeploy.yaml
 
 industrial_melodic_deploy:
   extends: .ddeploy
-  variables:
-    ROS_DISTRO: melodic
   rules:
     - if: $DEPLOY && $DEFAULT_DISTRO == "melodic"
+      exists: ddeploy.yaml
     - if: $DEPLOY && $BUILD_MELODIC
+      exists: ddeploy.yaml
 
 industrial_noetic_deploy:
   extends: .ddeploy
-  variables:
-    ROS_DISTRO: noetic
   rules:
     - if: $DEPLOY && $DEFAULT_DISTRO == "noetic"
+      exists: ddeploy.yaml
     - if: $DEPLOY && $BUILD_NOETIC
+      exists: ddeploy.yaml
diff --git a/ci-templates/industrial-ci-templates.yml b/ci-templates/industrial-ci-templates.yml
index 4657031..b9c6251 100644
--- a/ci-templates/industrial-ci-templates.yml
+++ b/ci-templates/industrial-ci-templates.yml
@@ -20,6 +20,7 @@
     DOCKER_PUSH_REGISTRY: ${ARTIFACT_DOCKER_URL}
     DOCKER_PUSH_NAME: ${CI_PROJECT_NAME}
     DOCKER_PUSH_TAG: ${CI_COMMIT_REF_SLUG}
+    DDEPLOY_YAML: ddeploy.yaml
   before_script:
     - docker info
     - apk add --update python3 git py3-pip git-lfs
-- 
GitLab