Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions internal/controllers/remediation/scripts/test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
set -e
NODE_NAME='{{inputs.parameters.node_name}}'
JOB_NAME="{{workflow.name}}-test-run"
CM_NAME='{{workflow.name}}-test-configmap'

# Generate a unique job name under 63 characters
# Format: <truncated-workflow-name>-<short-uid>-test
WORKFLOW_NAME='{{workflow.name}}'
WORKFLOW_UID='{{workflow.uid}}'

# Extract last 8 characters of workflow UID for uniqueness
SHORT_UID="${WORKFLOW_UID: -8}"

# Calculate max length for workflow name prefix (63 - 8 (uid) - 1 (dash) - 5 ("-test") - 1 (dash) = 48)
MAX_PREFIX_LEN=48

# Truncate workflow name if needed
if [ ${#WORKFLOW_NAME} -gt $MAX_PREFIX_LEN ]; then
WORKFLOW_PREFIX="${WORKFLOW_NAME:0:$MAX_PREFIX_LEN}"
else
WORKFLOW_PREFIX="$WORKFLOW_NAME"
fi

JOB_NAME="${WORKFLOW_PREFIX}-${SHORT_UID}-test"
CM_NAME="${WORKFLOW_PREFIX}-${SHORT_UID}-cm"
FRAMEWORK='{{inputs.parameters.framework}}'
RECIPE='{{inputs.parameters.recipe}}'
ITERATIONS='{{inputs.parameters.iterations}}'
Expand Down
4 changes: 2 additions & 2 deletions internal/controllers/remediation_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ func (h *remediationMgrHelper) createDefaultWorkflowTemplate(ctx context.Context
Name: "inbuilt",
Metadata: instanceIDMeta,
Steps: []workflowv1alpha1.ParallelSteps{
{Steps: []workflowv1alpha1.WorkflowStep{{Name: "autostart", Template: "suspend", When: "{{workflow.parameters.auto_start}} == 'false'"}}}, // If auto start is disabled, workflow will be created in suspended state and needs to be manually resumed by user
{Steps: []workflowv1alpha1.WorkflowStep{{Name: "autostart", Template: "suspend", When: "{{workflow.parameters.auto_start}} == false"}}}, // If auto start is disabled, workflow will be created in suspended state and needs to be manually resumed by user
{Steps: []workflowv1alpha1.WorkflowStep{{Name: "applylabels", Template: "applylabels"}}},
{Steps: []workflowv1alpha1.WorkflowStep{{Name: "taint", Template: "taint"}}},
{Steps: []workflowv1alpha1.WorkflowStep{{Name: "drain", Template: "drain"}}},
Expand All @@ -662,7 +662,7 @@ func (h *remediationMgrHelper) createDefaultWorkflowTemplate(ctx context.Context
},
},
{Steps: []workflowv1alpha1.WorkflowStep{{Name: "suspend", Template: "suspend"}}},
{Steps: []workflowv1alpha1.WorkflowStep{{Name: "reboot", Template: "reboot", ContinueOn: &workflowv1alpha1.ContinueOn{Failed: true}, When: "{{workflow.parameters.skipRebootStep}} == 'false'"}}},
{Steps: []workflowv1alpha1.WorkflowStep{{Name: "reboot", Template: "reboot", ContinueOn: &workflowv1alpha1.ContinueOn{Failed: true}, When: "{{workflow.parameters.skipRebootStep}} == false"}}},
{Steps: []workflowv1alpha1.WorkflowStep{{Name: "test", Template: "test", ContinueOn: &workflowv1alpha1.ContinueOn{Failed: true}}}},
{Steps: []workflowv1alpha1.WorkflowStep{
{
Expand Down
Loading