mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
Add retry logic and authentication to ACS deployment version fetch (#5051)
* Initial plan * Add retry logic and authentication to ACS deployment version fetch Co-authored-by: pmacius <158472457+pmacius@users.noreply.github.com> * Update .github/actions/deploy-local-acs/action.yml --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pmacius <158472457+pmacius@users.noreply.github.com>
This commit is contained in:
@@ -69,11 +69,41 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
ACS_VERSION_INPUT: ${{ inputs.acs_deployment_version }}
|
ACS_VERSION_INPUT: ${{ inputs.acs_deployment_version }}
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
run: |
|
run: |
|
||||||
if [ "$ACS_VERSION_INPUT" = "latest" ]; then
|
if [ "$ACS_VERSION_INPUT" = "latest" ]; then
|
||||||
latest_tag=$(curl -s https://api.github.com/repos/Alfresco/acs-deployment/releases/latest | jq -r .tag_name)
|
max_retries=3
|
||||||
echo "Using latest ACS deployment version: $latest_tag"
|
retry_count=0
|
||||||
echo "version=$latest_tag" >> $GITHUB_OUTPUT
|
latest_tag=""
|
||||||
|
|
||||||
|
while [ $retry_count -lt $max_retries ]; do
|
||||||
|
echo "Attempt $((retry_count + 1)) of $max_retries to fetch latest ACS deployment version..."
|
||||||
|
if [ -n "$GITHUB_TOKEN" ]; then
|
||||||
|
response=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/Alfresco/acs-deployment/releases/latest)
|
||||||
|
else
|
||||||
|
response=$(curl -s https://api.github.com/repos/Alfresco/acs-deployment/releases/latest)
|
||||||
|
fi
|
||||||
|
|
||||||
|
latest_tag=$(echo "$response" | jq -r .tag_name 2>/dev/null || echo "")
|
||||||
|
if [ "$latest_tag" != "null" ] && [ -n "$latest_tag" ]; then
|
||||||
|
echo "Successfully fetched latest ACS deployment version: $latest_tag"
|
||||||
|
echo "version=$latest_tag" >> $GITHUB_OUTPUT
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Warning: Received invalid response (tag_name: $latest_tag)"
|
||||||
|
retry_count=$((retry_count + 1))
|
||||||
|
|
||||||
|
if [ $retry_count -lt $max_retries ]; then
|
||||||
|
sleep_time=$((2 ** retry_count))
|
||||||
|
echo "Retrying in $sleep_time seconds..."
|
||||||
|
sleep $sleep_time
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Error: Failed to fetch latest ACS deployment version after $max_retries attempts"
|
||||||
|
echo "Last response: $response"
|
||||||
|
exit 1
|
||||||
else
|
else
|
||||||
echo "Using specified ACS deployment version: $ACS_VERSION_INPUT"
|
echo "Using specified ACS deployment version: $ACS_VERSION_INPUT"
|
||||||
echo "version=$ACS_VERSION_INPUT" >> $GITHUB_OUTPUT
|
echo "version=$ACS_VERSION_INPUT" >> $GITHUB_OUTPUT
|
||||||
|
|||||||
Reference in New Issue
Block a user