From 09f6a5fa5e73995467ac433d69216d1f4bab94bb Mon Sep 17 00:00:00 2001 From: Sayali Gaikawad Date: Fri, 8 Jan 2021 18:15:00 -0800 Subject: [PATCH 1/4] Change release workflow to use new staging bucket for artifacts --- .github/workflows/release-workflow.yml | 134 ++++++++++++++----------- 1 file changed, 76 insertions(+), 58 deletions(-) diff --git a/.github/workflows/release-workflow.yml b/.github/workflows/release-workflow.yml index c6810c817..0be3408c8 100644 --- a/.github/workflows/release-workflow.yml +++ b/.github/workflows/release-workflow.yml @@ -1,9 +1,12 @@ name: Release workflow # This workflow is triggered on creating tags to master or an opendistro release branch on: + # push: + # tags: + # - 'v*' push: - tags: - - 'v*' + branches: + - "release-workflow-patch" jobs: build: @@ -43,65 +46,80 @@ 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-west-2 # This step uses the upload-artifact Github action: https://github.com/actions/upload-artifact - name: Upload Artifacts to S3 run: | - s3_path=s3://artifacts.opendistroforelasticsearch.amazon.com/downloads - aws s3 cp index-management-artifacts/*.zip $s3_path/elasticsearch-plugins/opendistro-index-management/ - aws s3 cp index-management-artifacts/*.deb $s3_path/debs/opendistro-index-management/ - aws s3 cp index-management-artifacts/*.rpm $s3_path/rpms/opendistro-index-management/ - aws cloudfront create-invalidation --distribution-id ${{ secrets.DISTRIBUTION_ID }} --paths '/downloads/*' - - - name: Create Github Draft Release - id: create_release - uses: actions/create-release@v1.0.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Release ${{ env.TAG_VERSION }} - draft: true - prerelease: false - - # Upload the release with .zip as asset - - name: Upload Release Asset - uses: actions/upload-release-asset@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_name: index-management-artifacts.zip - asset_path: index-management-artifacts_zip - asset_content_type: application/zip - - # Upload the release with .rpm as asset - - name: Upload Release Asset - uses: actions/upload-release-asset@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_name: index-management-artifacts.rpm - asset_path: index-management-artifacts_rpm - asset_content_type: application/zip - - # Upload the release with .deb as asset - - name: Upload Release Asset - uses: actions/upload-release-asset@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_name: index-management-artifacts.deb - asset_path: index-management-artifacts_deb - asset_content_type: application/zip + zip=`ls index-management-artifacts/*.zip` + rpm=`ls index-management-artifacts/*.rpm` + deb=`ls index-management-artifacts/*.deb` - - name: Upload Workflow Artifacts - uses: actions/upload-artifact@v1 - with: - name: index-management-plugin - path: index-management-artifacts + # 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/index-management/" + + 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} + + + # - name: Create Github Draft Release + # id: create_release + # uses: actions/create-release@v1.0.0 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # tag_name: ${{ github.ref }} + # release_name: Release ${{ env.TAG_VERSION }} + # draft: true + # prerelease: false + + # # Upload the release with .zip as asset + # - name: Upload Release Asset + # uses: actions/upload-release-asset@v1.0.1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ steps.create_release.outputs.upload_url }} + # asset_name: index-management-artifacts.zip + # asset_path: index-management-artifacts_zip + # asset_content_type: application/zip + + # # Upload the release with .rpm as asset + # - name: Upload Release Asset + # uses: actions/upload-release-asset@v1.0.1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ steps.create_release.outputs.upload_url }} + # asset_name: index-management-artifacts.rpm + # asset_path: index-management-artifacts_rpm + # asset_content_type: application/zip + + # # Upload the release with .deb as asset + # - name: Upload Release Asset + # uses: actions/upload-release-asset@v1.0.1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ steps.create_release.outputs.upload_url }} + # asset_name: index-management-artifacts.deb + # asset_path: index-management-artifacts_deb + # asset_content_type: application/zip + + # - name: Upload Workflow Artifacts + # uses: actions/upload-artifact@v1 + # with: + # name: index-management-plugin + # path: index-management-artifacts From 4b609dd443e8982cf2eb75bd65b51ea0e3c1a15c Mon Sep 17 00:00:00 2001 From: Sayali Gaikawad Date: Fri, 8 Jan 2021 19:10:23 -0800 Subject: [PATCH 2/4] Test --- .github/workflows/release-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-workflow.yml b/.github/workflows/release-workflow.yml index 0be3408c8..470bb066a 100644 --- a/.github/workflows/release-workflow.yml +++ b/.github/workflows/release-workflow.yml @@ -65,7 +65,7 @@ jobs: s3_prefix="s3://staging.artifacts.opendistroforelasticsearch.amazon.com/snapshot/elasticsearch-plugins/index-management/" echo "Copying ${zip} to ${s3_prefix}${zip_outfile}" - aws s3 cp --quiet $zip ${s3_prefix}${zip_outfile} + aws s3 cp $zip ${s3_prefix}${zip_outfile} echo "Copying ${rpm} to ${s3_prefix}${rpm_outfile}" aws s3 cp --quiet $rpm ${s3_prefix}${rpm_outfile} From 356232864c8d7bb17204131ba8aa05c4a40c5273 Mon Sep 17 00:00:00 2001 From: Sayali Gaikawad Date: Fri, 8 Jan 2021 19:26:20 -0800 Subject: [PATCH 3/4] Test --- .github/workflows/release-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-workflow.yml b/.github/workflows/release-workflow.yml index 470bb066a..218600bf9 100644 --- a/.github/workflows/release-workflow.yml +++ b/.github/workflows/release-workflow.yml @@ -62,7 +62,7 @@ jobs: 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/index-management/" + s3_prefix="s3://staging.artifacts.opendistroforelasticsearch.amazon.com/snapshots/elasticsearch-plugins/index-management/" echo "Copying ${zip} to ${s3_prefix}${zip_outfile}" aws s3 cp $zip ${s3_prefix}${zip_outfile} From 9858747fc31bb573cffb501387b56655ae91ef8d Mon Sep 17 00:00:00 2001 From: Sayali Gaikawad Date: Fri, 8 Jan 2021 19:41:26 -0800 Subject: [PATCH 4/4] Revert Test --- .github/workflows/release-workflow.yml | 106 ++++++++++++------------- 1 file changed, 51 insertions(+), 55 deletions(-) diff --git a/.github/workflows/release-workflow.yml b/.github/workflows/release-workflow.yml index 218600bf9..37e157cde 100644 --- a/.github/workflows/release-workflow.yml +++ b/.github/workflows/release-workflow.yml @@ -1,12 +1,9 @@ name: Release workflow # This workflow is triggered on creating tags to master or an opendistro release branch on: - # push: - # tags: - # - 'v*' push: - branches: - - "release-workflow-patch" + tags: + - 'v*' jobs: build: @@ -65,7 +62,7 @@ jobs: s3_prefix="s3://staging.artifacts.opendistroforelasticsearch.amazon.com/snapshots/elasticsearch-plugins/index-management/" echo "Copying ${zip} to ${s3_prefix}${zip_outfile}" - aws s3 cp $zip ${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} @@ -73,53 +70,52 @@ jobs: echo "Copying ${deb} to ${s3_prefix}${deb_outfile}" aws s3 cp --quiet $deb ${s3_prefix}${deb_outfile} + - name: Create Github Draft Release + id: create_release + uses: actions/create-release@v1.0.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ env.TAG_VERSION }} + draft: true + prerelease: false + + # Upload the release with .zip as asset + - name: Upload Release Asset + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_name: index-management-artifacts.zip + asset_path: index-management-artifacts_zip + asset_content_type: application/zip + + # Upload the release with .rpm as asset + - name: Upload Release Asset + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_name: index-management-artifacts.rpm + asset_path: index-management-artifacts_rpm + asset_content_type: application/zip + + # Upload the release with .deb as asset + - name: Upload Release Asset + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_name: index-management-artifacts.deb + asset_path: index-management-artifacts_deb + asset_content_type: application/zip - # - name: Create Github Draft Release - # id: create_release - # uses: actions/create-release@v1.0.0 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # tag_name: ${{ github.ref }} - # release_name: Release ${{ env.TAG_VERSION }} - # draft: true - # prerelease: false - - # # Upload the release with .zip as asset - # - name: Upload Release Asset - # uses: actions/upload-release-asset@v1.0.1 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # upload_url: ${{ steps.create_release.outputs.upload_url }} - # asset_name: index-management-artifacts.zip - # asset_path: index-management-artifacts_zip - # asset_content_type: application/zip - - # # Upload the release with .rpm as asset - # - name: Upload Release Asset - # uses: actions/upload-release-asset@v1.0.1 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # upload_url: ${{ steps.create_release.outputs.upload_url }} - # asset_name: index-management-artifacts.rpm - # asset_path: index-management-artifacts_rpm - # asset_content_type: application/zip - - # # Upload the release with .deb as asset - # - name: Upload Release Asset - # uses: actions/upload-release-asset@v1.0.1 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # upload_url: ${{ steps.create_release.outputs.upload_url }} - # asset_name: index-management-artifacts.deb - # asset_path: index-management-artifacts_deb - # asset_content_type: application/zip - - # - name: Upload Workflow Artifacts - # uses: actions/upload-artifact@v1 - # with: - # name: index-management-plugin - # path: index-management-artifacts + - name: Upload Workflow Artifacts + uses: actions/upload-artifact@v1 + with: + name: index-management-plugin + path: index-management-artifacts