From 49cc209f5383273e269407d7345349d6d8942682 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Tue, 31 Oct 2023 13:50:44 -0400 Subject: [PATCH 1/3] Onboard jenkins prod docker images to github actions Signed-off-by: Peter Zhu --- .github/workflows/dco.yml | 18 ----- .github/workflows/release-workflow.yml | 71 ------------------- .github/workflows/test-and-build-workflow.yml | 48 +++++-------- 3 files changed, 17 insertions(+), 120 deletions(-) delete mode 100644 .github/workflows/dco.yml delete mode 100644 .github/workflows/release-workflow.yml diff --git a/.github/workflows/dco.yml b/.github/workflows/dco.yml deleted file mode 100644 index cf30ea8..0000000 --- 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 }} diff --git a/.github/workflows/release-workflow.yml b/.github/workflows/release-workflow.yml deleted file mode 100644 index 0ee3851..0000000 --- a/.github/workflows/release-workflow.yml +++ /dev/null @@ -1,71 +0,0 @@ - -name: Release Gantt Chart Artifacts - -on: - push: - tags: - - 'v*' - -env: - PLUGIN_NAME: gantt-chart-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-visualizations/OpenSearch-Dashboards - - - name: Setup Node - uses: actions/setup-node@v1 - with: - node-version: '10.23.1' - - - name: Move Gantt Chart to Plugins Dir - run: | - mv gantt-chart OpenSearch-Dashboards/plugins - - - name: Plugin Bootstrap - run: | - cd OpenSearch-Dashboards/plugins/gantt-chart - yarn osd bootstrap - - - name: Build Artifact - run: | - cd OpenSearch-Dashboards/plugins/gantt-chart - yarn build - mv ./build/*.zip ./build/${{ env.PLUGIN_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}.zip - - - name: Upload to S3 - run: | - cd OpenSearch-Dashboards/plugins/gantt-chart - artifact=`ls ./build/*.zip` - - # inject build number before the suffix - zip_outfile=`basename ${artifact%.zip}-build-${GITHUB_RUN_NUMBER}.zip` - - # TODO update s3 bucket - s3_prefix="s3://staging.artifacts.opendistroforelasticsearch.amazon.com/snapshots/kibana-plugins/gantt-chart/" - - echo "Copying ${artifact} to ${s3_prefix}${zip_outfile}" - aws s3 cp --quiet $artifact ${s3_prefix}${zip_outfile} diff --git a/.github/workflows/test-and-build-workflow.yml b/.github/workflows/test-and-build-workflow.yml index 87b6f92..880c241 100644 --- a/.github/workflows/test-and-build-workflow.yml +++ b/.github/workflows/test-and-build-workflow.yml @@ -9,10 +9,20 @@ env: OPENSEARCH_PLUGIN_VERSION: 3.0.0.0 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 Plugin @@ -25,41 +35,17 @@ jobs: ref: ${{ env.OPENSEARCH_VERSION }} path: dashboards-visualizations/OpenSearch-Dashboards - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version-file: './dashboards-visualizations/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('./dashboards-visualizations/OpenSearch-Dashboards/package.json').engines.yarn") - echo "Installing yarn@$YARN_VERSION" - npm i -g yarn@$YARN_VERSION - - - run: node -v - - run: yarn -v - - name: Move Gantt Chart to Plugins Dir run: | mv gantt-chart ./dashboards-visualizations/OpenSearch-Dashboards/plugins - - name: Plugin Bootstrap + - name: Plugin Bootstrap / stylelint / test run: | - cd ./dashboards-visualizations/OpenSearch-Dashboards/plugins/gantt-chart - yarn osd bootstrap - - - name: Run Stylelint - run: | - cd ./dashboards-visualizations/OpenSearch-Dashboards/plugins/gantt-chart - yarn lint:style - - - name: Test - run: | - cd ./dashboards-visualizations/OpenSearch-Dashboards/plugins/gantt-chart - yarn test --coverage + 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/gantt-chart && + whoami && yarn osd bootstrap && yarn lint:style && yarn test --coverage" - name: Upload coverage uses: codecov/codecov-action@v1 From 50f2ce4e7433d067317e66881dd2232389823ec7 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Tue, 31 Oct 2023 13:56:58 -0400 Subject: [PATCH 2/3] Add more Signed-off-by: Peter Zhu --- .github/workflows/test-and-build-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-and-build-workflow.yml b/.github/workflows/test-and-build-workflow.yml index 880c241..3c8e6ca 100644 --- a/.github/workflows/test-and-build-workflow.yml +++ b/.github/workflows/test-and-build-workflow.yml @@ -42,7 +42,7 @@ jobs: - name: Plugin Bootstrap / stylelint / test run: | chown -R 1000:1000 `pwd` - cd ./OpenSearch-Dashboards/ + cd dashboards-visualizations/OpenSearch-Dashboards/ su `id -un 1000` -c "source $NVM_DIR/nvm.sh && nvm use && node -v && yarn -v && cd ./plugins/gantt-chart && whoami && yarn osd bootstrap && yarn lint:style && yarn test --coverage" From 630827c3317dc2a3d729e3d84f3c5ef0a68db04f Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Tue, 31 Oct 2023 14:13:29 -0400 Subject: [PATCH 3/3] Add more Signed-off-by: Peter Zhu --- .github/workflows/test-and-build-workflow.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-and-build-workflow.yml b/.github/workflows/test-and-build-workflow.yml index 3c8e6ca..ae3fe08 100644 --- a/.github/workflows/test-and-build-workflow.yml +++ b/.github/workflows/test-and-build-workflow.yml @@ -55,8 +55,9 @@ jobs: - name: Build Artifact run: | + chown -R 1000:1000 `pwd` cd ./dashboards-visualizations/OpenSearch-Dashboards/plugins/gantt-chart - yarn build + su `id -un 1000` -c "source $NVM_DIR/nvm.sh && nvm use && node -v && yarn -v && yarn build" mv ./build/*.zip ./build/${{ env.PLUGIN_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}.zip - name: Upload Artifact