Details
-
Bug
-
Resolution: Unresolved
-
Low
-
None
-
5.15.5, 7.1.1
-
None
-
6
-
Severity 3 - Minor
-
5
-
Description
Issue Summary
DELETE on queue REST API to stop an in-progress build does work as specified (the API reference states that it stops build execution). Instead, the behaviour is as follows:
- The job remains in progress after the first delete call if its only job in the stage
- If there are multiple jobs in the stage, it looks to be cancelled but looking at the job result will cause a refresh spam
- The command the agent is running continues.
A second delete call will change the job status to cancelled, however the agent will still be running the command.
Steps to Reproduce
- Create a single stage plan with two jobs
- Add a script task:
sleep 120;
- Perform a build
- Issue a DELETE to the API:
BAMBOO_USERNAME= BAMBOO_BASE_URL= BAMBOO_JOB_BUILD_KEY= curl -vvv --user $BAMBOO_USERNAME -X DELETE $BAMBOO_BASE_URL/rest/api/latest/queue/$BAMBOO_JOB_BUILD_KEY
- Viewing the job result in the UI will create a browser refresh loop
- The job is still running on the agent
- Issue a second DELETE to the API:
BAMBOO_USERNAME= BAMBOO_BASE_URL= BAMBOO_JOB_BUILD_KEY= curl -vvv --user $BAMBOO_USERNAME -X DELETE $BAMBOO_BASE_URL/rest/api/latest/queue/$BAMBOO_JOB_BUILD_KEY
- The refresh loop is broken now and the job result is cancelled but the actual job is still in progress on the agent.
Expected Results
The job execution is stopped and the result is cancelled, in the same fashion as if you had hit Stop Job in the UI.
Actual Results
Refresh loops when viewing the job and despite the job eventually being cancelled, its still running and consuming an agent.
Workaround
Once in this state, you need to wait for the job to complete. In future, you can stop the job from the UI (Build result > Select Job > Actions > Stop Job) instead of the REST API.
If an automated stop is required, you can use the same Struts action Bamboo uses from the UI, however it should be avoided unless necessary since its usage may change in future versions without warning:
BAMBOO_BASE_URL=https://localhost:8085 BAMBOO_JOB_BUILD_KEY=PROJ-PLAN-JOB1-1 BAMBOO_USERNAME=bamboo curl --user $BAMBOO_USERNAME -X POST "$BAMBOO_BASE_URL/build/admin/stopPlan.action?planResultKey=$BAMBOO_JOB_BUILD_KEY" \ -H 'Content-Type: application/x-www-form-urlencoded' \ -H 'X-Atlassian-Token: no-check'
Attachments
Issue Links
- mentioned in
-
Page Loading...