From f4aa0048f11967abce493810aefb429a13ded32f Mon Sep 17 00:00:00 2001
From: Tim Jaacks <tim.jaacks@seco.com>
Date: Fri, 15 Sep 2023 14:17:54 +0200
Subject: [PATCH] Hide FTP stage if DEPLOY_FTP_TARGET not set

This makes the variable HIDE_FTP_UPLOAD_STAGE obsolete, because we can
hide the FTP stage now by setting DEPLOY_FTP_TARGET to an empty string.
---
 build-pipeline-yocto.yml.jinja2 | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/build-pipeline-yocto.yml.jinja2 b/build-pipeline-yocto.yml.jinja2
index 94ea1cc5..68279340 100644
--- a/build-pipeline-yocto.yml.jinja2
+++ b/build-pipeline-yocto.yml.jinja2
@@ -185,10 +185,6 @@ import-alphaplan-data-{{ machine }}:
 # --------------------------------------------------------------------------------------
 # Stage: Deploy FTP
 # --------------------------------------------------------------------------------------
-# FIXME: This is a workaround to prevent customer releases being uploaded to our
-# public FTP area. It should be removed as soon as we support uploading to different
-# FTP target folders.
-{% if HIDE_FTP_UPLOAD_STAGE is not defined or not HIDE_FTP_UPLOAD_STAGE %}
 {% if SIMULATE_BUILD is defined and SIMULATE_BUILD == "true"
    or CI_COMMIT_TAG is defined %}
 
@@ -197,6 +193,10 @@ ftp-{{ machine }}:
   stage: Deploy FTP
   tags:
     - ftp
+  rules:
+    - if: $DEPLOY_FTP_TARGET
+      when: manual
+      allow_failure: true
   variables:
     MACHINE: {{ machine }}
     DEPLOY_SOURCE: ${RELEASE_NAME}
@@ -210,7 +210,6 @@ ftp-{{ machine }}:
     - job: build-version
 
 {% endif %}
-{% endif %}
 
 
 # --------------------------------------------------------------------------------------
@@ -250,7 +249,6 @@ azure-{{ machine }}:
 # --------------------------------------------------------------------------------------
 # Stage: Confluence
 # --------------------------------------------------------------------------------------
-{% if HIDE_FTP_UPLOAD_STAGE is not defined or not HIDE_FTP_UPLOAD_STAGE %}
 {% if SIMULATE_BUILD is defined and SIMULATE_BUILD == "true"
    or CI_COMMIT_TAG is defined %}
 
@@ -265,6 +263,5 @@ publish-confluence-page:
     - .publish-confluence-page
 
 {% endif %}
-{% endif %}
 
 {% endif %} # if MACHINES
-- 
GitLab