From dbaf95fad5b63f70c3e2da0ed124da3f421ddc0e Mon Sep 17 00:00:00 2001 From: Rupal Mahajan Date: Thu, 5 Jan 2023 17:56:22 +0000 Subject: [PATCH] Update main to be same as Reporting Repo (#3) * Upgrade dompurify to match upstream (#598) In this PR: https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2918 Dom purify was defined to a bug. Due to the version conflict, Dashboards Reports is unable to build. So bumping up version. Signed-off-by: Kawika Avilla Signed-off-by: Kawika Avilla * Update workflow Signed-off-by: Rupal Mahajan * Fix macos workflow Signed-off-by: Rupal Mahajan * Change nick-invision to nick-fields to fix worklfow actions Signed-off-by: Rupal Mahajan Signed-off-by: Kawika Avilla Signed-off-by: Rupal Mahajan Co-authored-by: Kawika Avilla --- ...boards-reports-test-and-build-workflow.yml | 85 ++++------- .../reports-scheduler-release-workflow.yml | 55 -------- ...orts-scheduler-test-and-build-workflow.yml | 133 ------------------ package.json | 2 +- yarn.lock | 8 +- 5 files changed, 36 insertions(+), 247 deletions(-) delete mode 100644 .github/workflows/reports-scheduler-release-workflow.yml delete mode 100644 .github/workflows/reports-scheduler-test-and-build-workflow.yml diff --git a/.github/workflows/dashboards-reports-test-and-build-workflow.yml b/.github/workflows/dashboards-reports-test-and-build-workflow.yml index e12b2e71..e1b1306a 100644 --- a/.github/workflows/dashboards-reports-test-and-build-workflow.yml +++ b/.github/workflows/dashboards-reports-test-and-build-workflow.yml @@ -13,9 +13,6 @@ jobs: linux-build: runs-on: ubuntu-latest steps: - - name: Checkout Plugin - uses: actions/checkout@v1 - - name: Checkout OpenSearch Dashboards uses: actions/checkout@v1 with: @@ -25,8 +22,7 @@ jobs: - name: Get node version id: versions_step - run: - echo "::set-output name=node_version::$(node -p "(require('../OpenSearch-Dashboards/package.json').engines.node).match(/[.0-9]+/)[0]")" + run: echo "::set-output name=node_version::$(node -p "(require('../OpenSearch-Dashboards/package.json').engines.node).match(/[.0-9]+/)[0]")" - name: Setup Node uses: actions/setup-node@v1 @@ -34,81 +30,73 @@ jobs: node-version: ${{ steps.versions_step.outputs.node_version }} registry-url: 'https://registry.npmjs.org' - - - name: Move Dashboards Reports to Plugins Dir - run: mv dashboards-reports ../OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }} + - name: Checkout Plugin + uses: actions/checkout@v1 + with: + path: OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }} - name: Add Chromium Binary to Reporting for Testing run: | sudo apt update 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: OpenSearch Dashboards Plugin Bootstrap - uses: nick-invision/retry@v1 + uses: nick-fields/retry@v1 with: timeout_minutes: 30 max_attempts: 3 - command: cd ../OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}; yarn osd bootstrap + command: yarn osd bootstrap - name: Test - uses: nick-invision/retry@v1 + uses: nick-fields/retry@v1 with: timeout_minutes: 30 max_attempts: 3 - command: cd ../OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}; yarn test --coverage + command: yarn test --coverage - name: Upload coverage uses: codecov/codecov-action@v1 with: - flags: dashboards-reports - directory: ../OpenSearch-Dashboards/plugins/ + flags: dashboards-report + directory: ./OpenSearch-Dashboards/plugins/ token: ${{ secrets.CODECOV_TOKEN }} - name: Build Artifact run: | - cd ../OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }} yarn build - cd build mkdir -p ./{linux-x64,linux-arm64}/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 - 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 }} zip -ur ./${{ env.ARTIFACT_NAME }}-*.zip ./opensearch-dashboards mv ./${{ env.ARTIFACT_NAME }}-*.zip .. 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 }} zip -ur ./${{ env.ARTIFACT_NAME }}-*.zip ./opensearch-dashboards mv ./${{ env.ARTIFACT_NAME }}-*.zip .. cd .. - - name: Upload Artifact For Linux x64 uses: actions/upload-artifact@v1 with: name: dashboards-reports-linux-x64 - path: ../OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}/build/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}-linux-x64.zip + path: ./build/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}-linux-x64.zip - name: Upload Artifact For Linux arm64 uses: actions/upload-artifact@v1 with: name: dashboards-reports-linux-arm64 - path: ../OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}/build/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}-linux-arm64.zip + path: ./build/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}-linux-arm64.zip windows-build: runs-on: windows-latest steps: - - name: Checkout Plugin - uses: actions/checkout@v1 # Enable longer filenames for windows - name: Enable longer filenames @@ -133,41 +121,38 @@ jobs: registry-url: 'https://registry.npmjs.org' - - name: Move Dashboards Reports to Plugins Dir - run: mv dashboards-reports ../OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }} + - name: Checkout Plugin + uses: actions/checkout@v1 + with: + path: OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }} - name: Add Chromium Binary to Reporting for Testing run: | - cd ../OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }} curl.exe -LO https://github.com/opensearch-project/dashboards-reports/releases/download/chromium-1.12.0.0/chromium-windows-x64.zip Expand-Archive -Path 'chromium-windows-x64.zip' Move-Item -Path "./chromium-windows-x64/.chromium" -Destination "./.chromium" rd chromium-windows-x64.zip rd chromium-windows-x64 - - name: OpenSearch Dashboards Plugin Bootstrap - uses: nick-invision/retry@v1 + uses: nick-fields/retry@v1 with: timeout_minutes: 30 max_attempts: 3 - command: cd ../OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }} && yarn osd bootstrap + command: yarn osd bootstrap - name: Test - uses: nick-invision/retry@v1 + uses: nick-fields/retry@v1 with: timeout_minutes: 30 max_attempts: 3 - command: cd ../OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }} && yarn test + command: yarn test - name: Build Artifact run: | - cd ../OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }} yarn build - cd build mkdir -p ./windows-x64/opensearch-dashboards/${{ env.PLUGIN_NAME }} mv ./${{ env.PLUGIN_NAME }}-*.zip ./windows-x64/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}-windows-x64.zip - cd windows-x64 curl.exe -LO https://github.com/opensearch-project/dashboards-reports/releases/download/chromium-1.12.0.0/chromium-windows-x64.zip Expand-Archive -Path 'chromium-windows-x64.zip' @@ -177,19 +162,15 @@ jobs: Compress-Archive -Path "./${{ env.ARTIFACT_NAME }}-*.zip" -Destination "./opensearch-dashboards" mv ./${{ env.ARTIFACT_NAME }}-*.zip .. cd .. - - name: Upload Artifact For Windows uses: actions/upload-artifact@v1 with: name: dashboards-reports-windows-x64 - path: ../OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}/build/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}-windows-x64.zip + path: ./build/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}-windows-x64.zip macos-build: runs-on: macos-latest steps: - - name: Checkout Plugin - uses: actions/checkout@v1 - - name: Checkout OpenSearch Dashboards uses: actions/checkout@v1 with: @@ -209,48 +190,44 @@ jobs: registry-url: 'https://registry.npmjs.org' - - name: Move Dashboards Reports to Plugins Dir - run: mv dashboards-reports ../OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }} + - name: Checkout Plugin + uses: actions/checkout@v1 + with: + path: OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }} - name: Add Chromium Binary to Reporting for Testing run: | - cd ../OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }} wget https://github.com/opendistro-for-elasticsearch/kibana-reports/releases/download/chromium-1.12.0.0/chromium-macos-x64.zip unzip chromium-macos-x64.zip rm chromium-macos-x64.zip - - name: OpenSearch Dashboards Plugin Bootstrap - uses: nick-invision/retry@v1 + uses: nick-fields/retry@v1 with: timeout_minutes: 30 max_attempts: 3 - command: cd ../OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}; yarn osd bootstrap + command: yarn osd bootstrap - name: Test - uses: nick-invision/retry@v1 + uses: nick-fields/retry@v1 with: timeout_minutes: 30 max_attempts: 3 - command: cd ../OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}; yarn test + command: yarn test - name: Build Artifact run: | - cd ../OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }} yarn build - cd build mkdir -p ./macos-x64/opensearch-dashboards/${{ env.PLUGIN_NAME }} mv ./${{ env.PLUGIN_NAME }}-*.zip ./macos-x64/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}-macos-x64.zip - cd macos-x64 wget https://github.com/opensearch-project/dashboards-reports/releases/download/chromium-1.12.0.0/chromium-macos-x64.zip unzip chromium-macos-x64.zip -d ./opensearch-dashboards/${{ env.PLUGIN_NAME }} zip -ur ./${{ env.ARTIFACT_NAME }}-*.zip ./opensearch-dashboards mv ./${{ env.ARTIFACT_NAME }}-*.zip .. cd .. - - name: Upload Artifact For MacOS x64 uses: actions/upload-artifact@v1 with: name: dashboards-reports-macosx-x64 - path: ../OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}/build/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}-macos-x64.zip + path: ./build/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}-macos-x64.zip 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 deleted file mode 100644 index 01576aa1..00000000 --- a/.github/workflows/reports-scheduler-test-and-build-workflow.yml +++ /dev/null @@ -1,133 +0,0 @@ -name: Test and Build Reports Scheduler - -on: [push, pull_request] - -jobs: - linux-build: - strategy: - matrix: - java: - - 11 - - 17 - runs-on: ubuntu-latest - - steps: - - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@v1 - with: - java-version: ${{ matrix.java }} - - # reports-scheduler - - name: Checkout Reports Scheduler - uses: actions/checkout@v2 - - - name: RunBackwards Compatibility Tests - run: | - cd reports-scheduler - echo "Running backwards compatibility tests ..." - ./gradlew bwcTestSuite - - - name: Build with Gradle - run: | - cd reports-scheduler - ./gradlew build - - - name: Upload coverage - uses: codecov/codecov-action@v1 - with: - flags: reports-scheduler - directory: reports-scheduler/ - token: ${{ secrets.CODECOV_TOKEN }} - - - name: Create Artifact Path - run: | - mkdir -p reports-scheduler-builds - cp -r ./reports-scheduler/build/distributions/*.zip reports-scheduler-builds/ - - - name: Upload Artifacts - uses: actions/upload-artifact@v1 - with: - name: reports-scheduler-linux - path: reports-scheduler-builds - - windows-build: - strategy: - matrix: - java: - - 11 - - 17 - runs-on: windows-latest - - steps: - - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@v1 - with: - java-version: ${{ matrix.java }} - - # reports-scheduler - - name: Checkout Reports Scheduler - uses: actions/checkout@v2 - - # Disable bwc tests since first release - # - name: RunBackwards Compatibility Tests - # run: | - # cd reports-scheduler - # echo "Running backwards compatibility tests ..." - # ./gradlew.bat bwcTestSuite - - - name: Build with Gradle - run: | - cd reports-scheduler - ./gradlew.bat build -x integTest -x jacocoTestReport - - - name: Create Artifact Path - run: | - mkdir -p reports-scheduler-builds - cp -r ./reports-scheduler/build/distributions/*.zip reports-scheduler-builds/ - - - name: Upload Artifacts - uses: actions/upload-artifact@v1 - with: - name: reports-scheduler-windows - path: reports-scheduler-builds - - macos-build: - strategy: - matrix: - java: - - 11 - - 17 - runs-on: macos-latest - - steps: - - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@v1 - with: - java-version: ${{ matrix.java }} - - # reports-scheduler - - name: Checkout Reports Scheduler - uses: actions/checkout@v2 - - # Disable bwc tests since first release - # - name: RunBackwards Compatibility Tests - # run: | - # cd reports-scheduler - # echo "Running backwards compatibility tests ..." - # ./gradlew bwcTestSuite - - - name: Build with Gradle - run: | - cd reports-scheduler - ./gradlew build -x integTest -x jacocoTestReport - - - name: Create Artifact Path - run: | - mkdir -p reports-scheduler-builds - cp -r ./reports-scheduler/build/distributions/*.zip reports-scheduler-builds/ - - - name: Upload Artifacts - uses: actions/upload-artifact@v1 - with: - name: reports-scheduler-macos - path: reports-scheduler-builds diff --git a/package.json b/package.json index 4d988a81..cebe1f37 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "async-mutex": "^0.2.6", "babel-polyfill": "^6.26.0", "cron-validator": "^1.1.1", - "dompurify": "^2.3.8", + "dompurify": "^2.4.1", "elastic-builder": "^2.7.1", "enzyme-adapter-react-16": "^1.15.5", "jest-fetch-mock": "^3.0.3", diff --git a/yarn.lock b/yarn.lock index 97bd137f..101b9bac 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1868,10 +1868,10 @@ domhandler@^3.0, domhandler@^3.0.0: dependencies: domelementtype "^2.0.1" -dompurify@^2.3.8: - version "2.3.8" - resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-2.3.8.tgz#224fe9ae57d7ebd9a1ae1ac18c1c1ca3f532226f" - integrity sha512-eVhaWoVibIzqdGYjwsBWodIQIaXFSB+cKDf4cfxLMsK0xiud6SE+/WCVx/Xw/UwQsa4cS3T2eITcdtmTg2UKcw== +dompurify@^2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-2.4.1.tgz#f9cb1a275fde9af6f2d0a2644ef648dd6847b631" + integrity sha512-ewwFzHzrrneRjxzmK6oVz/rZn9VWspGFRDb4/rRtIsM1n36t9AKma/ye8syCpcw+XJ25kOK/hOG7t1j2I2yBqA== domutils@^2.0.0: version "2.2.0"