From 9daeb06185b05a80ca4f3fbd352af6e42554928e Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Tue, 31 Oct 2023 14:22:49 -0400 Subject: [PATCH] Onboard jenkins prod docker images to github actions (#924) Signed-off-by: Peter Zhu --- .github/workflows/dco.yml | 18 ------ .../reports-scheduler-release-workflow.yml | 55 ------------------- ...orts-scheduler-test-and-build-workflow.yml | 19 ++++++- 3 files changed, 17 insertions(+), 75 deletions(-) delete mode 100644 .github/workflows/dco.yml delete mode 100644 .github/workflows/reports-scheduler-release-workflow.yml diff --git a/.github/workflows/dco.yml b/.github/workflows/dco.yml deleted file mode 100644 index cf30ea89..00000000 --- a/.github/workflows/dco.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Developer Certificate of Origin Check - -on: [pull_request] - -jobs: - check: - runs-on: ubuntu-latest - - steps: - - name: Get PR Commits - id: 'get-pr-commits' - uses: tim-actions/get-pr-commits@v1.1.0 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - name: DCO Check - uses: tim-actions/dco@v1.1.0 - with: - commits: ${{ steps.get-pr-commits.outputs.commits }} diff --git a/.github/workflows/reports-scheduler-release-workflow.yml b/.github/workflows/reports-scheduler-release-workflow.yml deleted file mode 100644 index e418c58f..00000000 --- a/.github/workflows/reports-scheduler-release-workflow.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Release Reports Scheduler Artifacts -# This workflow is triggered on creating tags to main or an opensearch release branch -on: - push: - tags: - - "v*" - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - 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 - uses: actions/checkout@v1 - - - name: Set up JDK 1.17 - uses: actions/setup-java@v1 - with: - java-version: 1.17 - - - name: Run build - run: | - cd reports-scheduler - ./gradlew build buildDeb buildRpm --no-daemon --refresh-dependencies -Dbuild.snapshot=false - - - 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} diff --git a/.github/workflows/reports-scheduler-test-and-build-workflow.yml b/.github/workflows/reports-scheduler-test-and-build-workflow.yml index acf27f15..327018bb 100644 --- a/.github/workflows/reports-scheduler-test-and-build-workflow.yml +++ b/.github/workflows/reports-scheduler-test-and-build-workflow.yml @@ -3,13 +3,25 @@ name: Test and Build Reports Scheduler on: [push, pull_request] jobs: + Get-CI-Image-Tag: + uses: opensearch-project/opensearch-build/.github/workflows/get-ci-image-tag.yml@main + with: + product: opensearch + linux-build: + needs: Get-CI-Image-Tag strategy: matrix: java: - 11 - 17 runs-on: ubuntu-latest + container: + # using the same image which is used by opensearch-build team to build the OpenSearch Distribution + # this image tag is subject to change as more dependencies and updates will arrive over time + image: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }} + # need to switch to root so that github actions can install runner binary on container without permission issues. + options: --user root steps: - name: Set up JDK ${{ matrix.java }} @@ -23,11 +35,13 @@ jobs: - name: RunBackwards Compatibility Tests run: | echo "Running backwards compatibility tests ..." - ./gradlew bwcTestSuite + chown -R 1000:1000 `pwd` + su `id -un 1000` -c "./gradlew bwcTestSuite" - name: Build with Gradle run: | - ./gradlew build + chown -R 1000:1000 `pwd` + su `id -un 1000` -c "./gradlew build" - name: Upload coverage uses: codecov/codecov-action@v1 @@ -40,6 +54,7 @@ jobs: run: | mkdir -p reports-scheduler-builds cp -r ./build/distributions/*.zip reports-scheduler-builds/ + chown -R 1000:1000 `pwd` - name: Upload Artifacts uses: actions/upload-artifact@v1