From 53265a8021c2d978adb25a9c14b31327c9dffba3 Mon Sep 17 00:00:00 2001 From: Alexey Matvievsky Date: Tue, 20 Sep 2022 18:02:49 +0400 Subject: [PATCH] Integration tests fix #2 --- .github/workflows/consumer-tests-pr.yml | 21 +++++----- .github/workflows/consumer-tests.yml | 15 ++++---- .github/workflows/integration-tests-pr.yml | 45 ++++++++++++---------- .github/workflows/integration-tests.yml | 39 ++++++++++--------- 4 files changed, 62 insertions(+), 58 deletions(-) diff --git a/.github/workflows/consumer-tests-pr.yml b/.github/workflows/consumer-tests-pr.yml index 124d610544..6f9b8f6c5a 100644 --- a/.github/workflows/consumer-tests-pr.yml +++ b/.github/workflows/consumer-tests-pr.yml @@ -9,29 +9,29 @@ on: jobs: consumer_tests: name: Consumer tests - runs-on: ubuntu-latest if: | ( - github.event.comment.body == '/it' ) && ( + github.event.comment.body == '/it' || + github.event.comment.body == '/it-consumer' + ) && ( github.event.comment.author_association == 'COLLABORATOR' || github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'MEMBER' ) + runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 - with: - repository: ${{ github.repository }} - ref: ${{ github.ref }} + - uses: actions/checkout@v3 - uses: actions/setup-java@v1 with: java-version: 11 - name: Install Groovy run: | - sudo apt-get update && sudo apt-get install groovy -y + sudo apt-get update + sudo apt-get install groovy -y - name: Setup Git run: | - git config --global user.email "piper-testing-bot@example.com" && git config --global user.name "piper-testing-bot" + git config --global user.email "piper-testing-bot@example.com" + git config --global user.name "piper-testing-bot" - name: Run tests env: REPOSITORY_UNDER_TEST: ${{ github.repository }} @@ -44,4 +44,5 @@ jobs: NEO_DEPLOY_PASSWORD: ${{ secrets.NEO_DEPLOY_PASSWORD }} CX_INFRA_IT_TMS_UPLOAD: ${{ secrets.CX_INFRA_IT_TMS_UPLOAD }} run: | - cd consumer-test && groovy consumerTestController.groovy + cd ./consumer-test + groovy consumerTestController.groovy diff --git a/.github/workflows/consumer-tests.yml b/.github/workflows/consumer-tests.yml index 93c2a99308..8e681e109e 100644 --- a/.github/workflows/consumer-tests.yml +++ b/.github/workflows/consumer-tests.yml @@ -11,20 +11,18 @@ jobs: name: Consumer tests runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 - with: - repository: ${{ github.repository }} - ref: ${{ github.ref }} + - uses: actions/checkout@v3 - uses: actions/setup-java@v1 with: java-version: 11 - name: Install Groovy run: | - sudo apt-get update && sudo apt-get install groovy -y + sudo apt-get update + sudo apt-get install groovy -y - name: Setup Git run: | - git config --global user.email "piper-testing-bot@example.com" && git config --global user.name "piper-testing-bot" + git config --global user.email "piper-testing-bot@example.com" + git config --global user.name "piper-testing-bot" - name: Run tests env: REPOSITORY_UNDER_TEST: ${{ github.repository }} @@ -37,4 +35,5 @@ jobs: NEO_DEPLOY_PASSWORD: ${{ secrets.NEO_DEPLOY_PASSWORD }} CX_INFRA_IT_TMS_UPLOAD: ${{ secrets.CX_INFRA_IT_TMS_UPLOAD }} run: | - cd consumer-test && groovy consumerTestController.groovy + cd ./consumer-test + groovy consumerTestController.groovy diff --git a/.github/workflows/integration-tests-pr.yml b/.github/workflows/integration-tests-pr.yml index 7ca8933294..1955898ede 100644 --- a/.github/workflows/integration-tests-pr.yml +++ b/.github/workflows/integration-tests-pr.yml @@ -16,20 +16,29 @@ env: jobs: start: name: Start - runs-on: ubuntu-latest if: | ( - github.event.comment.body == '/it' ) && ( + github.event.comment.body == '/it' || + github.event.comment.body == '/it-go' + ) && ( github.event.comment.author_association == 'COLLABORATOR' || github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'MEMBER' ) + outputs: + sha: ${{ steps.sha.outputs.sha }} + runs-on: ubuntu-latest steps: + - uses: actions/checkout@v3 + - name: Get commit SHA + id: sha + run: | + echo "::set-output name=sha::$(git log --format=%H -n 1)" - name: Update status run: | curl \ --location \ - --request POST 'https://api.github.com/repos/SAP/jenkins-library/statuses/${{ github.sha }}' \ + --request POST 'https://api.github.com/repos/SAP/jenkins-library/statuses/${{ steps.sha.outputs.sha }}' \ -H 'Content-Type: application/json' \ --data '{"state": "pending", "context": "Go / integration-tests", @@ -42,11 +51,9 @@ jobs: - start runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 + - uses: actions/checkout@v3 with: - repository: ${{ github.repository }} - ref: ${{ github.ref }} + ref: ${{ needs.start.outputs.sha }} - uses: actions/setup-go@v3 with: go-version: ${{ env.GHA_GO_VERSION }} @@ -66,11 +73,9 @@ jobs: - start runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 + - uses: actions/checkout@v3 with: - repository: ${{ github.repository }} - ref: ${{ github.ref }} + ref: ${{ needs.start.outputs.sha }} - uses: actions/setup-go@v3 with: go-version: ${{ env.GHA_GO_VERSION }} @@ -94,7 +99,7 @@ jobs: os: - ubuntu-latest version: -# tough CNB tests are decomposed to reduce pipeline execution time + # tough CNB tests are decomposed to reduce pipeline execution time - '"(TestCNBIntegrationBindings|TestCNBIntegrationWrongBuilderProject|TestCNBIntegrationNonZipPath|TestCNBIntegrationZipPath|TestCNBIntegrationPreserveFilesIgnored)"' - '"TestCNBIntegrationPreserveFiles\b"' - '"TestCNBIntegrationNPMProject"' @@ -106,23 +111,21 @@ jobs: - '"TestGolangIntegration"' - '"TestGradleIntegration"' -# Jenkins tests are still not implemented(skipped) yet -# - '"TestJenkinsIntegration"' + # Jenkins tests are still not implemented(skipped) yet + #- '"TestJenkinsIntegration"' - '"TestMavenIntegration"' - '"TestMTAIntegration"' - '"TestNexusIntegration"' -# these are light-weighed tests, so we can use only one pod to reduce resource consumption + # these are light-weighted tests, so we can use only one pod to reduce resource consumption - '"Test(Gauge|GCS|GitHub|GitOps|Influx|NPM|Piper|Python|Sonar|Vault|Karma)Integration"' runs-on: ${{ matrix.os }} steps: - - name: Checkout - uses: actions/checkout@v3 + - uses: actions/checkout@v3 with: - repository: ${{ github.repository }} - ref: ${{ github.ref }} + ref: ${{ needs.start.outputs.sha }} - uses: actions/setup-go@v3 with: go-version: ${{ env.GHA_GO_VERSION }} @@ -158,7 +161,7 @@ jobs: then curl \ --location \ - --request POST 'https://api.github.com/repos/SAP/jenkins-library/statuses/${{ github.sha }}' \ + --request POST 'https://api.github.com/repos/SAP/jenkins-library/statuses/${{ needs.start.outputs.sha }}' \ -H 'Content-Type: application/json' \ --data '{"state": "success", "context": "Go / integration-tests", @@ -168,7 +171,7 @@ jobs: else curl \ --location \ - --request POST 'https://api.github.com/repos/SAP/jenkins-library/statuses/${{ github.sha }}' \ + --request POST 'https://api.github.com/repos/SAP/jenkins-library/statuses/${{ needs.start.outputs.sha }}' \ -H 'Content-Type: application/json' \ --data '{"state": "failure", "context": "Go / integration-tests", diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 9f5f233504..a5befe4a40 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -16,13 +16,20 @@ env: jobs: start: name: Start + outputs: + sha: ${{ steps.sha.outputs.sha }} runs-on: ubuntu-latest steps: + - uses: actions/checkout@v3 + - name: Get commit SHA + id: sha + run: | + echo "::set-output name=sha::$(git log --format=%H -n 1)" - name: Update status run: | curl \ --location \ - --request POST 'https://api.github.com/repos/SAP/jenkins-library/statuses/${{ github.sha }}' \ + --request POST 'https://api.github.com/repos/SAP/jenkins-library/statuses/${{ steps.sha.outputs.sha }}' \ -H 'Content-Type: application/json' \ --data '{"state": "pending", "context": "Go / integration-tests", @@ -35,11 +42,9 @@ jobs: - start runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 + - uses: actions/checkout@v3 with: - repository: ${{ github.repository }} - ref: ${{ github.ref }} + ref: ${{ needs.start.outputs.sha }} - uses: actions/setup-go@v3 with: go-version: ${{ env.GHA_GO_VERSION }} @@ -59,11 +64,9 @@ jobs: - start runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 + - uses: actions/checkout@v3 with: - repository: ${{ github.repository }} - ref: ${{ github.ref }} + ref: ${{ needs.start.outputs.sha }} - uses: actions/setup-go@v3 with: go-version: ${{ env.GHA_GO_VERSION }} @@ -87,7 +90,7 @@ jobs: os: - ubuntu-latest version: - # tough CNB tests are decomposed to reduce pipeline execution time + # tough CNB tests are decomposed to reduce pipeline execution time - '"(TestCNBIntegrationBindings|TestCNBIntegrationWrongBuilderProject|TestCNBIntegrationNonZipPath|TestCNBIntegrationZipPath|TestCNBIntegrationPreserveFilesIgnored)"' - '"TestCNBIntegrationPreserveFiles\b"' - '"TestCNBIntegrationNPMProject"' @@ -99,23 +102,21 @@ jobs: - '"TestGolangIntegration"' - '"TestGradleIntegration"' - # Jenkins tests are still not implemented(skipped) yet - # - '"TestJenkinsIntegration"' + # Jenkins tests are still not implemented(skipped) yet + #- '"TestJenkinsIntegration"' - '"TestMavenIntegration"' - '"TestMTAIntegration"' - '"TestNexusIntegration"' - # these are light-weighed tests, so we can use only one pod to reduce resource consumption + # these are light-weighted tests, so we can use only one pod to reduce resource consumption - '"Test(Gauge|GCS|GitHub|GitOps|Influx|NPM|Piper|Python|Sonar|Vault|Karma)Integration"' runs-on: ${{ matrix.os }} steps: - - name: Checkout - uses: actions/checkout@v3 + - uses: actions/checkout@v3 with: - repository: ${{ github.repository }} - ref: ${{ github.ref }} + ref: ${{ needs.start.outputs.sha }} - uses: actions/setup-go@v3 with: go-version: ${{ env.GHA_GO_VERSION }} @@ -151,7 +152,7 @@ jobs: then curl \ --location \ - --request POST 'https://api.github.com/repos/SAP/jenkins-library/statuses/${{ github.sha }}' \ + --request POST 'https://api.github.com/repos/SAP/jenkins-library/statuses/${{ needs.start.outputs.sha }}' \ -H 'Content-Type: application/json' \ --data '{"state": "success", "context": "Go / integration-tests", @@ -161,7 +162,7 @@ jobs: else curl \ --location \ - --request POST 'https://api.github.com/repos/SAP/jenkins-library/statuses/${{ github.sha }}' \ + --request POST 'https://api.github.com/repos/SAP/jenkins-library/statuses/${{ needs.start.outputs.sha }}' \ -H 'Content-Type: application/json' \ --data '{"state": "failure", "context": "Go / integration-tests",