ALERT: Some images may not load properly within the Knowledge Base Article. If you see a broken image, please right-click and select 'Open image in a new tab'. We apologize for this inconvenience.

Inconsistency was found trying to reorder tasks

book

Article ID: 212723

calendar_today

Updated On:

Products

Continuous Delivery Director

Issue/Introduction

Post upgrade to v7.3 in production, we are facing some inconsistencies white moving tasks from one phase to the other. Even while creating new tasks in the phase.

Cause

There is a defect identified and corrected in build 8.0 and 8.1 which prevent phases getting corrupted during drag and drop. For the already corrupted phases in 7.3 version the cumulative is released to fix the same.

Environment

Release : 7.3

Component : CONTINUOUS DELIVERY DIRECTOR

Resolution

  • The fix to correct corrupted phase is available in 7.3.0.3b70
  • The fix of stopping corruption from happening during re-ordering of task is part of 8.0 and 8.1
  • The API's that fix the task's transition exists is only in 7.3.0.3b70 as we don't expect that to occur in 8.0/8.1 due to preventive code protecting it.
  • If user doesn't re-order and doesn't drag tasks from one phase to another - the corruption would not grow ( but the existing corrupted phases would stay corrupted, for which API is been made available in 7.3.0.3b70 ).
      
    Recommended Approach
    1: Apply 7.3.0.3b70 to Production
    2: Get list of releases and phased-id which are corrupted
    3: Run the shell script provided with input file having list of release-id, phase-id to fix existing corrupted records.
3: POST PATCH:

3.1 As a part of fix you need to upgrade to 7.3.0.3b70 and post upgrading to correct the corrupted release & phase you need to execute the script making a REST call, which requires an input file of release-id, phase-id.

In case if you don't have complete list of corrupted phase ids, you may run the script on ALL phases of active ( non DONE ) releases.
You may use the following SQL query to get the list of all active phases:
=========================================================  
select releases.id, ",", phase.id from releases, phase where phase.release_id =releases.id and releases.release_status != 'DONE' order by releases.release_creation_date desc;
=========================================================
 
If there are too many active phases (more than 100,000) - you may share the export of the following database tables - and we would be able to detect the ids of the corrupted phases and can assist you on same.
  • releases  
  • phase
  • task
  • task_transition

     

3.2 Once you identified the release & phase-id corrupted you can create below script in your environment replacing the respective values and uncomment the line highlighted and can run as instructed it will automatically correct the corrupted releases.
 
The script is as below
 
#!/bin/bash
export CDD_SERVER_URL=http://CDD-HOSTNAME:8080
export CDD_TENANT_ID=00000000-0000-0000-0000-000000000000
export CDD_API_KEY=*********
 
IFS=','
 
while read -a line; do
 if [[ "${#line[@]}" -eq 2 ]]; then
   release_id=${line[0]}
   phase_id=${line[1]}
   URL="${CDD_SERVER_URL}/cdd/design/${CDD_TENANT_ID}/v1/releases/${release_id}/phases/${phase_id}/tasks/transitions"
   echo "Processing request : curl -X POST --header 'Authorization: Bearer ${CDD_API_KEY}' --header 'Accept: application/json' ${URL}"
   #curl -X PATCH --header "Authorization: Bearer ${CDD_API_KEY}" --header "Accept: application/json" "${URL}" -o "response${release_id}_${phase_id}.txt"
   #echo "sleeping for 2s"
   #sleep 2
 else
   echo "INVALID INPUT not processing ${line[*]}"
 fi
done

              Steps to execute the script

        1. Copy the content of the script above and change the respective variable values w.r.t. customer environment
        2. Save the script file and grant execute permission by running command chmod a+x script_file
        3. Create a input file in format release-id,phase-id with problematic release-id and phase-id
        4. Run the script as ./script_file.sh < input_file.txt