You can configure two options in Workflow advanced section on the CDS UI:
The dry run button allows you to test your lua expression. The result is a table filled with all runs that would be kept
This feature is not currently enabled by default. However, you can try this feature on a CDS project using the feature flipping. To activate the feature you can create a file like the following:
cat <<EOF > workflow-retention-policy.yml
name: workflow-retention-policy
rule: return project_key == "KEY_FOR_PROJECT_THAT_YOU_WANT_TO_ACTIVATE"
EOF
cdsctl admin feature import workflow-retention-policy.yml
Retention policy is defined through a lua condition. This condition should be evaluated as true to keep a Workflow Run.
You will be able to use these variables in conditions:
Examples:
-- Keep Run for 365 days
return run_days_before < 365
-- Keep Run for 365 days if git_branch is set and exists in VCS or only 2 days for removed branches
-- Else keep Run for 365 days if no git_branch info is set
if(has_git_branch == "true") then
if(git_branch_exist == "true") then
return run_days_before < 365
else
return run_days_before < 2
end
else
return run_days_before < 365
end
-- Keep Run for ever
return true
This feature is not currently enabled by default. However, you can try this feature on a CDS project using the feature flipping. To activate the feature you can create a file like the following:
cat <<EOF > workflow-retention-maxruns.yml
name: workflow-retention-maxruns
rule: return project_key == "KEY_FOR_PROJECT_THAT_YOU_WANT_TO_ACTIVATE"
EOF
cdsctl admin feature import workflow-retention-maxruns.yml
This value can be set only by a CDS administrator. In some case it prevent a Workflow to keep a lot of runs. When this feature is active, you’ll not be able to start new Runs on a Workflow if the maximum count was reached.