Skip to content

Commit

Permalink
enh(ci): rebuild yum metadata only one time (#463)
Browse files Browse the repository at this point in the history
  • Loading branch information
kduret committed Dec 9, 2022
1 parent 7d9e5e6 commit 390190e
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions .github/actions/delivery/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,27 +122,32 @@ runs:
ssh-add - <<< "${{ inputs.yum_repo_key }}"
TARGET="/srv/centreon-yum/yum.centreon.com/$PROJECT_PATH/$MAJOR/$DISTRIB/$REPOTYPE/$ARCH/$PROJECT/$FOLDER"
PROJECT_LOCATION="/srv/centreon-yum/yum.centreon.com/$PROJECT_PATH/$MAJOR/$DISTRIB/$REPOTYPE/$ARCH/$PROJECT"
METADATAS="/srv/centreon-yum/yum.centreon.com/$PROJECT_PATH/$MAJOR/$DISTRIB/$REPOTYPE/$ARCH"
echo "[DEBUG] - Folder: $FOLDER"
echo "[DEBUG] - Project : $PROJECT"
echo "[DEBUG] - Target : $TARGET"
echo "[DEBUG] - PROJECT_LOCATION : $PROJECT_LOCATION"
ssh -o StrictHostKeyChecking=no "${{ inputs.yum_repo_address }}" mkdir -p "$TARGET" 2>&-
scp -o StrictHostKeyChecking=no "$FILE" "${{ inputs.yum_repo_address }}:$TARGET" 2>&-
#ssh -o StrictHostKeyChecking=no "${{ inputs.yum_repo_address }}" "ls -drc $PROJECT_LOCATION/* 2>&- | head -n -6 | xargs rm -rf"
ssh -o StrictHostKeyChecking=no "${{ inputs.yum_repo_address }}" "sh "${{ inputs.update_repo_path }}" $METADATAS" 2>&-
fi
done
ID="${{ inputs.cloudfront_id }}"
PATHS="/$PROJECT_PATH/$MAJOR/$DISTRIB/$REPOTYPE/$ARCH/*"
ITERATIONS=1
until aws cloudfront create-invalidation --distribution-id "$ID" --paths "$PATHS"; do
if [ ${ITERATIONS} -eq 10 ]; then
return 0
fi
echo "couldn't invalidate cache, AWS quota might have been reached, retrying in 30 seconds..."
sleep 30s
ITERATIONS=$((ITERATIONS+1))
done
# run this only for rpm
if [[ "${{ env.extfile }}" == "rpm" ]] ; then
METADATAS="/srv/centreon-yum/yum.centreon.com/$PROJECT_PATH/$MAJOR/$DISTRIB/$REPOTYPE/$ARCH"
ssh -o StrictHostKeyChecking=no "${{ inputs.yum_repo_address }}" "sh "${{ inputs.update_repo_path }}" $METADATAS" 2>&-
ID="${{ inputs.cloudfront_id }}"
PATHS="/$PROJECT_PATH/$MAJOR/$DISTRIB/$REPOTYPE/$ARCH/*"
ITERATIONS=1
until aws cloudfront create-invalidation --distribution-id "$ID" --paths "$PATHS"; do
if [ ${ITERATIONS} -eq 10 ]; then
return 0
fi
echo "couldn't invalidate cache, AWS quota might have been reached, retrying in 30 seconds..."
sleep 30s
ITERATIONS=$((ITERATIONS+1))
done
fi
shell: bash

0 comments on commit 390190e

Please sign in to comment.