Skip to content

Commit

Permalink
[CI] get package version yarn script (opensearch-project#193)
Browse files Browse the repository at this point in the history
Utilize to pull the version in package.json and utilized in
github workflows.

Issues resolved:
opensearch-project#142
opensearch-project#189

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
  • Loading branch information
kavilla authored Apr 22, 2022
1 parent 3056b74 commit 4b88d26
Show file tree
Hide file tree
Showing 27 changed files with 198 additions and 152 deletions.
1 change: 0 additions & 1 deletion .github/workflows/alerting-release-e2e-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ jobs:
with:
test-name: Alerting
test-command: yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/plugins/alerting-dashboards-plugin/*'
version: 1.3.0
3 changes: 1 addition & 2 deletions .github/workflows/anomaly-detection-release-e2e-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ jobs:
uses: ./.github/workflows/release-e2e-workflow-template.yml
with:
test-name: Anomaly Detection
test-command: yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/plugins/anomaly-detection-dashboards-plugin/*'
version: 1.3.0
test-command: yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/plugins/anomaly-detection-dashboards-plugin/*'
28 changes: 15 additions & 13 deletions .github/workflows/cypress-workflow-bundle-snapshot-based.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ on:
branches:
- main
- dev-*
env:
VERSION: '1.3.0'
jobs:
tests:
name: Run Cypress E2E tests
Expand All @@ -24,16 +22,25 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 14
- name: Checkout monetery-test
uses: actions/checkout@v2
with:
repository: ${{github.repository}}
path: monetery-test
- name: Get package version
working-directory: monetery-test
run: |
echo "VERSION=$(yarn --silent pkg-version)" >> $GITHUB_ENV
- name: Get and run OpenSearch
run: |
wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.VERSION }}/latest/linux/x64/dist/opensearch/opensearch-${{ env.VERSION }}-linux-x64.tar.gz
wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.VERSION }}/latest/linux/x64/tar/dist/opensearch/opensearch-${{ env.VERSION }}-linux-x64.tar.gz
tar -xzf opensearch-${{ env.VERSION }}-linux-x64.tar.gz
cd opensearch-${{ env.VERSION }}/
./opensearch-tar-install.sh &
timeout 900 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' -u admin:admin -k https://localhost:9200)" != "200" ]]; do sleep 5; done'
- name: Get OpenSearch-Dashboards
run: |
wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/${{ env.VERSION }}/latest/linux/x64/dist/opensearch-dashboards/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz
wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/${{ env.VERSION }}/latest/linux/x64/tar/dist/opensearch-dashboards/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz
tar -xzf opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz
- name: Get node and yarn versions
id: versions
Expand All @@ -49,15 +56,10 @@ jobs:
cd opensearch-dashboards-${{ env.VERSION }}
bin/opensearch-dashboards serve &
timeout 300 bash -c 'while [[ "$(curl -s localhost:5601/api/status | jq -r '.status.overall.state')" != "green" ]]; do sleep 5; done'
- name: Checkout monterey-test
uses: actions/checkout@v2
with:
repository: ${{github.repository}}
path: monterey-test
- name: Get Cypress version
id: cypress_version
run: |
echo "::set-output name=cypress_version::$(cat ./monterey-test/package.json | jq '.devDependencies.cypress' | tr -d '"')"
echo "::set-output name=cypress_version::$(cat ./monetery-test/package.json | jq '.devDependencies.cypress' | tr -d '"')"
- name: Cache Cypress
id: cache-cypress
uses: actions/cache@v1
Expand All @@ -71,18 +73,18 @@ jobs:
- name: Cypress tests
uses: cypress-io/github-action@v2
with:
working-directory: monterey-test
working-directory: monetery-test
command: yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/core-opensearch-dashboards/opensearch-dashboards/*.js'
wait-on: 'http://localhost:5601'
# Screenshots are only captured on failure, will change this once we do visual regression tests
- uses: actions/upload-artifact@v1
if: failure()
with:
name: cypress-screenshots
path: monterey-test/cypress/screenshots
path: monetery-test/cypress/screenshots
# Test run video was always captured, so this action uses "always()" condition
- uses: actions/upload-artifact@v1
if: always()
with:
name: cypress-videos
path: monterey-test/cypress/videos
path: monetery-test/cypress/videos
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ on:
branches:
- main
- dev-*
env:
VERSION: '1.3.0'
jobs:
tests:
name: Run Cypress E2E tests
Expand All @@ -24,16 +22,25 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 14
- name: Checkout monetery-test
uses: actions/checkout@v2
with:
repository: ${{github.repository}}
path: monetery-test
- name: Get package version
working-directory: monetery-test
run: |
echo "VERSION=$(yarn --silent pkg-version)" >> $GITHUB_ENV
- name: Get and run OpenSearch
run: |
wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.VERSION }}/latest/linux/x64/dist/opensearch/opensearch-${{ env.VERSION }}-linux-x64.tar.gz
wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.VERSION }}/latest/linux/x64/tar/dist/opensearch/opensearch-${{ env.VERSION }}-linux-x64.tar.gz
tar -xzf opensearch-${{ env.VERSION }}-linux-x64.tar.gz
cd opensearch-${{ env.VERSION }}/
./opensearch-tar-install.sh &
timeout 900 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' -u admin:admin -k https://localhost:9200)" != "200" ]]; do sleep 5; done'
- name: Get OpenSearch-Dashboards
run: |
wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/${{ env.VERSION }}/latest/linux/x64/dist/opensearch-dashboards/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz
wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/${{ env.VERSION }}/latest/linux/x64/tar/dist/opensearch-dashboards/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz
tar -xzf opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz
- name: Get node and yarn versions
id: versions
Expand All @@ -49,15 +56,10 @@ jobs:
cd opensearch-dashboards-${{ env.VERSION }}
bin/opensearch-dashboards serve &
timeout 300 bash -c 'while [[ "$(curl -s localhost:5601/api/status | jq -r '.status.overall.state')" != "green" ]]; do sleep 5; done'
- name: Checkout monterey-test
uses: actions/checkout@v2
with:
repository: ${{github.repository}}
path: monterey-test
- name: Get Cypress version
id: cypress_version
run: |
echo "::set-output name=cypress_version::$(cat ./monterey-test/package.json | jq '.devDependencies.cypress' | tr -d '"')"
echo "::set-output name=cypress_version::$(cat ./monetery-test/package.json | jq '.devDependencies.cypress' | tr -d '"')"
- name: Cache Cypress
id: cache-cypress
uses: actions/cache@v1
Expand All @@ -71,18 +73,18 @@ jobs:
- name: Cypress tests
uses: cypress-io/github-action@v2
with:
working-directory: monterey-test
working-directory: monetery-test
command: yarn cypress:run-plugin-tests-with-security --browser chromium
wait-on: 'http://localhost:5601'
# Screenshots are only captured on failure, will change this once we do visual regression tests
- uses: actions/upload-artifact@v1
if: failure()
with:
name: cypress-screenshots
path: monterey-test/cypress/screenshots
path: monetery-test/cypress/screenshots
# Test run video was always captured, so this action uses "always()" condition
- uses: actions/upload-artifact@v1
if: always()
with:
name: cypress-videos
path: monterey-test/cypress/videos
path: monetery-test/cypress/videos
17 changes: 11 additions & 6 deletions .github/workflows/cypress-workflow-vanilla-snapshot-based.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- main
- dev-*
env:
VERSION: '1.3.0'
VERSION: '2.0.0'
jobs:
tests:
name: Run Cypress E2E tests
Expand All @@ -24,6 +24,16 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 14
- name: Checkout monetery-test
uses: actions/checkout@v2
with:
repository: ${{github.repository}}
path: monetery-test
# TODO: Qualifier not supported yet for OSD snapshot
# - name: Get package version
# working-directory: monetery-test
# run: |
# echo "VERSION=$(yarn --silent pkg-version)" >> $GITHUB_ENV
- name: Get and run OpenSearch
run: |
wget https://artifacts.opensearch.org/snapshots/core/opensearch/${{ env.VERSION }}-SNAPSHOT/opensearch-min-${{ env.VERSION }}-SNAPSHOT-linux-x64-latest.tar.gz
Expand All @@ -49,11 +59,6 @@ jobs:
cd opensearch-dashboards-${{ env.VERSION }}-SNAPSHOT-linux-x64
bin/opensearch-dashboards serve &
timeout 300 bash -c 'while [[ "$(curl -s localhost:5601/api/status | jq -r '.status.overall.state')" != "green" ]]; do sleep 5; done'
- name: Checkout Monterey test cases
uses: actions/checkout@v2
with:
repository: ${{github.repository}}
path: monetery-test
- name: Get Cypress version
id: cypress_version
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ jobs:
with:
java-version: 14
# dependencies: OpenSearch
- name: Checkout monetery-test
uses: actions/checkout@v2
with:
repository: ${{github.repository}}
path: monetery-test
- name: Get package version
working-directory: monetery-test
run: |
echo "VERSION=$(yarn --silent pkg-version)" >> $GITHUB_ENV
- name: Checkout OpenSearch
uses: actions/checkout@v2
with:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/gantt-chart-release-e2e-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ jobs:
uses: ./.github/workflows/release-e2e-workflow-template.yml
with:
test-name: Gantt Chart
test-command: yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/plugins/gantt-chart-dashboards/*'
version: 1.3.0
test-command: yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/plugins/gantt-chart-dashboards/*'
3 changes: 1 addition & 2 deletions .github/workflows/index-management-release-e2e-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ jobs:
uses: ./.github/workflows/release-e2e-workflow-template.yml
with:
test-name: Index Management
test-command: yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/plugins/index-management-dashboards-plugin/*'
version: 1.3.0
test-command: yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/plugins/index-management-dashboards-plugin/*'
3 changes: 1 addition & 2 deletions .github/workflows/observability-release-e2e-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ jobs:
uses: ./.github/workflows/release-e2e-workflow-template.yml
with:
test-name: Observability
test-command: yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/plugins/observability-dashboards/*'
version: 1.3.0
test-command: yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/plugins/observability-dashboards/*'
3 changes: 1 addition & 2 deletions .github/workflows/query-workbench-release-e2e-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ jobs:
uses: ./.github/workflows/release-e2e-workflow-template.yml
with:
test-name: Query Workbench
test-command: yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/plugins/query-workbench-dashboards/*'
version: 1.3.0
test-command: yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/plugins/query-workbench-dashboards/*'
23 changes: 11 additions & 12 deletions .github/workflows/release-e2e-workflow-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ on:
test-command:
required: true
type: string
version:
required: true
type: string
env:
VERSION: ${{ inputs.version }}
jobs:
tests:
name: Run Cypress E2E tests for ${{ inputs.test-name }}
Expand All @@ -27,16 +22,25 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 14
- name: Checkout cypress-test
uses: actions/checkout@v2
with:
repository: ${{github.repository}}
path: cypress-test
- name: Get package version
working-directory: cypress-test
run: |
echo "VERSION=$(yarn --silent pkg-version)" >> $GITHUB_ENV
- name: Get and run OpenSearch
run: |
wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.VERSION }}/latest/linux/x64/dist/opensearch/opensearch-${{ env.VERSION }}-linux-x64.tar.gz
wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.VERSION }}/latest/linux/x64/tar/dist/opensearch/opensearch-${{ env.VERSION }}-linux-x64.tar.gz
tar -xzf opensearch-${{ env.VERSION }}-linux-x64.tar.gz
cd opensearch-${{ env.VERSION }}/
./opensearch-tar-install.sh &
timeout 900 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' -u admin:admin -k https://localhost:9200)" != "200" ]]; do sleep 5; done'
- name: Get OpenSearch-Dashboards
run: |
wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/${{ env.VERSION }}/latest/linux/x64/dist/opensearch-dashboards/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz
wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/${{ env.VERSION }}/latest/linux/x64/tar/dist/opensearch-dashboards/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz
tar -xzf opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz
- name: Get node and yarn versions
id: versions
Expand All @@ -52,11 +56,6 @@ jobs:
cd opensearch-dashboards-${{ env.VERSION }}
bin/opensearch-dashboards serve &
timeout 300 bash -c 'while [[ "$(curl -s localhost:5601/api/status | jq -r '.status.overall.state')" != "green" ]]; do sleep 5; done'
- name: Checkout cypress-test
uses: actions/checkout@v2
with:
repository: ${{github.repository}}
path: cypress-test
- name: Get Cypress version
id: cypress_version
run: |
Expand Down
20 changes: 11 additions & 9 deletions .github/workflows/release-signoff-chrome.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: Release signoff for bundled OpenSearch Dashboards with Dashboards plugins
on:
schedule:
- cron: '0 */3 * * *'
env:
VERSION: '1.3.0'
jobs:
tests:
name: Run Cypress E2E tests
Expand All @@ -14,16 +12,25 @@ jobs:
# avoid warnings like "tput: No value for $TERM and no -T specified"
TERM: xterm
steps:
- name: Checkout functional-test
uses: actions/checkout@v2
with:
repository: ${{github.repository}}
path: functional-test
- name: Get package version
working-directory: functional-test
run: |
echo "VERSION=$(yarn --silent pkg-version)" >> $GITHUB_ENV
- name: Get and run OpenSearch
run: |
wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.VERSION }}/latest/linux/x64/dist/opensearch/opensearch-${{ env.VERSION }}-linux-x64.tar.gz
wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.VERSION }}/latest/linux/x64/tar/dist/opensearch/opensearch-${{ env.VERSION }}-linux-x64.tar.gz
tar -xzf opensearch-${{ env.VERSION }}-linux-x64.tar.gz
cd opensearch-${{ env.VERSION }}/
./opensearch-tar-install.sh &
timeout 900 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' -u admin:admin -k https://localhost:9200)" != "200" ]]; do sleep 5; done'
- name: Get OpenSearch-Dashboards
run: |
wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/${{ env.VERSION }}/latest/linux/x64/dist/opensearch-dashboards/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz
wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/${{ env.VERSION }}/latest/linux/x64/tar/dist/opensearch-dashboards/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz
tar -xzf opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz
- name: Get node and yarn versions
id: versions
Expand All @@ -39,11 +46,6 @@ jobs:
cd opensearch-dashboards-${{ env.VERSION }}
bin/opensearch-dashboards serve &
timeout 300 bash -c 'while [[ "$(curl -s localhost:5601/api/status | jq -r '.status.overall.state')" != "green" ]]; do sleep 5; done'
- name: Checkout functional-test
uses: actions/checkout@v2
with:
repository: ${{github.repository}}
path: functional-test
- name: Get Cypress version
id: cypress_version
run: |
Expand Down
Loading

0 comments on commit 4b88d26

Please sign in to comment.