From cd73a705e99f11889a0da8ceca445fe680545a78 Mon Sep 17 00:00:00 2001 From: Cameron Skinner Date: Tue, 13 Oct 2020 21:46:26 +0000 Subject: [PATCH] Change CD workflow to use new staging bucket for artifacts --- .github/workflows/CD.yml | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml index aeef4dd2..c9278c99 100644 --- a/.github/workflows/CD.yml +++ b/.github/workflows/CD.yml @@ -32,11 +32,26 @@ jobs: - name: Run build run: | ./gradlew buildPackages --console=plain -Dbuild.snapshot=false - artifact=`ls build/distributions/*.zip` - rpm_artifact=`ls build/distributions/*.rpm` - deb_artifact=`ls build/distributions/*.deb` - - aws s3 cp $artifact s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/elasticsearch-plugins/opendistro-anomaly-detection/ - aws s3 cp $rpm_artifact s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/rpms/opendistro-anomaly-detection/ - aws s3 cp $deb_artifact s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/debs/opendistro-anomaly-detection/ - aws cloudfront create-invalidation --distribution-id E1VG5HMIWI4SA2 --paths "/downloads/*" + + - name: Upload to S3 + shell: bash + run: | + zip=`ls build/distributions/*.zip` + rpm=`ls build/distributions/*.rpm` + deb=`ls build/distributions/*.deb` + + # Inject the build number before the suffix + zip_outfile=`basename ${zip%.zip}-build-${GITHUB_RUN_NUMBER}.zip` + rpm_outfile=`basename ${rpm%.rpm}-build-${GITHUB_RUN_NUMBER}.rpm` + deb_outfile=`basename ${deb%.deb}-build-${GITHUB_RUN_NUMBER}.deb` + + s3_prefix="s3://staging.artifacts.opendistroforelasticsearch.amazon.com/snapshot/elasticsearch-plugins/anomaly-detection/" + + echo "Copying ${zip} to ${s3_prefix}${zip_outfile}" + aws s3 cp --quiet $zip ${s3_prefix}${zip_outfile} + + echo "Copying ${rpm} to ${s3_prefix}${rpm_outfile}" + aws s3 cp --quiet $rpm ${s3_prefix}${rpm_outfile} + + echo "Copying ${deb} to ${s3_prefix}${deb_outfile}" + aws s3 cp --quiet $deb ${s3_prefix}${deb_outfile}