From d2e78c5845de0fe05f083ef09b5e02c10efd2569 Mon Sep 17 00:00:00 2001 From: AWSHurneyt Date: Wed, 14 Jun 2023 09:30:18 -0700 Subject: [PATCH] Updated the cypress workflow to support overriding the dependency versions. (#629) * Updated the cypress workflow to support overriding the dependency versions. Signed-off-by: AWSHurneyt * Overrode test workflow dependency versions to v2.8. Signed-off-by: AWSHurneyt * Fixed override workflow. Signed-off-by: AWSHurneyt * Adjusted workflow job order. Signed-off-by: AWSHurneyt * Made gradle setup conditional. Signed-off-by: AWSHurneyt * Made gradle setup unconditional again. Refactored version override process. Signed-off-by: AWSHurneyt * Adjusted the override reference. Signed-off-by: AWSHurneyt * Fixed typo in override job. Signed-off-by: AWSHurneyt * Fixed override job. Signed-off-by: AWSHurneyt * Fixed override job. Signed-off-by: AWSHurneyt --------- Signed-off-by: AWSHurneyt --- .github/workflows/cypress-workflow.yml | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cypress-workflow.yml b/.github/workflows/cypress-workflow.yml index fe0d24e87..841e81cbc 100644 --- a/.github/workflows/cypress-workflow.yml +++ b/.github/workflows/cypress-workflow.yml @@ -7,10 +7,14 @@ on: branches: - "*" env: - OPENSEARCH_DASHBOARDS_VERSION: 'main' - OPENSEARCH_VERSION: '3.0.0-SNAPSHOT' - SECURITY_ANALYTICS_BRANCH: 'main' + OPENSEARCH_DASHBOARDS_VERSION: '2.8.0' + OPENSEARCH_VERSION: '2.8.0-SNAPSHOT' + SECURITY_ANALYTICS_BRANCH: '2.x' GRADLE_VERSION: '7.6.1' + + # If this variable is not empty, the package.json, opensearch_dashboards.json, and yarn.lock files will be replaced + # with those files from the 'opensearch-project/security-analytics-dashboards-plugin' branch or commit specified. + OVERRIDE_REFERENCE: '2.8' jobs: tests: name: Run Cypress E2E tests @@ -70,6 +74,19 @@ jobs: with: path: OpenSearch-Dashboards/plugins/security-analytics-dashboards-plugin + # This job replaces the package.json, opensearch_dashboards.json, and yarn.lock files from the + # 'opensearch-project/security-analytics-dashboards-plugin' branch or commit specified in env variable. + # This is most useful on the 'main' branch as it will enable us to specify which version to use for the build when + # one of this package's dependencies is not building reliably without having to adjust the actual version of this package. + - name: Override Package Version + if: ${{ env.OVERRIDE_REFERENCE != '' }} + run: | + cd OpenSearch-Dashboards/plugins/security-analytics-dashboards-plugin + git fetch --all + git checkout origin/${{ env.OVERRIDE_REFERENCE }} opensearch_dashboards.json + git checkout origin/${{ env.OVERRIDE_REFERENCE }} package.json + git checkout origin/${{ env.OVERRIDE_REFERENCE }} yarn.lock + - name: Setup Node uses: actions/setup-node@v3 with: