From 9f6fa530f37bf22277e2ceb9e0ac47ad273120b1 Mon Sep 17 00:00:00 2001 From: Alex Kontos Date: Tue, 6 Sep 2022 17:28:24 +0100 Subject: [PATCH] [WFX-455] Update AUS logic, so latest version receives no update and previous versions receive latest update. --- .github/workflows/production.yml | 72 ++++++++++++++++++++++++-------- 1 file changed, 54 insertions(+), 18 deletions(-) diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml index 5b16c09f65332..33a57fdb9a95d 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/production.yml @@ -56,16 +56,34 @@ jobs: fi - name: "\U0001F9EA Dry run AUS" run: | - os=(WINNT_x86_64 Linux_x86_64 Darwin_x86_64-aarch64) - for j in ${os[@]} + OSA=(WINNT_x86_64 Linux_x86_64 Darwin_x86_64-aarch64) + for OS in "${OSA[@]}" do - update_loc=":s3:aus/update/staging/${{ env.CHANNEL }}/${{ inputs.DISPLAY_VERSION }}/"$j"/update.xml" - mkdir -p aus_tmp/$j/ - rclone copyto :s3:aus/update/staging/${{ env.CHANNEL }}/${{ inputs.DISPLAY_VERSION }}/"$j"/update.xml ./aus_tmp/$j/update.xml - sed -i 's/staging/releases/g' ./aus_tmp/$j/update.xml - sed -i 's/staging/releases/g' ./aus_tmp/$j/update.xml - sed -i 's/staging/releases/g' ./aus_tmp/$j/update.xml - rclone moveto ./aus_tmp/$j/update.xml :s3:aus/update/production/${{ env.CHANNEL }}/${{ inputs.DISPLAY_VERSION }}/"$j"/update.xml --dry-run + mkdir -p aus_tmp/"$OS"/ + rclone copyto :s3:aus/update/staging/${{ env.CHANNEL }}/${{ inputs.DISPLAY_VERSION }}/"$OS"/update.xml ./aus_tmp/"$OS"/update.xml + sed -i 's/staging/releases/g' ./aus_tmp/"$OS"/update.xml + done + for VER in $(rclone lsf --dirs-only :s3:aus/update/production/${{ env.CHANNEL }} | awk -v RS= '{$1=$1}1' | sed 's|/||g') + do + if [[ $VER != '/' ]] + then + if [[ $VER == "G5"* ]] + then + for OS in "${OSA[@]}" + do + rclone moveto ./aus_tmp/"$OS"/update.xml :s3:aus/update/production/${{ env.CHANNEL }}/"$VER"/"$OS"/update.xml --log-level DEBUG --dry-run + done + fi + fi + done + for OS in "${OSA[@]}" + do + cat <update.xml + + + + END + rclone moveto ./update.xml :s3:aus/update/production/${{ env.CHANNEL }}/${{ inputs.DISPLAY_VERSION }}/"$OS"/update.xml --log-level DEBUG --dry-run done - name: "\U0001F9EA Move installers from staging to production" run: > @@ -138,16 +156,34 @@ jobs: fi - name: "\U0001F69A Move update XMLs from staging" run: | - os=(WINNT_x86_64 Linux_x86_64 Darwin_x86_64-aarch64) - for j in ${os[@]} + OSA=(WINNT_x86_64 Linux_x86_64 Darwin_x86_64-aarch64) + for OS in "${OSA[@]}" + do + mkdir -p aus_tmp/"$OS"/ + rclone copyto :s3:aus/update/staging/${{ env.CHANNEL }}/${{ inputs.DISPLAY_VERSION }}/"$OS"/update.xml ./aus_tmp/"$OS"/update.xml + sed -i 's/staging/releases/g' ./aus_tmp/"$OS"/update.xml + done + for VER in $(rclone lsf --dirs-only :s3:aus/update/production/${{ env.CHANNEL }} | awk -v RS= '{$1=$1}1' | sed 's|/||g') + do + if [[ $VER != '/' ]] + then + if [[ $VER == "G5"* ]] + then + for OS in "${OSA[@]}" + do + rclone moveto ./aus_tmp/"$OS"/update.xml :s3:aus/update/production/${{ env.CHANNEL }}/"$VER"/"$OS"/update.xml + done + fi + fi + done + for OS in "${OSA[@]}" do - update_loc=":s3:aus/update/staging/${{ env.CHANNEL }}/${{ inputs.DISPLAY_VERSION }}/"$j"/update.xml" - mkdir -p aus_tmp/$j/ - rclone moveto :s3:aus/update/staging/${{ env.CHANNEL }}/${{ inputs.DISPLAY_VERSION }}/"$j"/update.xml ./aus_tmp/$j/update.xml - sed -i 's/staging/releases/g' ./aus_tmp/$j/update.xml - sed -i 's/staging/releases/g' ./aus_tmp/$j/update.xml - sed -i 's/staging/releases/g' ./aus_tmp/$j/update.xml - rclone moveto ./aus_tmp/$j/update.xml :s3:aus/update/production/${{ env.CHANNEL }}/${{ inputs.DISPLAY_VERSION }}/"$j"/update.xml + cat <update.xml + + + + END + rclone moveto ./update.xml :s3:aus/update/production/${{ env.CHANNEL }}/${{ inputs.DISPLAY_VERSION }}/"$OS"/update.xml done - name: "\U0001F69A Move MARs from staging" run: >