[GHA] Cleanup and cache purge via cloudflare action

This commit is contained in:
aboyko
2024-07-12 14:25:06 -04:00
parent 5144d97b1c
commit 62dd211877
8 changed files with 32 additions and 157 deletions

View File

@@ -81,30 +81,27 @@ jobs:
else
./mvnw --batch-mode clean install -P${{ inputs.eclipse_profile }} -P${{ inputs.build_type }} $sts4_ls_version_param -Pgitactions -Pgpg.sign -Dmaven.test.skip=true -Dhttpclient.retry-max=20 -Declipse.p2.mirrors=false -Dtycho.localArtifacts=ignore
fi
- name: Upload P2 Repo to S3 and Akamai
id: upload-p2-to-akamai
- name: Upload P2 Repo to S3
id: upload-p2
run: |
p2_path=`cat ${{ github.workspace }}/eclipse-language-servers/org.springframework.tooling.ls.integration.repository/target/s3-p2-repo-dist-path.txt`
echo "p2_path=$p2_path" >> $GITHUB_OUTPUT
echo "P2 path: ${p2_path}"
aws s3 rm s3://$AWS_S3_BUCKET/${p2_path}/ --recursive
aws s3 cp ${{ github.workspace }}/eclipse-language-servers/org.springframework.tooling.ls.integration.repository/target/repository/ s3://$AWS_S3_BUCKET/${p2_path}/ --recursive --no-progress
# - name: Verify Uploaded P2 Repo
# id: verify-p2-on-akamai
# run: |
# p2_path=`cat ${{ github.workspace }}/eclipse-language-servers/org.springframework.tooling.ls.integration.repository/target/s3-p2-repo-dist-path.txt`
# echo "Verifying uploaded to Akamai files..."
# cd ${{ github.workspace }}/eclipse-language-servers/org.springframework.tooling.ls.integration.repository/target/repository/plugins
# for f in `ls -p | grep -v '/$'`
# do
# wget --no-verbose -O /dev/null https://cdn.spring.io/spring-tools/$p2_path/plugins/$f
# done
- name: Compute invalid URLs
if: ${{ inputs.build_type != 'snapshot' }}
id: compute-invalid-urls
run: |
invalid_urls=`aws s3 ls s3://$AWS_S3_BUCKET/${{ steps.upload-p2-to-akamai.outputs.p2_path }}/ --recursive | awk '{$1=$2=$3=""; print $0}' | sed -e 's/^[ \t]*/https:\/\/cdn.spring.io\/spring-tools\//' | paste -sd' ' -`
invalid_urls=`aws s3 ls s3://$AWS_S3_BUCKET/${{ steps.upload-p2.outputs.p2_path }}/ --recursive | awk '{$1=$2=$3=""; print $0}' | sed -e 's/^[ \t]*/https:\/\/cdn.spring.io\/spring-tools\//' | paste -sd' ' -`
echo "invalid_urls=$invalid_urls" >> $GITHUB_OUTPUT
- uses: ./.github/actions/cloudflare-purge
if: ${{ inputs.build_type != 'snapshot' }}
name: Invalidate URLs
with:
urls: ${{ steps.compute-invalid-urls.outputs.invalid_urls }}
cloudflare_zone_id: ${{ secrets.CLOUDFLARE_ZONE_ID }}
cloudflare_cache_token: ${{ secrets.CLOUDFLARE_CACHE_TOKEN }}
- name: Verify Eclipse LS Extensions on e433
if: ${{ inputs.build_type == 'snapshot' }}
run: |
@@ -115,19 +112,6 @@ jobs:
./mvnw --batch-mode clean package -Pe433 -P${{ inputs.build_type }} -Dhttpclient.retry-max=20 -Declipse.p2.mirrors=false -Dmaven.test.skip=true -Dtycho.localArtifacts=ignore
fi
purge_cache:
needs: [ eclipse-language-servers-build ]
if: ${{ inputs.build_type != 'snapshot' }}
runs-on: [self-hosted]
steps:
- uses: ./.github/actions/akamai-purge-osx
name: Invalidate URLs
env:
EDGERC: ${{ secrets.EDGERC }}
with:
command: invalidate
urls: ${{ needs.eclipse-language-servers-build.outputs.invalid_urls }}
notify-failure:
needs: [ eclipse-language-servers-build, purge_cache ]
if: ${{ always() && contains(needs.*.result, 'failure') }}