From d55c50243f7fa39c81a8662e3165a9f0b94cd07e Mon Sep 17 00:00:00 2001 From: Hailong Cui Date: Tue, 19 Nov 2024 10:18:15 +0800 Subject: [PATCH 1/2] [chore]upgrade actions/upload-artifact to v4 (#8855) * upgrade actioins/upload-artifact to v4 Signed-off-by: Hailong Cui * Changeset file for PR #8855 created/updated --------- Signed-off-by: Hailong Cui Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> (cherry picked from commit 608911e3fa8576cc8078e49807e46de9e30eda56) --- .github/workflows/build_and_test_workflow.yml | 8 +- .github/workflows/cypress_workflow.yml | 16 +- .../workflows/release_cypress_workflow.yml | 159 ++++++++++++++++++ changelogs/fragments/8855.yml | 2 + 4 files changed, 173 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/release_cypress_workflow.yml create mode 100644 changelogs/fragments/8855.yml diff --git a/.github/workflows/build_and_test_workflow.yml b/.github/workflows/build_and_test_workflow.yml index 751f8e83ef91..c6523254b20c 100644 --- a/.github/workflows/build_and_test_workflow.yml +++ b/.github/workflows/build_and_test_workflow.yml @@ -282,7 +282,7 @@ jobs: JOB: ci${{ matrix.group }} CACHE_DIR: ciGroup${{ matrix.group }} - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: failure() with: name: failure-artifacts-ci${{ matrix.group }} @@ -393,7 +393,7 @@ jobs: id: plugin-ftr-tests run: node scripts/functional_tests.js --config test/plugin_functional/config.ts - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: failure() with: name: failure-artifacts-plugin-functional-${{ matrix.os }} @@ -506,7 +506,7 @@ jobs: - name: Build `${{ matrix.name }}` run: yarn ${{ matrix.script }} --release - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: success() with: name: ${{ matrix.suffix }}-${{ env.VERSION }} @@ -583,7 +583,7 @@ jobs: run: | yarn test:bwc -s false -o ${{ env.OPENSEARCH_URL }} -d ${{ steps.download.outputs.download-path }}/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz -v ${{ matrix.version }} - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: ${{ failure() && steps.verify-opensearch-exists.outputs.version-exists == 'true' }} with: name: ${{ matrix.version }}-test-failures diff --git a/.github/workflows/cypress_workflow.yml b/.github/workflows/cypress_workflow.yml index b404f9c46240..9ca5ac0299bb 100644 --- a/.github/workflows/cypress_workflow.yml +++ b/.github/workflows/cypress_workflow.yml @@ -152,24 +152,24 @@ jobs: command: yarn cypress:run-without-security --browser ${{ env.CYPRESS_BROWSER }} --spec ${{ env.SPEC }} # Screenshots are only captured on failure, will change this once we do visual regression tests - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: failure() with: - name: ftr-cypress-screenshots + name: ftr-cypress-screenshots-${{ matrix.group }} path: ${{ env.FTR_PATH }}/cypress/screenshots retention-days: 1 - - - uses: actions/upload-artifact@v3 + + - uses: actions/upload-artifact@v4 if: always() with: - name: ftr-cypress-videos + name: ftr-cypress-videos-${{ matrix.group }} path: ${{ env.FTR_PATH }}/cypress/videos retention-days: 1 - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: always() with: - name: ftr-cypress-results + name: ftr-cypress-results-${{ matrix.group }} path: ${{ env.FTR_PATH }}/cypress/results retention-days: 1 @@ -207,6 +207,6 @@ jobs: '${{ env.SPEC }}' ``` - #### Link to results: + #### Link to results: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} edit-mode: replace diff --git a/.github/workflows/release_cypress_workflow.yml b/.github/workflows/release_cypress_workflow.yml new file mode 100644 index 000000000000..bb9895d9f048 --- /dev/null +++ b/.github/workflows/release_cypress_workflow.yml @@ -0,0 +1,159 @@ +name: Orchestrator cypress workflow +run-name: release_cypress_workflow ${{ inputs.UNIQUE_ID != '' && inputs.UNIQUE_ID || '' }} # Unique id number appended to the workflow run-name to reference the run within the orchestrator. +# Trigger on dispatch event sent from FT repo orchestrator +on: + workflow_dispatch: + inputs: + test_repo: + description: 'Cypress test repo' + default: '' + required: false + type: string + test_branch: + description: 'Cypress test branch (default: source branch)' + required: false + type: string + specs: + description: 'Test group to run' + required: false + type: string + build_id: + description: 'Build Id' + required: false + type: string + OS_URL: + description: 'OpenSearch release artifact' + required: false + type: string + OSD_URL: + description: 'OpenSearch Dashboards release artifact' + required: false + type: string + UNIQUE_ID: + description: 'Unique Id for the workflow execution' + required: true + type: string + SECURITY_ENABLED: + required: false + type: string + +env: + TEST_REPO: ${{ inputs.test_repo != '' && inputs.test_repo || github.repository }} + TEST_BRANCH: "${{ inputs.test_branch != '' && inputs.test_branch || github.base_ref }}" + OSD_PATH: 'osd' + CYPRESS_BROWSER: 'electron' + JOB_ID: ${{ inputs.UNIQUE_ID}} + OPENSEARCH: ${{ inputs.OS_URL != '' && inputs.OS_URL || 'https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/$VERSION/latest/linux/x64/tar/dist/opensearch/opensearch-$VERSION-linux-x64.tar.gz' }} + DASHBOARDS: ${{ inputs.OSD_URL != '' && inputs.OSD_URL || 'https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/$VERSION/latest/linux/x64/tar/dist/opensearch-dashboards/opensearch-dashboards-$VERSION-linux-x64.tar.gz' }} + OPENSEARCH_DIR: 'cypress/opensearch' + DASHBOARDS_DIR: 'cypress/opensearch-dashboards' + SECURITY_ENABLED: ${{ inputs.SECURITY_ENABLED != '' && inputs.SECURITY_ENABLED || 'false' }} + +jobs: + Get-CI-Image-Tag: + uses: opensearch-project/opensearch-build/.github/workflows/get-ci-image-tag.yml@main + with: + product: opensearch-dashboards + + cypress-tests: + needs: Get-CI-Image-Tag + runs-on: ubuntu-latest + strategy: + matrix: + spec_group: [10, 11] # Add more spec files as needed + 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 + env: + # prevents extra Cypress installation progress messages + CI: 1 + # avoid warnings like "tput: No value for $TERM and no -T specified" + TERM: xterm + name: Run cypress tests (osd:ciGroup${{ matrix.spec_group }}) ${{ inputs.UNIQUE_ID}} + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + path: ./${{ env.OSD_PATH }} + repository: ${{ env.TEST_REPO }} + ref: '${{ env.TEST_BRANCH }}' + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version-file: './${{ env.OSD_PATH }}/.nvmrc' + registry-url: 'https://registry.npmjs.org' + + - name: Setup Yarn + run: | + npm uninstall -g yarn + npm i -g yarn@1.22.10 + yarn config set network-timeout 1000000 -g + + - name: Setup spec files + if: ${{ inputs.specs == '' }} + shell: bash + run: | + cd ${{ env.OSD_PATH }} + IFS="," read -a SPEC_ARRAY <<< $(yarn --silent osd:ciGroup${{ matrix.spec_group }}) + FORMATTED_SPEC='' + for i in "${SPEC_ARRAY[@]}"; do + FORMATTED_SPEC+="cypress/integration/core_opensearch_dashboards/${i}," + done + SPEC=${FORMATTED_SPEC} # Set SPEC to FORMATTED_SPEC + echo "SPEC=${FORMATTED_SPEC}" >> $GITHUB_ENV + echo "SPEC found: $SPEC" + + - name: Get Cypress version + id: cypress_version + run: | + echo "name=cypress_version::$(cat ./${{ env.OSD_PATH }}/package.json | jq '.devDependencies.cypress' | tr -d '"')" >> $GITHUB_OUTPUT + + - name: Get package version (Linux) + run: | + cd ${{ env.OSD_PATH }} + echo "VERSION=$(yarn --silent pkg-version)" >> $GITHUB_ENV + + - name: Run bootstrap + run: | + cd ${{ env.OSD_PATH }} + chown -R 1000:1000 `pwd` + su `id -un 1000` -c "source $NVM_DIR/nvm.sh && nvm use && node -v && yarn -v && + yarn osd bootstrap" + + - name: Download and extract OpenSearch artifacts + run: | + CWD=$(pwd) + mkdir -p $CWD/${{ env.OPENSEARCH_DIR }} + source ${{ env.OSD_PATH }}/scripts/common/utils.sh + open_artifact $CWD/${{ env.OPENSEARCH_DIR }} ${{ env.OPENSEARCH }} + + - name: Download and extract OpenSearch Dashboards artifacts + run: | + CWD=$(pwd) + mkdir -p $CWD/${{ env.DASHBOARDS_DIR }} + source ${{ env.OSD_PATH }}/scripts/common/utils.sh + open_artifact $CWD/${{ env.DASHBOARDS_DIR }} ${{ env.DASHBOARDS }} + + - name: Run Cypress tests + run: | + chown -R 1000:1000 `pwd` + su `id -un 1000` -c "source ${{ env.OSD_PATH }}/scripts/cypress_tests.sh && run_dashboards_cypress_tests" + + # Screenshots are only captured on failures + - uses: actions/upload-artifact@v4 + if: failure() + with: + name: release-osd-cypress-screenshots-${{ matrix.spec_group }} + path: ${{ env.OSD_PATH }}/cypress/screenshots + retention-days: 1 + + - uses: actions/upload-artifact@v4 + if: always() + with: + name: release-osd-cypress-videos-${{ matrix.spec_group }} + path: ${{ env.OSD_PATH }}/cypress/videos + retention-days: 1 diff --git a/changelogs/fragments/8855.yml b/changelogs/fragments/8855.yml new file mode 100644 index 000000000000..ad9835ebe292 --- /dev/null +++ b/changelogs/fragments/8855.yml @@ -0,0 +1,2 @@ +fix: +- Upgrade actions/upload-artifact to v4 ([#8855](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8855)) \ No newline at end of file From 0d2380f5b87ac61cfd93d5aced3d25a59c42ae88 Mon Sep 17 00:00:00 2001 From: Hailong Cui Date: Tue, 19 Nov 2024 08:48:44 +0000 Subject: [PATCH 2/2] fix merge issue Signed-off-by: Hailong Cui --- .../workflows/release_cypress_workflow.yml | 159 ------------------ 1 file changed, 159 deletions(-) delete mode 100644 .github/workflows/release_cypress_workflow.yml diff --git a/.github/workflows/release_cypress_workflow.yml b/.github/workflows/release_cypress_workflow.yml deleted file mode 100644 index bb9895d9f048..000000000000 --- a/.github/workflows/release_cypress_workflow.yml +++ /dev/null @@ -1,159 +0,0 @@ -name: Orchestrator cypress workflow -run-name: release_cypress_workflow ${{ inputs.UNIQUE_ID != '' && inputs.UNIQUE_ID || '' }} # Unique id number appended to the workflow run-name to reference the run within the orchestrator. -# Trigger on dispatch event sent from FT repo orchestrator -on: - workflow_dispatch: - inputs: - test_repo: - description: 'Cypress test repo' - default: '' - required: false - type: string - test_branch: - description: 'Cypress test branch (default: source branch)' - required: false - type: string - specs: - description: 'Test group to run' - required: false - type: string - build_id: - description: 'Build Id' - required: false - type: string - OS_URL: - description: 'OpenSearch release artifact' - required: false - type: string - OSD_URL: - description: 'OpenSearch Dashboards release artifact' - required: false - type: string - UNIQUE_ID: - description: 'Unique Id for the workflow execution' - required: true - type: string - SECURITY_ENABLED: - required: false - type: string - -env: - TEST_REPO: ${{ inputs.test_repo != '' && inputs.test_repo || github.repository }} - TEST_BRANCH: "${{ inputs.test_branch != '' && inputs.test_branch || github.base_ref }}" - OSD_PATH: 'osd' - CYPRESS_BROWSER: 'electron' - JOB_ID: ${{ inputs.UNIQUE_ID}} - OPENSEARCH: ${{ inputs.OS_URL != '' && inputs.OS_URL || 'https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/$VERSION/latest/linux/x64/tar/dist/opensearch/opensearch-$VERSION-linux-x64.tar.gz' }} - DASHBOARDS: ${{ inputs.OSD_URL != '' && inputs.OSD_URL || 'https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/$VERSION/latest/linux/x64/tar/dist/opensearch-dashboards/opensearch-dashboards-$VERSION-linux-x64.tar.gz' }} - OPENSEARCH_DIR: 'cypress/opensearch' - DASHBOARDS_DIR: 'cypress/opensearch-dashboards' - SECURITY_ENABLED: ${{ inputs.SECURITY_ENABLED != '' && inputs.SECURITY_ENABLED || 'false' }} - -jobs: - Get-CI-Image-Tag: - uses: opensearch-project/opensearch-build/.github/workflows/get-ci-image-tag.yml@main - with: - product: opensearch-dashboards - - cypress-tests: - needs: Get-CI-Image-Tag - runs-on: ubuntu-latest - strategy: - matrix: - spec_group: [10, 11] # Add more spec files as needed - 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 - env: - # prevents extra Cypress installation progress messages - CI: 1 - # avoid warnings like "tput: No value for $TERM and no -T specified" - TERM: xterm - name: Run cypress tests (osd:ciGroup${{ matrix.spec_group }}) ${{ inputs.UNIQUE_ID}} - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - path: ./${{ env.OSD_PATH }} - repository: ${{ env.TEST_REPO }} - ref: '${{ env.TEST_BRANCH }}' - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version-file: './${{ env.OSD_PATH }}/.nvmrc' - registry-url: 'https://registry.npmjs.org' - - - name: Setup Yarn - run: | - npm uninstall -g yarn - npm i -g yarn@1.22.10 - yarn config set network-timeout 1000000 -g - - - name: Setup spec files - if: ${{ inputs.specs == '' }} - shell: bash - run: | - cd ${{ env.OSD_PATH }} - IFS="," read -a SPEC_ARRAY <<< $(yarn --silent osd:ciGroup${{ matrix.spec_group }}) - FORMATTED_SPEC='' - for i in "${SPEC_ARRAY[@]}"; do - FORMATTED_SPEC+="cypress/integration/core_opensearch_dashboards/${i}," - done - SPEC=${FORMATTED_SPEC} # Set SPEC to FORMATTED_SPEC - echo "SPEC=${FORMATTED_SPEC}" >> $GITHUB_ENV - echo "SPEC found: $SPEC" - - - name: Get Cypress version - id: cypress_version - run: | - echo "name=cypress_version::$(cat ./${{ env.OSD_PATH }}/package.json | jq '.devDependencies.cypress' | tr -d '"')" >> $GITHUB_OUTPUT - - - name: Get package version (Linux) - run: | - cd ${{ env.OSD_PATH }} - echo "VERSION=$(yarn --silent pkg-version)" >> $GITHUB_ENV - - - name: Run bootstrap - run: | - cd ${{ env.OSD_PATH }} - chown -R 1000:1000 `pwd` - su `id -un 1000` -c "source $NVM_DIR/nvm.sh && nvm use && node -v && yarn -v && - yarn osd bootstrap" - - - name: Download and extract OpenSearch artifacts - run: | - CWD=$(pwd) - mkdir -p $CWD/${{ env.OPENSEARCH_DIR }} - source ${{ env.OSD_PATH }}/scripts/common/utils.sh - open_artifact $CWD/${{ env.OPENSEARCH_DIR }} ${{ env.OPENSEARCH }} - - - name: Download and extract OpenSearch Dashboards artifacts - run: | - CWD=$(pwd) - mkdir -p $CWD/${{ env.DASHBOARDS_DIR }} - source ${{ env.OSD_PATH }}/scripts/common/utils.sh - open_artifact $CWD/${{ env.DASHBOARDS_DIR }} ${{ env.DASHBOARDS }} - - - name: Run Cypress tests - run: | - chown -R 1000:1000 `pwd` - su `id -un 1000` -c "source ${{ env.OSD_PATH }}/scripts/cypress_tests.sh && run_dashboards_cypress_tests" - - # Screenshots are only captured on failures - - uses: actions/upload-artifact@v4 - if: failure() - with: - name: release-osd-cypress-screenshots-${{ matrix.spec_group }} - path: ${{ env.OSD_PATH }}/cypress/screenshots - retention-days: 1 - - - uses: actions/upload-artifact@v4 - if: always() - with: - name: release-osd-cypress-videos-${{ matrix.spec_group }} - path: ${{ env.OSD_PATH }}/cypress/videos - retention-days: 1