From ca43ae5032f1e2aab865da53f9a1cf9fa573015a Mon Sep 17 00:00:00 2001 From: lrochette Date: Tue, 10 Mar 2026 08:27:06 -0700 Subject: [PATCH 1/2] Argo Submit a workflow --- step-templates/argo-workflow-submit.json | 65 ++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 step-templates/argo-workflow-submit.json diff --git a/step-templates/argo-workflow-submit.json b/step-templates/argo-workflow-submit.json new file mode 100644 index 000000000..3880fb6ca --- /dev/null +++ b/step-templates/argo-workflow-submit.json @@ -0,0 +1,65 @@ +{ + "Id": "0abe1aab-b264-4f40-a534-d48082ef3ac3", + "Name": "Submit Argo Workflow", + "Description": "Submit an Argo Worflow from a WorkflowTemplate", + "ActionType": "Octopus.KubernetesRunScript", + "Version": 1, + "CommunityActionTemplateId": null, + "Packages": [], + "GitDependencies": [], + "Properties": { + "Octopus.Action.Script.ScriptSource": "Inline", + "Octopus.Action.Script.Syntax": "Bash", + "Octopus.Action.Script.ScriptBody": "\n# Grab Variables\n\nexport wkf_name=$(get_octopusvariable 'ArgoWorkflowSubmit.Name')\nexport namespace=$(get_octopusvariable 'ArgoWorkflowSubmit.Namespace')\nexport parameter_array=$(get_octopusvariable \"ArgoWorkflowSubmit.Parameters\")\nexport options=$(get_octopusvariable 'ArgoWorkflowSubmit.Options')\n\n# Process optional parameters\nparameter_string=\"\"\nif [ -n \"$parameter_array\" ] ; then\n parameter_string=$(echo \"$parameter_array\" | awk '{printf \"-p %s \", $0}' | sed 's/ $//')\n echo \"Parameter string: $parameter_string\"\nelse\n echo \"No parameters passed\"\nfi\n\n\nCMD=\"argo submit -n $namespace --from workflowtemplate/$wkf_name $parameter_string $options -o name\"\necho \"Workflow Submit command: $CMD\"\n\nNAME=$($CMD)\nargo logs --follow $NAME\n\nPHASE=$(argo get $NAME -o json | jq -r '.status.phase')\n\nif [[ \"$PHASE\" == \"Succeeded\" ]]; then\n echo \"Workflow Succeeded.\"\n exit 0\nelif [[ \"$PHASE\" == \"Failed\" ]] || [[ \"$PHASE\" == \"Error\" ]]; then\n MESSAGE=$(argo get \"$NAME\" -o json | jq -r '.status.message')\n echo \"Workflow Phase: $PHASE.\"\n echo \"Message: $MESSAGE\"\n exit 1\nelse\n echo \"Workflow Phase: $PHASE (still running or unknown).\"\n exit 2\nfi" + }, + "Parameters": [ + { + "Id": "0d55eec6-241c-4e0d-a7c3-ac468a73f1b4", + "Name": "ArgoWorkflowSubmit.Namespace", + "Label": "Namespace of the workflow template", + "HelpText": "The name of the namespace where the workflow template to submit is defined", + "DefaultValue": "argocd", + "DisplaySettings": { + "Octopus.ControlType": "SingleLineText" + } + }, + { + "Id": "b5f33a16-d470-496e-9271-9f75741e3e70", + "Name": "ArgoWorkflowSubmit.Name", + "Label": "WorkflowTemplate Name", + "HelpText": "The name of the Workflow Trmplate to submit", + "DefaultValue": "", + "DisplaySettings": { + "Octopus.ControlType": "SingleLineText" + } + }, + { + "Id": "073e6872-2f34-4ade-944a-953f451f1ef3", + "Name": "ArgoWorkflowSubmit.Parameters", + "Label": "Workflow parameters", + "HelpText": "An optional array of parameters to pass to the workflow. One name=value per line", + "DefaultValue": "", + "DisplaySettings": { + "Octopus.ControlType": "MultiLineText" + } + }, + { + "Id": "0b91a1f6-7da7-40ba-b22c-d74ffd2bd8c4", + "Name": "ArgoWorkflowSubmit.Options", + "Label": "Additional Options", + "HelpText": "Additional Options to pass to the \"Argo Submit\" command", + "DefaultValue": "", + "DisplaySettings": { + "Octopus.ControlType": "MultiLineText" + } + } + ], + "StepPackageId": "Octopus.KubernetesRunScript", + "$Meta": { + "ExportedAt": "2026-03-10T15:15:54.763Z", + "OctopusVersion": "2026.2.742", + "Type": "ActionTemplate" + }, + "LastModifiedBy": "lrochette", + "Category": "argo" +} From 6144ae134e960714b47e5e0fe5c609db46eb82b1 Mon Sep 17 00:00:00 2001 From: lrochette Date: Fri, 13 Mar 2026 09:52:40 -0700 Subject: [PATCH 2/2] Add check for Argo CLI and workflow template name --- step-templates/argo-workflow-submit.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/step-templates/argo-workflow-submit.json b/step-templates/argo-workflow-submit.json index 3880fb6ca..627f388ff 100644 --- a/step-templates/argo-workflow-submit.json +++ b/step-templates/argo-workflow-submit.json @@ -1,16 +1,16 @@ { - "Id": "0abe1aab-b264-4f40-a534-d48082ef3ac3", + "Id": "6210f1aa-fbf5-495e-a39c-13c662005f72", "Name": "Submit Argo Workflow", "Description": "Submit an Argo Worflow from a WorkflowTemplate", "ActionType": "Octopus.KubernetesRunScript", - "Version": 1, + "Version": 2, "CommunityActionTemplateId": null, "Packages": [], "GitDependencies": [], "Properties": { "Octopus.Action.Script.ScriptSource": "Inline", "Octopus.Action.Script.Syntax": "Bash", - "Octopus.Action.Script.ScriptBody": "\n# Grab Variables\n\nexport wkf_name=$(get_octopusvariable 'ArgoWorkflowSubmit.Name')\nexport namespace=$(get_octopusvariable 'ArgoWorkflowSubmit.Namespace')\nexport parameter_array=$(get_octopusvariable \"ArgoWorkflowSubmit.Parameters\")\nexport options=$(get_octopusvariable 'ArgoWorkflowSubmit.Options')\n\n# Process optional parameters\nparameter_string=\"\"\nif [ -n \"$parameter_array\" ] ; then\n parameter_string=$(echo \"$parameter_array\" | awk '{printf \"-p %s \", $0}' | sed 's/ $//')\n echo \"Parameter string: $parameter_string\"\nelse\n echo \"No parameters passed\"\nfi\n\n\nCMD=\"argo submit -n $namespace --from workflowtemplate/$wkf_name $parameter_string $options -o name\"\necho \"Workflow Submit command: $CMD\"\n\nNAME=$($CMD)\nargo logs --follow $NAME\n\nPHASE=$(argo get $NAME -o json | jq -r '.status.phase')\n\nif [[ \"$PHASE\" == \"Succeeded\" ]]; then\n echo \"Workflow Succeeded.\"\n exit 0\nelif [[ \"$PHASE\" == \"Failed\" ]] || [[ \"$PHASE\" == \"Error\" ]]; then\n MESSAGE=$(argo get \"$NAME\" -o json | jq -r '.status.message')\n echo \"Workflow Phase: $PHASE.\"\n echo \"Message: $MESSAGE\"\n exit 1\nelse\n echo \"Workflow Phase: $PHASE (still running or unknown).\"\n exit 2\nfi" + "Octopus.Action.Script.ScriptBody": "# Check for Argo\nif ! command -v argo -v >/dev/null 2>&1\nthen\n echo \"argo executable could not be found. Please use a target or container including it like octopuslabs/argo-workflow-workertools.\"\n exit 1\nfi\n\n# Grab Variables\nexport wkf_name=$(get_octopusvariable 'ArgoWorkflowSubmit.Name')\nexport namespace=$(get_octopusvariable 'ArgoWorkflowSubmit.Namespace')\nexport parameter_array=$(get_octopusvariable \"ArgoWorkflowSubmit.Parameters\")\nexport options=$(get_octopusvariable 'ArgoWorkflowSubmit.Options')\n\n# Check workflowTemplate name has been passed\nif [ -z \"$wkf_name\" ] ; then\n echo \"WorkflowTemplate name is required\"\n exit 1\nfi\n# Process optional parameters\nparameter_string=\"\"\nif [ -n \"$parameter_array\" ] ; then\n parameter_string=$(echo \"$parameter_array\" | awk '{printf \"-p %s \", $0}' | sed 's/ $//')\n echo \"Parameter string: $parameter_string\"\nelse\n echo \"No parameters passed\"\nfi\n\n\nCMD=\"argo submit -n $namespace --from workflowtemplate/$wkf_name $parameter_string $options -o name\"\necho \"Workflow Submit command: $CMD\"\n\nNAME=$($CMD)\nargo logs --follow $NAME\n\nPHASE=$(argo get $NAME -o json | jq -r '.status.phase')\n\nif [[ \"$PHASE\" == \"Succeeded\" ]]; then\n echo \"Workflow Succeeded.\"\n exit 0\nelif [[ \"$PHASE\" == \"Failed\" ]] || [[ \"$PHASE\" == \"Error\" ]]; then\n MESSAGE=$(argo get \"$NAME\" -o json | jq -r '.status.message')\n echo \"Workflow Phase: $PHASE.\"\n echo \"Message: $MESSAGE\"\n exit 1\nelse\n echo \"Workflow Phase: $PHASE (still running or unknown).\"\n exit 2\nfi" }, "Parameters": [ { @@ -56,8 +56,8 @@ ], "StepPackageId": "Octopus.KubernetesRunScript", "$Meta": { - "ExportedAt": "2026-03-10T15:15:54.763Z", - "OctopusVersion": "2026.2.742", + "ExportedAt": "2026-03-13T16:49:32.867Z", + "OctopusVersion": "2026.2.999", "Type": "ActionTemplate" }, "LastModifiedBy": "lrochette",