Skip to content

ci: use /term instead of /stop to cancel Jenkins job on GHA cancellation - #1293

Merged
sachintu47 merged 1 commit into
zopencommunity:mainfrom
sachintu47:main
Oct 28, 2026
Merged

sachintu47 merged 1 commit into
zopencommunity:mainfrom
sachintu47:main

Conversation

@sachintu47

@sachintu47 sachintu47 commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

/stop sends a graceful interrupt and waits for the current step to finish cleanly. When the z/OS agent is flapping this causes Jenkins to hang for up to 20s per retry before force-killing the step.

/term sends a forceful termination signal that bypasses the graceful shutdown wait, resulting in an immediate ABORTED without hanging on an unresponsive agent.

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Content Update

Category

  • zopen build framework
  • zopen package manager
  • Documentation
  • CI/CD
  • Tools

Description

Related Issues

  • Related Issue #
  • Closes #

[optional] Are there any post-deployment tasks or follow-up actions required?

/stop sends a graceful interrupt and waits for the current step to
finish cleanly. When the z/OS agent is flapping this causes Jenkins
to hang for up to 20s per retry before force-killing the step.

/term sends a forceful termination signal that bypasses the graceful
shutdown wait, resulting in an immediate ABORTED without hanging on
an unresponsive agent.
Copilot AI balanced review requested due to automatic review settings October 28, 2026 08:34
@sachintu47
sachintu47 merged commit a85951d into zopencommunity:main Oct 28, 2026
1 of 3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The workflow uses a removed Jenkins cancellation endpoint without surfacing HTTP failures and can abandon build tracking when a transient non-JSON queue response causes the step to exit.

2 open issues
What changed in this PR

This PR aims to speed up Jenkins cancellation from GitHub Actions when the z/OS agent is unresponsive, while simplifying build-status polling.

Changes:

  • Switches the cancellation request from /stop to /term.
  • Separates queue and build identifiers and updates cache-control headers.
  • Reuses the final polling response for the build result and removes obsolete comments.
File Description
.github/​workflows/​build_and_test.yml Updates Jenkins cancellation, queue polling, and result handling.

Review effort: Balanced

echo "Cancelling Jenkins job ${{ env.JENKINS_BUILD_NUMBER }}..."
curl -k -X POST -s -u "${{ secrets.JENKINS_USER }}:${{ secrets.JENKINS_API_TOKEN }}" \
"${{ vars.JENKINS_HOST_URL }}/job/Port-Build/${{ env.JENKINS_BUILD_NUMBER }}/stop"
"${{ vars.JENKINS_HOST_URL }}/job/Port-Build/${{ env.JENKINS_BUILD_NUMBER }}/term"
sleep 10
# Poll the Jenkins queue API until the job moves from queue to running
while true; do
BUILD_NUMBER=$(curl -k -s --header 'Cache-Control: no-cache' --header 'Accept: application/json' "${{ vars.JENKINS_HOST_URL }}/queue/item/${QUEUE_NUMBER}/api/json" -u "${{ secrets.JENKINS_USER }}:${{ secrets.JENKINS_API_TOKEN }}" | jq -r '.executable.number')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants