Repository navigation
ci: use /term instead of /stop to cancel Jenkins job on GHA cancellation - #1293
Merged
Merged
Conversation
/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.
sachintu47
requested review from
DevonianTeuchter,
HarithaIBM,
IgorTodorovskiIBM,
MikeFultonDev and
v1gnesh
as code owners
October 28, 2026 08:34
Contributor
There was a problem hiding this comment.
🟡 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
/stopto/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') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


/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)
Category
Description
Related Issues
[optional] Are there any post-deployment tasks or follow-up actions required?