Skip to content

Restart a workflow from a numbered and/or named step #271

Closed

Description

Have a question? Please checkout our Slack Community or visit our Slack Archive.

Slack Community

Describe the Feature

We are starting to use workflows to apply a large number of components.

Given the size of a workflow, it is common for a step in the middle to fail due to user-error (copied the wrong command; missing command) or a configuration error for some step in the middle. Once corrected, it would be nice to restart the workflow from the failed step. This failed step may be a different number if the workflow steps were corrected.

It would be great to pass in an argument to the atmos workflow command (e.g. --from) that took a numbered or named step to start from. For example:

atmos workflow apply-all -f networking --from "terraform deploy tgw/spoke"
atmos workflow apply-all -f networking --from 5

Expected Behavior

Given a named --from argument:

atmos workflow apply-all -f networking --from "terraform deploy tgw/spoke"
  • (Happy path) When command is found by name, it starts the workflow from the command (inclusive).
  • When command is not found, it gives a helpful error message that the command is not found with exit code 1.
  • When multiple commands match, it fails with exit code 1 and suggests using the numeric form of --from. As a bonus, atmos could let you know the step numbers from the multiple matching steps.

Given a numbered --from argument:

atmos workflow apply-all -f networking --from 5
  • Steps are 1-indexed for humans (where --from 1 is the first step).
  • (Happy path) It starts the workflow from the indexed step (inclusive)
  • When the steps is out of range (0, large values) a helpful error message is printed with exit code 1.
  • Negative numbers are either disallowed or allow for reverse indexing from the end of the list.

Use Case

Use-cases include:

  • Sanity check components that have downstream updates (e.g. apply all 20 networking components in a specific order)
  • Recreate a cluster in a new region (create a cluster and apply all N common controllers)

Describe Ideal Solution

See above.

Alternatives Considered

Having to comment out steps and risk of accidentally committing.

Additional Context

Screen Shot 2022-12-05 at 11 12 21 AM

Other notes

--from could nicely mirror a --to step.

Activity

  1. osterman commented on Dec 5, 2022

    @osterman
    Member

    I like this proposal. Let's support an optional id to identify each step, and that the step # can also be used. Additionally, when a workflow is run, each step id should be emitted so the end user knows how to restart easily from any point.

    workflows:
      apply-all:
        steps:
        - id: deploy-vpc # alternative, this id defaults to "1", since it's the first step.
          command: terraform deploy vpc
          stack: core-use1-network
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions