This is an automated email from the ASF dual-hosted git repository.

lhotari pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 0e9bb8a0cb9 [improve][ci] Schedule daily Pulsar CI build with Java 21 
(#21410)
0e9bb8a0cb9 is described below

commit 0e9bb8a0cb9dd147176cc66c1e48a65fa3caad6c
Author: Lari Hotari <lhot...@users.noreply.github.com>
AuthorDate: Sat Oct 21 12:06:54 2023 +0300

    [improve][ci] Schedule daily Pulsar CI build with Java 21 (#21410)
---
 .github/workflows/pulsar-ci-flaky.yaml | 20 +++++++++++++++++++-
 .github/workflows/pulsar-ci.yaml       | 20 +++++++++++++++++++-
 2 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/pulsar-ci-flaky.yaml 
b/.github/workflows/pulsar-ci-flaky.yaml
index dfa3a1998d5..d5be6162a41 100644
--- a/.github/workflows/pulsar-ci-flaky.yaml
+++ b/.github/workflows/pulsar-ci-flaky.yaml
@@ -23,7 +23,11 @@ on:
     branches:
       - master
   schedule:
+    # scheduled job with JDK 17
     - cron: '0 12 * * *'
+    # scheduled job with JDK 21
+    # if cron expression is changed, make sure to update the expression in 
jdk_major_version step in preconditions job
+    - cron: '0 6 * * *'
   workflow_dispatch:
     inputs:
       collect_coverage:
@@ -42,7 +46,7 @@ on:
 
 
 concurrency:
-  group: ${{ github.workflow }}-${{ github.ref }}
+  group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}${{ 
github.event_name == 'workflow_dispatch' && 
github.event.inputs.jdk_major_version || '' }}
   cancel-in-progress: true
 
 env:
@@ -64,9 +68,23 @@ jobs:
       jdk_major_version: ${{ steps.jdk_major_version.outputs.jdk_major_version 
}}
 
     steps:
+      - name: Cancel scheduled jobs in forks by default
+        if: ${{ github.repository != 'apache/pulsar' && github.event_name == 
'schedule' }}
+        uses: actions/github-script@v6
+        with:
+          script: |
+            await github.rest.actions.cancelWorkflowRun({owner: 
context.repo.owner, repo: context.repo.repo, run_id: context.runId});
+            process.exit(1);
+
       - name: Select JDK major version
         id: jdk_major_version
         run: |
+          # use JDK 21 for the scheduled build with cron expression '0 6 * * *'
+          if [[ "${{ github.event_name == 'schedule' && github.event.schedule 
== '0 6 * * *' && 'true' || 'false' }}" == "true" ]]; then
+            echo "jdk_major_version=21" >> $GITHUB_OUTPUT
+            exit 0
+          fi
+          # use JDK 17 for build unless overridden with workflow_dispatch input
           echo "jdk_major_version=${{ github.event_name == 'workflow_dispatch' 
&& github.event.inputs.jdk_major_version || '17'}}" >> $GITHUB_OUTPUT
 
       - name: checkout
diff --git a/.github/workflows/pulsar-ci.yaml b/.github/workflows/pulsar-ci.yaml
index df1dfc3be08..b42dbf47f18 100644
--- a/.github/workflows/pulsar-ci.yaml
+++ b/.github/workflows/pulsar-ci.yaml
@@ -23,7 +23,11 @@ on:
     branches:
       - master
   schedule:
+    # scheduled job with JDK 17
     - cron: '0 12 * * *'
+    # scheduled job with JDK 21
+    # if cron expression is changed, make sure to update the expression in 
jdk_major_version step in preconditions job
+    - cron: '0 6 * * *'
   workflow_dispatch:
     inputs:
       collect_coverage:
@@ -41,7 +45,7 @@ on:
         default: '17'
 
 concurrency:
-  group: ${{ github.workflow }}-${{ github.ref }}
+  group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}${{ 
github.event_name == 'workflow_dispatch' && 
github.event.inputs.jdk_major_version || '' }}
   cancel-in-progress: true
 
 env:
@@ -63,9 +67,23 @@ jobs:
       jdk_major_version: ${{ steps.jdk_major_version.outputs.jdk_major_version 
}}
 
     steps:
+      - name: Cancel scheduled jobs in forks by default
+        if: ${{ github.repository != 'apache/pulsar' && github.event_name == 
'schedule' }}
+        uses: actions/github-script@v6
+        with:
+          script: |
+            await github.rest.actions.cancelWorkflowRun({owner: 
context.repo.owner, repo: context.repo.repo, run_id: context.runId});
+            process.exit(1);
+
       - name: Select JDK major version
         id: jdk_major_version
         run: |
+          # use JDK 21 for the scheduled build with cron expression '0 6 * * *'
+          if [[ "${{ github.event_name == 'schedule' && github.event.schedule 
== '0 6 * * *' && 'true' || 'false' }}" == "true" ]]; then
+            echo "jdk_major_version=21" >> $GITHUB_OUTPUT
+            exit 0
+          fi
+          # use JDK 17 for build unless overridden with workflow_dispatch input
           echo "jdk_major_version=${{ github.event_name == 'workflow_dispatch' 
&& github.event.inputs.jdk_major_version || '17'}}" >> $GITHUB_OUTPUT
 
       - name: checkout

Reply via email to