From 21a1fc479314becb3174ec3b9a93af89eff3af1c Mon Sep 17 00:00:00 2001
From: Lorenzo Pagliai <lorenzo.pagliai@seco.com>
Date: Thu, 15 Dec 2022 11:17:54 +0100
Subject: [PATCH] Insert --overwrite option on all Azure uploads

* The SW artifacts with the same name are overridden
* Bug fix on notification.json file search
---
 manifest-pipeline-yocto.yml | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/manifest-pipeline-yocto.yml b/manifest-pipeline-yocto.yml
index 18a17ec..149c902 100644
--- a/manifest-pipeline-yocto.yml
+++ b/manifest-pipeline-yocto.yml
@@ -286,7 +286,8 @@ retrigger:
                                 --sas-token $AZURE_STORAGE_SAS_TOKEN \
                                 --container-name $AZURE_CONTAINER_NAME \
                                 --file $BASE_DIRECTORY/$uboot_filename \
-                                --name $AZURE_PATH/$TAG_NAME/$uboot_filename 
+                                --name $AZURE_PATH/$TAG_NAME/$uboot_filename \
+                                --overwrite
 
          if [ ! -n "$CI_COMMIT_TAG" ]; then 
          az storage blob upload --account-name $AZURE_STORAGE_ACCOUNT \
@@ -325,7 +326,8 @@ retrigger:
                                 --sas-token $AZURE_STORAGE_SAS_TOKEN \
                                 --container-name $AZURE_CONTAINER_NAME \
                                 --file $BASE_DIRECTORY/$kernel_filename \
-                                --name $AZURE_PATH/$TAG_NAME/$kernel_filename
+                                --name $AZURE_PATH/$TAG_NAME/$kernel_filename \
+                                --overwrite
          
          if [ ! -n "$CI_COMMIT_TAG" ]; then
          az storage blob upload --account-name $AZURE_STORAGE_ACCOUNT \
@@ -346,7 +348,8 @@ retrigger:
          #                        --sas-token $AZURE_STORAGE_SAS_TOKEN \
          #                        --container-name $AZURE_CONTAINER_NAME \
          #                        --file $BASE_DIRECTORY/$filesystem_name \
-         #                        --name $AZURE_PATH/$TAG_NAME/$filesystem_name 
+         #                        --name $AZURE_PATH/$TAG_NAME/$filesystem_name \
+         #                        --overwrite
 
          # if [ ! -n "$CI_COMMIT_TAG" ]; then
          # az storage blob upload --account-name $AZURE_STORAGE_ACCOUNT \
@@ -370,7 +373,8 @@ retrigger:
                                 --sas-token $AZURE_STORAGE_SAS_TOKEN \
                                 --container-name $AZURE_CONTAINER_NAME \
                                 --file $BASE_DIRECTORY/$image_name \
-                                --name $AZURE_PATH/$TAG_NAME/$image_name 
+                                --name $AZURE_PATH/$TAG_NAME/$image_name \
+                                --overwrite
 
          if [ ! -n "$CI_COMMIT_TAG" ]; then
          az storage blob upload --account-name $AZURE_STORAGE_ACCOUNT \
@@ -392,7 +396,8 @@ retrigger:
                                 --sas-token $AZURE_STORAGE_SAS_TOKEN \
                                 --container-name $AZURE_CONTAINER_NAME \
                                 --file $BASE_DIRECTORY/$bmap_name \
-                                --name $AZURE_PATH/$TAG_NAME/$bmap_name 
+                                --name $AZURE_PATH/$TAG_NAME/$bmap_name \
+                                --overwrite
          
          if [ ! -n "$CI_COMMIT_TAG" ]; then
          az storage blob upload --account-name $AZURE_STORAGE_ACCOUNT \
@@ -414,7 +419,8 @@ retrigger:
                                 --sas-token $AZURE_STORAGE_SAS_TOKEN \
                                 --container-name $AZURE_CONTAINER_NAME \
                                 --file $BASE_DIRECTORY/$bundle_filename \
-                                --name $AZURE_PATH/$TAG_NAME/$bundle_filename 
+                                --name $AZURE_PATH/$TAG_NAME/$bundle_filename \
+                                --overwrite
          
          if [ ! -n "$CI_COMMIT_TAG" ]; then
          az storage blob upload --account-name $AZURE_STORAGE_ACCOUNT \
@@ -496,7 +502,7 @@ notify:
     - if: $CI_PIPELINE_SOURCE == "schedule"
     - if: $CI_COMMIT_TAG
   script:
-     - |
+     - |      
        echo -e "The job results for all boards are listed below (also available by clicking on the **Job Report** button)." >> Job_message.txt
        echo -e "The paths to all packages can be accessed by clicking on the **Link Report** button." >> Job_message.txt
        echo -e "*We kindly ask developers to check job results so that in case of failures a fix to eventual bugs can be promptly made.*" >> Job_message.txt
@@ -511,14 +517,17 @@ notify:
                               --sas-token $AZURE_STORAGE_SAS_TOKEN \
                               --container-name $AZURE_CONTAINER_NAME \
                               --file Job_report_ARM_imx_$(date +%Y%m%d).txt \
-                              --name Job_report_ARM_imx_$(date +%Y%m%d).txt 
+                              --name Job_report_ARM_imx_$(date +%Y%m%d).txt \
+                              --overwrite
        
        az storage blob upload --account-name $AZURE_STORAGE_ACCOUNT \
                               --sas-token $AZURE_STORAGE_SAS_TOKEN \
                               --container-name $AZURE_CONTAINER_NAME \
                               --file Link_report_ARM_imx_$(date +%Y%m%d).txt \
-                              --name Link_report_ARM_imx_$(date +%Y%m%d).txt
+                              --name Link_report_ARM_imx_$(date +%Y%m%d).txt \
+                              --overwrite
 
+       cp .gitlab-ci/notification.json .
        job_report="$(az storage blob url --container-name $AZURE_CONTAINER_NAME --name Job_report_ARM_imx_$(date +%Y%m%d).txt)"
        job_report="$(echo $job_report | sed -E 's/\s.*$//')"
        jq --arg job_var $job_report '.potentialAction[0].targets[0].uri = $job_var' notification.json > notification_1.json
-- 
GitLab