Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workflow can't be recovered if delete or replace action fails. #280

Open
sshyub opened this issue Apr 24, 2020 · 0 comments
Open

workflow can't be recovered if delete or replace action fails. #280

sshyub opened this issue Apr 24, 2020 · 0 comments

Comments

@sshyub
Copy link

sshyub commented Apr 24, 2020

Describe the bug
workflow can't be recovered if delete or replace action fails.

To Reproduce
Given the example that has verify, push, commit, reset stages, workflow can be recovered in the following cases:

  • verify (create) -> reset (delete)
  • verify (create) -> push (update)-> reset (delete)

but workflow can't be recovered if one of the actions in commit stage fails.

resource-name: "workflow-dns-example"

google::dns-managed-zone workflow-dns-public-managed-zone-example
    name: $(resource-name)
    description: "workflow dns Public Managed Zone Example"
    dns-name: "wde.example.com."

    dnssec-config
        state: "on"
    end
end

google::dns-managed-zone workflow-dns-public-managed-zone-example-2
    name: "workflow-dns-public-managed-zone-example-2"
    description: "workflow dns Public Managed Zone Example 2"
    dns-name: "wp2.example.com."

    dnssec-config
        state: "on"
    end
end

@workflow::define google::dns-managed-zone replace-dns-managed-zone

    stage verify
        confirm-diff: true

        @workflow::create google::dns-managed-zone workflow-dns-public-managed-zone-example-verify
            @extends: $(PENDING)
            name: $(resource-name)
        @end

        @workflow::create google::dns-managed-zone workflow-dns-public-managed-zone-example-bar
            @extends: $(google::dns-managed-zone workflow-dns-public-managed-zone-example-2)
            name: "workflow-dns-public-managed-zone-example-bar"
            description: "Workflow DNS Public Managed Zone Example bar"
            dns-name: "p-bar.example.com."
        @end

        @workflow::create google::dns-managed-zone workflow-dns-public-managed-zone-example-foo
            @extends: $(google::dns-managed-zone workflow-dns-public-managed-zone-example)
            name: "workflow-dns-public-managed-zone-example-foo"
            description: "Workflow DNS Public Managed Zone Example foo"
            dns-name: "p-foo.example.com."
        @end

        transition push
            to: push
            description: "Push."
        end

        transition reset
            to: reset
            description: "Reset."
        end

    end

    stage push
        confirm-diff: true

        @workflow::update $(google::dns-managed-zone workflow-dns-public-managed-zone-example-bar)
            description: $(google::dns-managed-zone workflow-dns-public-managed-zone-example-foo).name
        @end

        @workflow::update $(google::dns-managed-zone workflow-dns-public-managed-zone-example-foo)
            description: $(google::dns-managed-zone workflow-dns-public-managed-zone-example).name
        @end

        transition revert
            to: verify
            description: 'Revert.'
        end

        transition commit
            to: commit-first
            description: "Commit."
        end
    end

    stage commit-first
        @workflow::delete: $(google::dns-managed-zone workflow-dns-public-managed-zone-example-bar)

        transition done
            to: commit-second
            description: 'Next.'
        end

    end

    stage commit-second
        confirm-diff: true

        @workflow::replace: $(google::dns-managed-zone workflow-dns-public-managed-zone-example) $(google::dns-managed-zone workflow-dns-public-managed-zone-example-verify)

        transition done
            to: commit
            description: 'Done.'
        end

    end

    stage commit
        confirm-diff: true

        @workflow::delete: $(google::dns-managed-zone workflow-dns-public-managed-zone-example-foo)

    end

    stage reset
        @workflow::delete: $(google::dns-managed-zone workflow-dns-public-managed-zone-example-foo)
        @workflow::delete: $(google::dns-managed-zone workflow-dns-public-managed-zone-example-bar)
        @workflow::delete: $(google::dns-managed-zone workflow-dns-public-managed-zone-example-verify)
    end
@end

Expected behavior
Workflow should continue where it left off.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant