From 47db5787268bfd4ce959ea926e9930e9ac04b031 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Thu, 2 Nov 2023 18:31:14 -0400 Subject: [PATCH] Onboard jenkins prod docker images to github actions (#243) * Onboard jenkins prod docker images to github actions Signed-off-by: Peter Zhu * Add more Signed-off-by: Peter Zhu * Add more Signed-off-by: Peter Zhu * Add more Signed-off-by: Peter Zhu * Add more Signed-off-by: Peter Zhu --------- Signed-off-by: Peter Zhu --- .../dashboards-reports-release-workflow.yml | 127 ------------------ ...boards-reports-test-and-build-workflow.yml | 59 ++++---- .github/workflows/dco.yml | 18 --- 3 files changed, 28 insertions(+), 176 deletions(-) delete mode 100644 .github/workflows/dashboards-reports-release-workflow.yml delete mode 100644 .github/workflows/dco.yml diff --git a/.github/workflows/dashboards-reports-release-workflow.yml b/.github/workflows/dashboards-reports-release-workflow.yml deleted file mode 100644 index 1822c1c0..00000000 --- a/.github/workflows/dashboards-reports-release-workflow.yml +++ /dev/null @@ -1,127 +0,0 @@ -name: Release OpenSearch Dashboards Reports Artifacts - -on: - push: - tags: - - "v*" - -env: - PLUGIN_NAME: reportsDashboards - ARTIFACT_NAME: reports-dashboards - OPENSEARCH_VERSION: '1.0' - OPENSEARCH_PLUGIN_VERSION: 1.0.0.0 - -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: Checkout OpenSearch Dashboards - uses: actions/checkout@v1 - with: - repository: opensearch-project/Opensearch-Dashboards - ref: ${{ env.OPENSEARCH_VERSION }} - path: dashboards-reports/OpenSearch-Dashboards - - - name: Move Dashboards Reports to Plugins Dir - run: mv dashboards-reports OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }} - - - name: Add Chromium Binary to Reporting for Testing - run: | - sudo apt install -y libnss3-dev fonts-liberation libfontconfig1 - cd OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }} - 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 - rm chromium-linux-x64.zip - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version-file: './OpenSearch-Dashboards/.nvmrc' - registry-url: 'https://registry.npmjs.org' - - - name: Install Yarn - # Need to use bash to avoid having a windows/linux specific step - shell: bash - run: | - YARN_VERSION=$(node -p "require('./OpenSearch-Dashboards/package.json').engines.yarn") - echo "Installing yarn@$YARN_VERSION" - npm i -g yarn@$YARN_VERSION - - - run: node -v - - run: yarn -v - - - name: OpenSearch Dashboards Plugin Bootstrap - uses: nick-invision/retry@v1 - with: - timeout_minutes: 30 - max_attempts: 3 - command: cd OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}; yarn osd bootstrap - - - name: Test - uses: nick-invision/retry@v1 - with: - timeout_minutes: 30 - max_attempts: 3 - command: cd OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}; yarn test - - - name: Build Artifact and upload to S3 - run: | - cd OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }} - yarn build - - cd build - mkdir -p ./{linux-x64,linux-arm64,windows-x64}/OpenSearch-Dashboards/${{ env.PLUGIN_NAME }} - cp ./${{ env.PLUGIN_NAME }}-*.zip ./linux-x64/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}-linux-x64.zip - cp ./${{ env.PLUGIN_NAME }}-*.zip ./linux-arm64/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}-linux-arm64.zip - mv ./${{ env.PLUGIN_NAME }}-*.zip ./windows-x64/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}-windows-x64.zip - - s3_prefix="s3://staging.artifacts.opendistroforelasticsearch.amazon.com/snapshots/kibana-plugins/reports/" - - cd linux-x64 - wget https://github.com/opensearch-project/dashboards-reports/releases/download/chromium-1.12.0.0/chromium-linux-x64.zip - unzip chromium-linux-x64.zip -d ./OpenSearch-Dashboards/${{ env.PLUGIN_NAME }} - rm chromium-linux-x64.zip - zip -ur ./${{ env.ARTIFACT_NAME }}-*.zip ./OpenSearch-Dashboards - linux_x64_artifact=`ls ./${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_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/opensearch-project/dashboards-reports/releases/download/chromium-1.12.0.0/chromium-linux-arm64.zip - unzip chromium-linux-arm64.zip -d ./OpenSearch-Dashboards/${{ env.PLUGIN_NAME }} - rm chromium-linux-arm64.zip - zip -ur ./${{ env.ARTIFACT_NAME }}-*.zip ./OpenSearch-Dashboards - linux_arm64_artifact=`ls ./${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_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/opensearch-project/dashboards-reports/releases/download/chromium-1.12.0.0/chromium-windows-x64.zip - unzip chromium-windows-x64.zip -d ./OpenSearch-Dashboards/${{ env.PLUGIN_NAME }} - rm chromium-windows-x64.zip - zip -ur ./${{ env.ARTIFACT_NAME }}-*.zip ./OpenSearch-Dashboards - windows_x64_artifact=`ls ./${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}-windows-x64.zip` - - #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} diff --git a/.github/workflows/dashboards-reports-test-and-build-workflow.yml b/.github/workflows/dashboards-reports-test-and-build-workflow.yml index 4036b586..5481d40a 100644 --- a/.github/workflows/dashboards-reports-test-and-build-workflow.yml +++ b/.github/workflows/dashboards-reports-test-and-build-workflow.yml @@ -10,51 +10,45 @@ env: jobs: + Get-CI-Image-Tag: + uses: opensearch-project/opensearch-build/.github/workflows/get-ci-image-tag.yml@main + with: + product: opensearch-dashboards + linux-build: + needs: Get-CI-Image-Tag 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: Checkout OpenSearch Dashboards - uses: actions/checkout@v1 + uses: actions/checkout@v2 with: repository: opensearch-project/Opensearch-Dashboards ref: ${{ env.OPENSEARCH_VERSION }} path: OpenSearch-Dashboards - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version-file: '../OpenSearch-Dashboards/.nvmrc' - registry-url: 'https://registry.npmjs.org' - - - name: Install Yarn - # Need to use bash to avoid having a windows/linux specific step - shell: bash - run: | - YARN_VERSION=$(node -p "require('../OpenSearch-Dashboards/package.json').engines.yarn") - echo "Installing yarn@$YARN_VERSION" - npm i -g yarn@$YARN_VERSION - - - run: node -v - - run: yarn -v - - name: Checkout Plugin - uses: actions/checkout@v1 + uses: actions/checkout@v2 with: path: OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }} - - name: OpenSearch Dashboards Plugin Bootstrap - uses: nick-fields/retry@v1 - with: - timeout_minutes: 30 - max_attempts: 3 - command: yarn osd bootstrap - - - name: Test + - name: OpenSearch Dashboards Plugin Bootstrap and test uses: nick-fields/retry@v1 with: timeout_minutes: 30 max_attempts: 3 - command: yarn test --coverage + command: | + chown -R 1000:1000 `pwd` + cd ./OpenSearch-Dashboards/ + su `id -un 1000` -c "source $NVM_DIR/nvm.sh && nvm use && node -v && yarn -v && + cd ./plugins/${{ env.PLUGIN_NAME }} && + whoami && yarn osd bootstrap && yarn test --coverage" - name: Upload coverage uses: codecov/codecov-action@v1 @@ -65,14 +59,17 @@ jobs: - name: Build Artifact run: | - yarn build - mv ./build/*.zip ./build/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}.zip + chown -R 1000:1000 `pwd` + cd ./OpenSearch-Dashboards/ + su `id -un 1000` -c "source $NVM_DIR/nvm.sh && nvm use && node -v && yarn -v && + cd ./plugins/${{ env.PLUGIN_NAME }} && + whoami && yarn build && mv -v ./build/*.zip ./build/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}.zip" - name: Upload Artifact For Linux uses: actions/upload-artifact@v1 with: name: dashboards-reports-linux - path: ./build/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}.zip + path: ./OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}/build/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}.zip windows-build: runs-on: windows-latest 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 }}