Customize Argo Workflows

Start with a lab run and keep its workflow open in another tab. There are two places to configure. The argo-workflows chart values control the list view. The WorkflowTemplate defines run metadata, artifacts and approval parameters. The snippets below correspond to files in website/static/examples/eks-lab. Prepare the EKS lab.

Official WorkflowTemplate guide and Argo variable reference.

1. Show the stack and filter the list

In argo-values.yaml add a column using the label the controller already publishes. Four columns wrapped in the lab and older runs showed unknown. One column leaves room for the workflow name.

controller:
  columns:
  - name: Stack
    type: label
    key: iacstack.io/stack-name
helm upgrade argo-workflows argo-workflows --repo https://argoproj.github.io/argo-helm \
  --version 2.0.20 -n argo-workflows --reuse-values -f argo-values.yaml --wait

To filter by environment, engine and operation, find or edit the following under spec.workflowMetadata of the chosen WorkflowTemplate in rendered/workflows/direct.yaml or rendered/workflows/manual.yaml (direct or manual). The labels appear on new runs. Match the environment to the template profile. The direct SG template uses SANDBOX. The manual SG template uses PROD to demonstrate required approval fields. This is a label for the sample, not a production account.

spec:
  workflowMetadata:
    labels:
      experience.iacstack.io/environment: PROD
      experience.iacstack.io/engine: Terraform
    labelsFrom:
      experience.iacstack.io/operation:
        expression: "jsonpath(workflow.parameters.intent, '$.intent.operation')"
kubectl apply --dry-run=server -k rendered
kubectl apply -k rendered
# After submitting a new stack attempt:
kubectl -n argo-workflows get workflows -l 'experience.iacstack.io/environment=PROD,experience.iacstack.io/engine=Terraform' --show-labels

Use the same selector in the Argo Labels filter. Filtering by iacstack.io/stack-name finds every attempt for a stack. Match the name to status.execution.workflow before deciding.

2. Publish plan and policy reviews

To customize a report, follow the example: HTML placeholders → pipeline renderer → output artifact → Argo viewer. For example, @CREATE@ in reports/plan-review.html receives the count calculated by reports/report.jq, called by reports/render-report.sh. The step writes /tmp/plan-review.html; Argo uploads it to the artifact repository (S3 in the lab) and Argo Server makes it available in the UI. See Argo artifacts and artifact repository setup.

HTML reports are optional. The controller does not consume them; reviewers can use the native Plan log instead. In the EKS lab, open scripts/security-group-manual/plan.sh. It computes the SHA-256 of the saved plan and passes JSON and metadata to reports/render-report.sh. Kustomize packages reports/ in a ConfigMap that Argo mounts at /review. The jq filter selects and masks fields, escapes text and fills plan-review.html. Keep the binary plan private.

MODE=plan
FINGERPRINT=$(sha256sum /workspace/change.plan | cut -d ' ' -f1)
"$IAC_ENGINE" show -json /workspace/change.plan | bash /review/render-report.sh --arg mode "$MODE" --arg stack "$STACK" --arg environment "$ENVIRONMENT" --arg engine "$ENGINE_LABEL" \
  --arg version "$VERSION" --arg operation "$OPERATION" --arg execution "$WORKFLOW_UID" --arg revision "$REVISION" \
  --arg workflow "$WORKFLOW" --arg generated "$(date -u +%FT%TZ)" --arg fingerprint "$FINGERPRINT" \
  --arg policy_revision "${POLICY_REVISION:-}" > /tmp/plan-review.html

Under the producer’s outputs.artifacts, publish the file uncompressed. The key includes the UID so two attempts have separate reports. Only the OPA scenario produces a second report. In workflows/opa.yaml, the OPA decision arrives as a parameter to governance-review; the same renderer uses mode=policy. This step runs before manual-approval.

outputs:
  artifacts:
  - name: plan-review
    path: /tmp/plan-review.html
    archive:
      none: {}
    s3:
      key: artifacts/aws-sg/{{workflow.uid}}/plan-review.html
set -euo pipefail
MODE=policy
printf '"%s"' "$DECISION" | bash /review/render-report.sh --arg mode "$MODE" --arg stack "$STACK" --arg environment "$ENVIRONMENT" --arg engine "$ENGINE_LABEL" \
  --arg version "$VERSION" --arg operation "$OPERATION" --arg execution "$WORKFLOW_UID" --arg revision "$REVISION" \
  --arg workflow "$WORKFLOW" --arg generated "$(date -u +%FT%TZ)" --arg fingerprint "$FINGERPRINT" \
  --arg policy_revision "${POLICY_REVISION:-}" > /tmp/policy-review.html

The second artifact is named policy-review, reads /tmp/policy-review.html and uses artifacts/opa-aws/{{workflow.uid}}/policy-review.html. In Argo → node → Artifacts, open both and compare fingerprints. Plan review shows counts and selected attributes. The plan log holds the native diff. Policy review displays the aggregate decision and policy revision. For a 403 check the Argo Server reader identity and reader-permissions.json prefixes. Keep the HTML static and test in the authenticated iframe.

3. Build the approval form

Interactive parameters in Argo.

The manual and OPA labs both use an approval form. The snippet below is from workflows/steps/opa.yaml. In the manual lab, review only Plan Review and the full plan log.

Find approval under spec.templates. suspend opens the gate. Each input parameter creates a field in Modify parameters. Decision uses an enum for its choices. Change-Ticket and Review-Comments accept text. supplied exposes submitted values as outputs of the same name. Resume and OK are native Argo controls.

name: approval
suspend:
  duration: 24h
inputs:
  parameters:
  - name: Decision
    default: Reject
    enum:
    - Reject
    - Approve
    description: Review both reports and the full plan log. Approve requests authorization; Reject blocks apply. The recorded identity depends on the login method.
  - name: Change-Ticket
    default: ''
    description: 'PROD: required. Enter your change ticket identifier, for example CHG0001234. Maximum 64 characters.'
  - name: Review-Comments
    default: ''
    description: 'PROD: required. Explain the review in up to 1000 characters. Do not enter secrets.'
outputs:
  parameters:
  - name: Decision
    valueFrom:
      supplied: {}
      default: Reject
  - name: Change-Ticket
    valueFrom:
      supplied: {}
      default: ''
  - name: Review-Comments
    valueFrom:
      supplied: {}
      default: ''

SG approval form

4. Pass the decision to the pipeline

The snippet below is from workflows/opa.yaml. In the manual lab, the pause depends on whether the plan has changes, not on an OPA decision.

Under pipeline.steps the manual-approval step invokes the template. The authorize step receives the three outputs in arguments.parameters. The expression uses bracket notation for hyphenated step names, get for optional fields and fallback values when the gate was skipped.

name: authorize
templateRef:
  name: iacstack-governed-opa-aws-steps
  template: authorize
arguments:
  parameters:
  - name: approval
    value: '{{=steps.policy.outputs.result == ''RequireApproval'' ? (get(steps[''manual-approval''].outputs.parameters, ''Decision'') ?? ''Reject'') : ''Reject''}}'
  - name: change-ticket
    value: '{{=steps.policy.outputs.result == ''RequireApproval'' ? (get(steps[''manual-approval''].outputs.parameters, ''Change-Ticket'') ?? '''') : ''''}}'
  - name: review-comments
    value: '{{=steps.policy.outputs.result == ''RequireApproval'' ? (get(steps[''manual-approval''].outputs.parameters, ''Review-Comments'') ?? '''') : ''''}}'

In the receiving template declare the inputs and bind them to the script environment. Quote the variables in the shell. The full template also receives decision, token, stack and fingerprint.

name: authorize
inputs:
  parameters:
  - name: approval
  - name: change-ticket
  - name: review-comments
container:
  env:
  - name: APPROVAL
    value: '{{inputs.parameters.approval}}'
  - name: CHANGE_TICKET
    value: '{{inputs.parameters.change-ticket}}'
  - name: REVIEW_COMMENTS
    value: '{{inputs.parameters.review-comments}}'
jq -n --arg decision "$APPROVAL" --arg ticket "$CHANGE_TICKET" --arg comment "$REVIEW_COMMENTS" \
  '{decision:$decision, changeTicket:$ticket, reviewComments:$comment}'

The actual authorize validation runs after Resume. Reject produces Blocked/ApprovalRejected. In the PROD profile, Approve without a ticket or comment produces Blocked/InvalidApprovalParameters. Length limits are 64 and 1000 characters. After validation the pipeline requests authorization for the plan. Apply checks the fingerprint and claims authorization. The audit record includes the attempt, ticket and fingerprint. A comment or shared credential cannot establish individual identity.

Optional: verify the ticket in your ITSM. The lab checks that the field is present and within the length limit; it does not call an ITSM. To integrate yours, route the form’s Change-Ticket output to the change-ticket argument and read CHANGE_TICKET in a validation step. On the human approval path, use a workflow identity to look up the ticket. Check that it is approved and covers the target, environment and change window. If validation fails or the lookup is unavailable, block the run; do not request authorization or apply. For automatically approved runs, explicitly decide whether your policy permits skipping this check rather than passing an empty ticket.

Human approval in Argo records the reviewer’s decision. Controller authorization gates execution of the plan: after validation, the pipeline requests authorization and claims it before applying. Clicking Approve on the form does not authorize apply by itself.

To add another field, such as Cost-Center, add an input and supplied output on the gate, forward it in arguments.parameters, declare the input on authorize and bind it to COST_CENTER. Define validation there and include it in the audit JSON if required. Test a new attempt with a value, one without a value and an automatic run that skips the gate.