From 0af69cc8e3aa05edb5ee1dc98bde8e36a985620f Mon Sep 17 00:00:00 2001 From: Gilbert Kwan Date: Mon, 13 Jan 2025 13:59:01 -0500 Subject: [PATCH] Enable spring boot guide to run java21 daily builds (#1101) * Update daily-build-java21.yml * Update guides-java17.json * Create guides-java21.json * Update guides-java21.json * Update daily-build-java21.yml * Update manual-docker-build-test-java17.yml * Update manual-gm-candidate-container-test-java17.yml * Create manual-gm-candidate-container-test-java21.yml * Update manual-gm-candidate-container-test-java17.yml * Update manual-docker-build-test-java17.yml * Create get-guides-java21.py * Update docker-daily-test-java17.yml * Create docker-daily-test-java21.yml * Update docker-daily-test-java17.yml * Update docker-daily-test-java21.yml * Update trigger-docker-daily-test.yml * Update manual-gm-candidate-container-test-java17.yml * Update manual-gm-candidate-container-test-java21.yml --- .github/workflows/daily-build-java21.yml | 4 +- .../workflows/docker-daily-test-java17.yml | 2 +- .../workflows/docker-daily-test-java21.yml | 123 +++++++++++++++++ .github/workflows/get-guides-java21.py | 6 + .github/workflows/guides-java17.json | 3 +- .github/workflows/guides-java21.json | 4 + ...ual-gm-candidate-container-test-java17.yml | 2 +- ...ual-gm-candidate-container-test-java21.yml | 127 ++++++++++++++++++ .../workflows/trigger-docker-daily-test.yml | 5 + 9 files changed, 270 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/docker-daily-test-java21.yml create mode 100644 .github/workflows/get-guides-java21.py create mode 100644 .github/workflows/guides-java21.json create mode 100644 .github/workflows/manual-gm-candidate-container-test-java21.yml diff --git a/.github/workflows/daily-build-java21.yml b/.github/workflows/daily-build-java21.yml index 82ba7e85..d52ff54b 100644 --- a/.github/workflows/daily-build-java21.yml +++ b/.github/workflows/daily-build-java21.yml @@ -37,11 +37,11 @@ jobs: - name: Get default repos if: ${{ github.event_name == 'repository_dispatch' || github.event_name == 'workflow_dispatch' && github.event.inputs.guide == 'all' }} id: create-list - run: echo "repos=[ 'guide-jpa-intro' ]" >> $GITHUB_OUTPUT + run: echo "::set-output name=repos::$(python3 .github/workflows/get-guides-java21.py)" - name: Set input repo if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.guide != 'all' }} id: input-guide - run: echo "repo=[ '${{ github.event.inputs.guide }}' ]" >> $GITHUB_OUTPUT + run: echo "::set-output name=repo::[ '${{ github.event.inputs.guide }}' ]" build-level: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/docker-daily-test-java17.yml b/.github/workflows/docker-daily-test-java17.yml index 9e3962c1..53c84bdf 100644 --- a/.github/workflows/docker-daily-test-java17.yml +++ b/.github/workflows/docker-daily-test-java17.yml @@ -37,7 +37,7 @@ jobs: - name: Get repos if: ${{ github.event_name == 'repository_dispatch' || github.event_name == 'workflow_dispatch' && github.event.inputs.guide == 'all' }} id: create-list - run: echo "repos=[ 'guide-spring-boot', 'guide-liberty-deep-dive' ]" >> $GITHUB_OUTPUT + run: echo "repos=[ 'guide-liberty-deep-dive' ]" >> $GITHUB_OUTPUT - name: Set repo if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.guide != 'all' }} id: input-guide diff --git a/.github/workflows/docker-daily-test-java21.yml b/.github/workflows/docker-daily-test-java21.yml new file mode 100644 index 00000000..946e5d7b --- /dev/null +++ b/.github/workflows/docker-daily-test-java21.yml @@ -0,0 +1,123 @@ +name: Test Docker Daily Build - Java 21 + +on: + repository_dispatch: + types: [ docker-image-test-java21 ] + workflow_dispatch: + inputs: + build: + description: Build level as cl231220231122-1901 + required: true + date: + description: Dev date as 2023-11-22_1901 + required: true + driver: + description: Driver location as openliberty-all-23.0.0.12-cl231220231122-1901.zip + required: true + guide: + description: Guide to build + default: "all" + required: true + branch: + description: Branch to test + required: false + +env: + DOCKER_USERNAME: ${{ secrets.CP_STG_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.CP_STG_PASSWORD }} + CHANGE_MINIKUBE_NONE_USER: true + +jobs: + get-repos: + runs-on: ubuntu-latest + outputs: + repos: ${{ steps.create-list.outputs.repos }}${{ steps.input-guide.outputs.repo }} + steps: + - uses: actions/checkout@v2 + - name: Get repos + if: ${{ github.event_name == 'repository_dispatch' || github.event_name == 'workflow_dispatch' && github.event.inputs.guide == 'all' }} + id: create-list + run: echo "repos=[ 'guide-spring-boot' ]" >> $GITHUB_OUTPUT + - name: Set repo + if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.guide != 'all' }} + id: input-guide + run: echo "::set-output name=repo::[ '${{ github.event.inputs.guide }}' ]" + build-level: + runs-on: ubuntu-latest + steps: + - name: Starting daily build tests for ${{ github.event.client_payload.build-level }}${{ github.event.inputs.build }} + run: | + echo "Inputs: " + echo build: ${{ github.event.inputs.build }} + echo date: ${{ github.event.inputs.date }} + echo driver: ${{ github.event.inputs.driver }} + echo guide: ${{ github.event.inputs.guide }} + echo branch: ${{ github.event.inputs.branch }} + echo "Build level: ${{ github.event.client_payload.build-level }}${{ github.event.inputs.build }}" + test-guide: + needs: [ get-repos ] + runs-on: ubuntu-latest + strategy: + fail-fast: false + max-parallel: 5 + matrix: + repos: ${{ fromJson(needs.get-repos.outputs.repos) }} + jdk: [ "21" ] + steps: + - name: Setup JDK ${{ matrix.jdk }} + uses: actions/setup-java@v1 + with: + java-version: ${{ matrix.jdk }} + - name: Clone ${{ matrix.repos }} + uses: actions/checkout@v2 + with: + repository: OpenLiberty/${{ matrix.repos }} + ref: ${{ github.event.inputs.branch }} + path: ${{ matrix.repos }} + - name: Set permissions + run: chmod +x ${{ matrix.repos }}/scripts/*.sh + - name: Docker login + run: echo $DOCKER_PASSWORD | sudo docker login -u $DOCKER_USERNAME --password-stdin cp.stg.icr.io + - name: Run tests for ${{ matrix.repos }} + working-directory: ${{ matrix.repos }}/finish + env: + DEVDATE: ${{ github.event.client_payload.dev-date }}${{ github.event.inputs.date }} + DRIVER: ${{ github.event.client_payload.driver-location }}${{ github.event.inputs.driver }} + run: sudo -E ../scripts/dockerImageTest.sh -t $DEVDATE -d $DRIVER + - name: Post tests + working-directory: ${{ matrix.repos }} + if: always() + run: | + logsPath=$(sudo find . -name "console.log"); + if [ -z "$logsPath" ] + then + logsPath=$(sudo find . -name "messages.log"); + if [ ! -z "$logsPath" ] + then + sudo cat $logsPath | grep product + sudo cat $logsPath | grep java.runtime + fi + else sudo cat $logsPath | grep Launching + fi; + sudo docker images + - name: Archive server logs if failed + if: failure() + uses: actions/upload-artifact@v4 + with: + name: server-logs + path: ${{ matrix.repos }}/finish/target/liberty/wlp/usr/servers/defaultServer/logs/ + slack-alert: + needs: [ test-guide ] + if: failure() + runs-on: ubuntu-latest + env: + BUILDLEVEL: ${{ github.event.client_payload.build-level }}${{ github.event.inputs.build }} + DEVDATE: ${{ github.event.client_payload.dev-date }}${{ github.event.inputs.date }} + DRIVER: ${{ github.event.client_payload.driver-location }}${{ github.event.inputs.driver }} + steps: + - uses: actions/checkout@v2 + - name: send-status + run: | + python3 .github/workflows/slack-alert.py ${{ env.BUILDLEVEL }} ${{ env.DRIVER }} ${{ env.DEVDATE }} ${{ needs.test-guide.result }} \ + ${{ github.repository }} ${{ github.run_id }} ${{ secrets.SLACK_HOOK }} + echo ${{ needs.test-guide.result }} diff --git a/.github/workflows/get-guides-java21.py b/.github/workflows/get-guides-java21.py new file mode 100644 index 00000000..f0119f80 --- /dev/null +++ b/.github/workflows/get-guides-java21.py @@ -0,0 +1,6 @@ +import json + +JSON_PATH = ".github/workflows/guides-java21.json" + +if __name__ == "__main__": + print(json.load(open(JSON_PATH))) diff --git a/.github/workflows/guides-java17.json b/.github/workflows/guides-java17.json index 4304120d..c5343b52 100644 --- a/.github/workflows/guides-java17.json +++ b/.github/workflows/guides-java17.json @@ -3,7 +3,6 @@ "guide-jakarta-websocket", "guide-jms-intro", "guide-liberty-deep-dive", - "guide-liberty-deep-dive-gradle", - "guide-spring-boot" + "guide-liberty-deep-dive-gradle" ] diff --git a/.github/workflows/guides-java21.json b/.github/workflows/guides-java21.json new file mode 100644 index 00000000..5ed61b76 --- /dev/null +++ b/.github/workflows/guides-java21.json @@ -0,0 +1,4 @@ +[ + "guide-jpa-intro", + "guide-spring-boot" +] diff --git a/.github/workflows/manual-gm-candidate-container-test-java17.yml b/.github/workflows/manual-gm-candidate-container-test-java17.yml index 3cb62bcf..530082ef 100644 --- a/.github/workflows/manual-gm-candidate-container-test-java17.yml +++ b/.github/workflows/manual-gm-candidate-container-test-java17.yml @@ -35,7 +35,7 @@ jobs: - name: Get repos if: ${{ github.event_name == 'repository_dispatch' || github.event_name == 'workflow_dispatch' && github.event.inputs.guide == 'all' }} id: create-list - run: echo "repos=[ 'guide-spring-boot', 'guide-liberty-deep-dive' ]" >> $GITHUB_OUTPUT + run: echo "repos=[ 'guide-liberty-deep-dive' ]" >> $GITHUB_OUTPUT - name: Set repo if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.guide != 'all' }} id: input-guide diff --git a/.github/workflows/manual-gm-candidate-container-test-java21.yml b/.github/workflows/manual-gm-candidate-container-test-java21.yml new file mode 100644 index 00000000..6a584f75 --- /dev/null +++ b/.github/workflows/manual-gm-candidate-container-test-java21.yml @@ -0,0 +1,127 @@ +name: Manual GM candidate container test - Java 21 + +on: + workflow_dispatch: + inputs: + build: + description: Build level as cl241020240923-1638 + required: true + date: + description: Dev date as 2024-09-23_1638 + required: true + ol_version: + description: OL version as 24.0.0.10 + required: true + guide: + description: Guide to build + default: "all" + required: true + branch: + description: Branch to test + required: false + +env: + DOCKER_USERNAME: ${{ secrets.CP_STG_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.CP_STG_PASSWORD }} + CHANGE_MINIKUBE_NONE_USER: true + +jobs: + get-guide-repos: + runs-on: ubuntu-latest + outputs: + repos: ${{ steps.create-list.outputs.repos }}${{ steps.input-guide.outputs.repo }} + steps: + - uses: actions/checkout@v2 + - name: Get repos + if: ${{ github.event_name == 'repository_dispatch' || github.event_name == 'workflow_dispatch' && github.event.inputs.guide == 'all' }} + id: create-list + run: echo "repos=[ 'guide-spring-boot' ]" >> $GITHUB_OUTPUT + - name: Set repo + if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.guide != 'all' }} + id: input-guide + run: echo "::set-output name=repo::[ '${{ github.event.inputs.guide }}' ]" + build-level: + runs-on: ubuntu-latest + steps: + - name: Starting GM candidate container tests for ${{ github.event.inputs.build }} + run: | + echo "Inputs: " + echo build: ${{ github.event.inputs.build }} + echo date: ${{ github.event.inputs.date }} + echo ol_version: ${{ github.event.inputs.ol_version }} + echo driver: openliberty-all-${{ github.event.inputs.ol_version }}-${{ github.event.inputs.build }}.zip + echo guide: ${{ github.event.inputs.guide }} + echo branch: ${{ github.event.inputs.branch }} + test-guide: + needs: [ get-guide-repos ] + runs-on: ubuntu-latest + strategy: + fail-fast: false + max-parallel: 5 + matrix: + repos: ${{ fromJson(needs.get-guide-repos.outputs.repos) }} + jdk: [ "21" ] + steps: + - name: Setup JDK ${{ matrix.jdk }} + uses: actions/setup-java@v1 + with: + java-version: ${{ matrix.jdk }} + - name: Clone ${{ matrix.repos }} + uses: actions/checkout@v2 + with: + repository: OpenLiberty/${{ matrix.repos }} + ref: ${{ github.event.inputs.branch }} + path: ${{ matrix.repos }} + - name: Set permissions + run: chmod +x ${{ matrix.repos }}/scripts/*.sh + - name: Docker login + run: echo $DOCKER_PASSWORD | sudo docker login -u $DOCKER_USERNAME --password-stdin cp.stg.icr.io + - name: Run tests for ${{ matrix.repos }} + working-directory: ${{ matrix.repos }}/finish + env: + DEVDATE: ${{ github.event.inputs.date }} + DRIVER: openliberty-all-${{ github.event.inputs.ol_version }}-${{ github.event.inputs.build }}.zip + OL_VERSION: ${{ github.event.inputs.ol_version }} + run: sudo -E ../scripts/dockerImageTest.sh -t $DEVDATE -d $DRIVER -v $OL_VERSION + - name: Post tests + working-directory: ${{ matrix.repos }} + if: always() + run: | + mvn -version + sudo chmod -R 777 . + logsPath=$(sudo find . -name "console.log"); + if [ -z "$logsPath" ] + then + logsPath=$(sudo find . -name "messages.log"); + if [ -z "$logsPath" ] + then sudo docker images + else + sudo cat $logsPath | grep product + sudo cat $logsPath | grep java.runtime + fi + else sudo cat $logsPath | grep Launching + fi + - name: Archive server logs if failed + if: failure() + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.repos }}-logs + path: | + ${{ matrix.repos }}/finish/target/liberty/wlp/usr/servers/defaultServer/logs/ + ${{ matrix.repos }}/finish/**/target/liberty/wlp/usr/servers/defaultServer/logs/ + if-no-files-found: ignore + slack-alert: + needs: [test-guide] + if: failure() + runs-on: ubuntu-latest + env: + BUILDLEVEL: ${{ github.event.inputs.build }} + DEVDATE: ${{ github.event.inputs.date }} + DRIVER: openliberty-all-${{ github.event.inputs.ol_version }}-${{ github.event.inputs.build }}.zip + steps: + - uses: actions/checkout@v2 + - name: send-status + run: | + python3 .github/workflows/slack-alert.py ${{ env.BUILDLEVEL }} ${{ env.DRIVER }} ${{ env.DEVDATE }} ${{ needs.test-guide.result }} \ + ${{ github.repository }} ${{ github.run_id }} ${{ secrets.SLACK_HOOK }} + echo ${{ needs.test-guide.result }} diff --git a/.github/workflows/trigger-docker-daily-test.yml b/.github/workflows/trigger-docker-daily-test.yml index ed6560d2..15435792 100644 --- a/.github/workflows/trigger-docker-daily-test.yml +++ b/.github/workflows/trigger-docker-daily-test.yml @@ -50,6 +50,7 @@ jobs: ACCEPT_HEADER: "application/vnd.github.v3+json" PAYLOAD: '{ "dev-date": "${{ matrix.builds.date }}", "driver-location": "${{ matrix.builds.driver_location }}", "build-level": "${{ matrix.builds.build_level }}", "jdk": "11" }' PAYLOAD_JAVA17: '{ "dev-date": "${{ matrix.builds.date }}", "driver-location": "${{ matrix.builds.driver_location }}", "build-level": "${{ matrix.builds.build_level }}", "jdk": "17" }' + PAYLOAD_JAVA21: '{ "dev-date": "${{ matrix.builds.date }}", "driver-location": "${{ matrix.builds.driver_location }}", "build-level": "${{ matrix.builds.build_level }}", "jdk": "21" }' steps: - name: Trigger Docker image tests run: | @@ -67,6 +68,10 @@ jobs: -H "Authorization: token $GH_TOKEN" \ -d "{ \"event_type\": \"docker-image-test-java17\", \"client_payload\": $PAYLOAD_JAVA17 }" \ -X POST $URI + curl -H "Accept: $ACCEPT_HEADER" \ + -H "Authorization: token $GH_TOKEN" \ + -d "{ \"event_type\": \"docker-image-test-java21\", \"client_payload\": $PAYLOAD_JAVA21 }" \ + -X POST $URI else echo Skip test because "$IMAGEBUILDLEVEL" and "${{ matrix.builds.build_level }}" do not match! fi