Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Commit

Permalink
Change release workflows to use new staging bucket for artifacts (#301)
Browse files Browse the repository at this point in the history
* Change release workflow to use new staging bucket for artifacts
Co-authored-by: Peter Zhu <zhujiaxi@amazon.com>
  • Loading branch information
gaiksaya authored Feb 1, 2021
1 parent b17f359 commit 1a5b871
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 21 deletions.
33 changes: 22 additions & 11 deletions .github/workflows/kibana-reports-release-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-access-key-id: ${{ secrets.AWS_STAGING_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_STAGING_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Checkout Plugin
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
max_attempts: 3
command: cd kibana/plugins/${{ env.PLUGIN_NAME }}; yarn test

- name: Build Artifact
- name: Build Artifact and upload to S3
run: |
cd kibana/plugins/${{ env.PLUGIN_NAME }}
yarn build
Expand All @@ -73,31 +73,42 @@ jobs:
cp ./${{ env.PLUGIN_NAME }}-*.zip ./linux-arm64/${{ env.PLUGIN_NAME }}-${{ env.OD_VERSION }}-linux-arm64.zip
mv ./${{ env.PLUGIN_NAME }}-*.zip ./windows-x64/${{ env.PLUGIN_NAME }}-${{ env.OD_VERSION }}-windows-x64.zip
s3_prefix="s3://staging.artifacts.opendistroforelasticsearch.amazon.com/snapshots/kibana-plugins/reports/"
cd linux-x64
wget https://github.com/opendistro-for-elasticsearch/kibana-reports/releases/download/chromium-1.12.0.0/chromium-linux-x64.zip
unzip chromium-linux-x64.zip -d ./kibana/${{ env.PLUGIN_NAME }}
rm chromium-linux-x64.zip
zip -ur ./${{ env.PLUGIN_NAME }}-*.zip ./kibana
linux_artifact=`ls ./${{ env.PLUGIN_NAME }}-${{ env.OD_VERSION }}-linux-x64.zip`
aws s3 cp $linux_artifact s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/kibana-plugins/opendistro-reports/linux/x64/
linux_x64_artifact=`ls ./${{ env.PLUGIN_NAME }}-${{ env.OD_VERSION }}-linux-x64.zip`
#Inject build number before the suffix and upload to S3
linux_x64_artifact_outfile=`basename ${linux_x64_artifact%.zip}-build-${GITHUB_RUN_NUMBER}.zip`
echo "Copying $linux_x64_artifact to ${s3_prefix}${linux_x64_artifact_outfile}"
aws s3 cp --quiet $linux_x64_artifact ${s3_prefix}${linux_x64_artifact_outfile}
cd ..
cd linux-arm64
wget https://github.com/opendistro-for-elasticsearch/kibana-reports/releases/download/chromium-1.12.0.0/chromium-linux-arm64.zip
unzip chromium-linux-arm64.zip -d ./kibana/${{ env.PLUGIN_NAME }}
rm chromium-linux-arm64.zip
zip -ur ./${{ env.PLUGIN_NAME }}-*.zip ./kibana
arm_artifact=`ls ./${{ env.PLUGIN_NAME }}-${{ env.OD_VERSION }}-linux-arm64.zip`
aws s3 cp $arm_artifact s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/kibana-plugins/opendistro-reports/linux/arm64/
linux_arm64_artifact=`ls ./${{ env.PLUGIN_NAME }}-${{ env.OD_VERSION }}-linux-arm64.zip`
#Inject build number before the suffix and upload to S3
linux_arm64_artifact_outfile=`basename ${linux_arm64_artifact%.zip}-build-${GITHUB_RUN_NUMBER}.zip`
echo "Copying $linux_arm64_artifact to ${s3_prefix}${linux_arm64_artifact_outfile}"
aws s3 cp --quiet $linux_arm64_artifact ${s3_prefix}${linux_arm64_artifact_outfile}
cd ..
cd windows-x64
wget https://github.com/opendistro-for-elasticsearch/kibana-reports/releases/download/chromium-1.12.0.0/chromium-windows-x64.zip
unzip chromium-windows-x64.zip -d ./kibana/${{ env.PLUGIN_NAME }}
rm chromium-windows-x64.zip
zip -ur ./${{ env.PLUGIN_NAME }}-*.zip ./kibana
windows_artifact=`ls ./${{ env.PLUGIN_NAME }}-${{ env.OD_VERSION }}-windows-x64.zip`
aws s3 cp $windows_artifact s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/kibana-plugins/opendistro-reports/windows/x64/
cd ..
windows_x64_artifact=`ls ./${{ env.PLUGIN_NAME }}-${{ env.OD_VERSION }}-windows-x64.zip`
aws cloudfront create-invalidation --distribution-id ${{ secrets.DISTRIBUTION_ID }} --paths "/downloads/*"
#Inject build number before the suffix and upload to S3
windows_x64_artifact_outfile=`basename ${windows_x64_artifact%.zip}-build-${GITHUB_RUN_NUMBER}.zip`
echo "Copying $windows_x64_artifact to ${s3_prefix}${windows_x64_artifact_outfile}"
aws s3 cp --quiet $windows_x64_artifact ${s3_prefix}${windows_x64_artifact_outfile}
36 changes: 26 additions & 10 deletions .github/workflows/reports-scheduler-release-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-access-key-id: ${{ secrets.AWS_STAGING_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_STAGING_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Checkout Plugin
Expand All @@ -29,11 +29,27 @@ jobs:
run: |
cd reports-scheduler
./gradlew build buildDeb buildRpm --no-daemon --refresh-dependencies -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-reports-scheduler/
aws s3 cp $rpm_artifact s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/rpms/opendistro-reports-scheduler/
aws s3 cp $deb_artifact s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/debs/opendistro-reports-scheduler/
aws cloudfront create-invalidation --distribution-id ${{ secrets.DISTRIBUTION_ID }} --paths "/downloads/*"
- name: Upload to S3
shell: bash
run: |
cd reports-scheduler
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/snapshots/elasticsearch-plugins/reports-scheduler/"
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}

0 comments on commit 1a5b871

Please sign in to comment.