@@ -218,6 +218,54 @@ def command_release_announcement_email():
218218## Default 'stage' subcommand implementation isn't isolated to its own function yet for historical reasons
219219
220220
221+ def trigger_docker_workflows (rc_tag , release_version , dev_branch ):
222+ """
223+ Trigger Docker image build/test and RC release workflows via GitHub Actions API.
224+ Prompts the user for confirmation before each step.
225+ """
226+ print ("\n === Docker Image Workflows ===" )
227+ if github .DRY_RUN :
228+ print ("NOTE: GITHUB_DRY_RUN is enabled. No actual API calls will be made." )
229+ if github .GITHUB_REPO != "apache/kafka" :
230+ print (f"NOTE: Using custom repository: { github .GITHUB_REPO } " )
231+ if not confirm ("Trigger Docker image build workflows via GitHub Actions?" ):
232+ print ("Skipping Docker image workflows." )
233+ return
234+
235+ def get_github_token ():
236+ print (templates .github_token_instructions ())
237+ return prompt ("Enter your GitHub personal access token: " )
238+ github_token = preferences .get ('github_token' , get_github_token )
239+ kafka_url = f"https://dist.apache.org/repos/dist/dev/kafka/{ rc_tag } /kafka_2.13-{ release_version } .tgz"
240+
241+ # Step 1: Trigger build/test workflows and loop until CVE-free
242+ while True :
243+ print (f"\n Step 1/2: Triggering Docker Build Test workflows for JVM and native images..." )
244+ for image_type in ["jvm" , "native" ]:
245+ github .trigger_docker_build_test (github_token , dev_branch , image_type , kafka_url )
246+ print ("\n Docker Build Test workflows triggered successfully for both JVM and native images." )
247+ print (f"\n Please check the build results and CVE scan reports at:" )
248+ print (f" https://github.com/{ github .GITHUB_REPO } /actions/workflows/docker_build_and_test.yml" )
249+ print ("\n Verify that:" )
250+ print (" 1. Both JVM and native image builds succeeded" )
251+ print (" 2. The CVE scan reports show no CRITICAL or HIGH vulnerabilities" )
252+ print (" 3. If CVEs are found, update the Dockerfiles and re-trigger" )
253+ print (" Dockerfiles are located at: docker/jvm/Dockerfile and docker/native/Dockerfile" )
254+ if confirm ("Have the builds passed with no CVEs? (n to re-trigger after fixing Dockerfiles)" ):
255+ break
256+ print ("\n Re-triggering Docker Build Test workflows after Dockerfile updates..." )
257+
258+ # Step 2: Push RC images to DockerHub
259+ print (f"\n Step 2/2: Triggering Docker RC Release workflows for JVM and native images..." )
260+ for image_type in ["jvm" , "native" ]:
261+ docker_image_name = "apache/kafka-native" if image_type == "native" else "apache/kafka"
262+ rc_docker_image = f"{ docker_image_name } :{ rc_tag } "
263+ github .trigger_docker_rc_release (github_token , dev_branch , image_type , rc_docker_image , kafka_url )
264+ print ("\n Docker RC Release workflows triggered successfully for both JVM and native images." )
265+
266+ print (f"\n All Docker workflow runs can be monitored at: https://github.com/{ github .GITHUB_REPO } /actions" )
267+
268+
221269def verify_gpg_key ():
222270 if not gpg .key_exists (gpg_key_id ):
223271 fail (f"GPG key { gpg_key_id } not found" )
@@ -373,29 +421,7 @@ def delete_gitrefs():
373421git .push_ref (rc_tag )
374422git .push_ref (starting_branch )
375423
376- # Trigger Docker image build and test workflows via GitHub Actions
377- print ("\n === Docker Image Workflows ===" )
378- if github .DRY_RUN :
379- print ("NOTE: GITHUB_DRY_RUN is enabled. No actual API calls will be made." )
380- if github .GITHUB_REPO != "apache/kafka" :
381- print (f"NOTE: Using custom repository: { github .GITHUB_REPO } " )
382- if confirm ("Trigger Docker image build workflows via GitHub Actions?" ):
383- github_token = preferences .get ('github_token' , lambda : prompt ("Enter your GitHub personal access token (with 'actions' scope): " ))
384- kafka_url = f"https://dist.apache.org/repos/dist/dev/kafka/{ rc_tag } /kafka_2.13-{ release_version } .tgz"
385- print (f"\n Step 1/2: Triggering Docker Build Test workflows for JVM and native images..." )
386- for image_type in ["jvm" , "native" ]:
387- github .trigger_docker_build_test (github_token , dev_branch , image_type , kafka_url )
388- print ("\n Docker Build Test workflows triggered successfully for both JVM and native images." )
389- if confirm ("Also trigger Docker RC release workflows to push RC images to DockerHub?" ):
390- print (f"\n Step 2/2: Triggering Docker RC Release workflows for JVM and native images..." )
391- for image_type in ["jvm" , "native" ]:
392- docker_image_name = "apache/kafka-native" if image_type == "native" else "apache/kafka"
393- rc_docker_image = f"{ docker_image_name } :{ rc_tag } "
394- github .trigger_docker_rc_release (github_token , dev_branch , image_type , rc_docker_image , kafka_url )
395- print ("\n Docker RC Release workflows triggered successfully for both JVM and native images." )
396- print (f"\n All Docker workflow runs can be monitored at: https://github.com/{ github .GITHUB_REPO } /actions" )
397- else :
398- print ("Skipping Docker image workflows." )
424+ trigger_docker_workflows (rc_tag , release_version , dev_branch )
399425
400426# Move back to starting branch and clean out the temporary release branch (e.g. 1.0.0) we used to generate everything
401427git .reset_hard_head ()
0 commit comments