Summary
When a CloudBees CD (CloudBees Flow) job does not end after a long time and you use the force-abort job step, the job might not abort.
Solution
On our github community a jar package is available that will remove un-abortable jobs from your system (jobs that are not aborted through the GUI or ectool commands). This jar is called CleanupStalledJob.jar and can be found at:
https://github.com/electriccommunity/electriccommander/tree/master/CleanupStalledJob
This can be used with 4.2.x and later Commander systems (it has not been tested on earlier versions). Please see the readme file available with the jar file for more details on how to run the tool.
Pre-4.x Versions
With version pre-4.x the following scripts can be used.
Use the following scripts to change the job status to “Success” and reset relevant resource by updating the Commander database. You must have the proper privileges to update the database
Examples
MySQL
- Create a procedure based on the MySQL script.
$ mysql -h my-db -u commander -pcommander commander < ec_force_complete_job_mysql.sql
- Call the procedure for a specific job.
For example, call a procedure for job 123456789:
$ mysql -h my-db -u commander -pcommander commander -e "call ec_force_complete_job(123456789)"
SQLServer
- Create the procedure based on SQLServer script.
$ SQLCMD.EXE -S ms-db -U commander -Pcommander -d commander -i "ec_force_complete_job_sqlserver.sql"
- Call the procedure for a specific job.
For example, call a procedure for job 123456789:
$ SQLCMD.EXE -S ms-db -U commander -Pcommander -d commander -Q "EXEC [ec:dbo].[ec:ec_force_complete_job] 123456789"
Oracle
You do not need to create a procedure.
- Call the procedure for a specific job.
For example, call a procedure for job 123456789:
$ /c/instantclient_11_2/sqlplus cmdrtest1/commander@ora-db @ec_force_complete_job_oracle.sql 123456789
Applies to
- Product versions: 3.6, 3.6.1, 3.6.2, 3.7, 3.7.1, 3.7.2, 3.8.1, 4.0.1, 4.1, 4,2.x
- OS versions: All
Be careful when you use these scripts because they can damage your database.
Use this script with your database administrator, and before you use a script, back up your database.
0 Comments