From 89eec4cc63d0afd178f1cc0e8baf8208e319984c Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Tue, 10 Dec 2024 15:10:31 -0500 Subject: [PATCH 1/2] Run Security build on image from opensearch-build Signed-off-by: Craig Perkins --- .github/workflows/ci.yml | 100 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 93 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f9e94ad6a..e5d77054a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,11 @@ env: CI_ENVIRONMENT: normal jobs: + Get-CI-Image-Tag: + uses: opensearch-project/opensearch-build/.github/workflows/get-ci-image-tag.yml@main + with: + product: opensearch + generate-test-list: runs-on: ubuntu-latest outputs: @@ -32,14 +37,14 @@ jobs: run: | echo "separateTestsNames=$(./gradlew listTasksAsJSON -q --console=plain | tail -n 1)" >> $GITHUB_OUTPUT - test: - name: test + test-windows: + name: Test Windows needs: generate-test-list strategy: fail-fast: false matrix: gradle_task: ${{ fromJson(needs.generate-test-list.outputs.separateTestsNames) }} - platform: [windows-latest, ubuntu-latest] + platform: [windows-latest] jdk: [21] runs-on: ${{ matrix.platform }} @@ -67,8 +72,50 @@ jobs: path: | ./build/reports/ + test-linux: + name: Test Linux + needs: ["generate-test-list", "Get-CI-Image-Tag"] + strategy: + fail-fast: false + matrix: + gradle_task: ${{ fromJson(needs.generate-test-list.outputs.separateTestsNames) }} + jdk: [21] + 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: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-options }} + + steps: + - name: Run start commands + run: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-command }} + - name: Set up JDK for build and test + uses: actions/setup-java@v4 + with: + distribution: temurin # Temurin is a distribution of adoptium + java-version: ${{ matrix.jdk }} + + - name: Checkout security + uses: actions/checkout@v4 + + - name: Build and Test + uses: gradle/gradle-build-action@v3 + with: + cache-disabled: true + arguments: | + ${{ matrix.gradle_task }} -Dbuild.snapshot=false + + - uses: actions/upload-artifact@v4 + if: always() + with: + name: ${{ matrix.platform }}-JDK${{ matrix.jdk }}-${{ matrix.gradle_task }}-reports + path: | + ./build/reports/ + report-coverage: - needs: ["test", "integration-tests"] + needs: ["test-windows", "test-linux", "integration-tests-windows", "integration-tests-linux"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -92,13 +139,13 @@ jobs: verbose: true - integration-tests: - name: integration-tests + integration-tests-windows: + name: Integration Tests Windows strategy: fail-fast: false matrix: jdk: [21] - platform: [ubuntu-latest, windows-latest] + platform: [windows-latest] runs-on: ${{ matrix.platform }} steps: @@ -125,6 +172,45 @@ jobs: path: | ./build/reports/ + integration-tests-linux: + name: Integration Tests Linux + strategy: + fail-fast: false + matrix: + jdk: [21] + 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: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-options }} + + steps: + - name: Run start commands + run: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-command }} + - name: Set up JDK for build and test + uses: actions/setup-java@v4 + with: + distribution: temurin # Temurin is a distribution of adoptium + java-version: ${{ matrix.jdk }} + + - name: Checkout security + uses: actions/checkout@v4 + + - name: Build and Test + uses: gradle/gradle-build-action@v3 + with: + cache-disabled: true + arguments: | + integrationTest -Dbuild.snapshot=false + + - uses: actions/upload-artifact@v4 + if: always() + with: + name: integration-${{ matrix.platform }}-JDK${{ matrix.jdk }}-reports + path: | + ./build/reports/ resource-tests: env: From be7b285be3eec12d0d8a38ffeb075c104ba953a8 Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Tue, 10 Dec 2024 15:25:24 -0500 Subject: [PATCH 2/2] Add needs Signed-off-by: Craig Perkins --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e5d77054a4..b6ba186eaf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -174,6 +174,7 @@ jobs: integration-tests-linux: name: Integration Tests Linux + needs: ["Get-CI-Image-Tag"] strategy: fail-fast: false matrix: