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

Get so i can depend on a destroy #6

Closed
squeedee opened this issue Sep 30, 2016 · 3 comments
Closed

Get so i can depend on a destroy #6

squeedee opened this issue Sep 30, 2016 · 3 comments
Labels

Comments

@squeedee
Copy link

In my pipeline, i want to ensure the stack is removed before redeploying it, i'd like something like:

  - name: purge-previous-deployment
    plan:
      - get: environment
        trigger: true
        passed: [claim-environment]
      - get: appdog-ci
      - put: opsman-terraform
        params:
          action: destroy
          env_name: {{environment-name}}
        get_params:
          action: destroy

  - name: create-deployment
    plan:
      - get: opsman-terraform
        trigger: true
        passed: [purge-previous-deployment]
      - get: appdog-ci
      - put: opsman-terraform
        params:
          env_name: {{environment-name}}
@ljfranklin
Copy link
Owner

@squeedee After thinking about it for a bit, I think this can be done by adding a "destroyed" field to the version:

type Version struct {
    LastModified string `json:"last_modified"`
    EnvName      string `json:"env_name"`
    Destroyed    bool   `json:"destroyed"`
}

This way the get knows to no-op if it's been told to fetch a destroyed environment, but can still error if it's been told to fetch an environment that never existed or was destroyed out of band.

In the meantime, you can workaround this by doing the destroy and create in the same job:

- name: create-deployment
  plan:
    - get: environment
       trigger: true
       passed: [claim-environment]
    - put: opsman-terraform
      params:
        action: destroy
        env_name: {{environment-name}}
      get_params:
        action: destroy
    - get: appdog-ci
    - put: opsman-terraform
      params:
        env_name: {{environment-name}}

@ljfranklin
Copy link
Owner

@squeedee still thinking about this, but I'm leaning towards waiting until Concourse resource delete actions become a first-class thing. There's a long thread around overhauling the resource interface that discusses delete among other things: concourse/concourse#534.

I already hacked around the lack of a delete with put.get_params.action: delete. I feel like adding a new version on delete might be a step in the wrong direction long-term. Interested to hear what others think though.

@ljfranklin
Copy link
Owner

@squeedee Going to close this out as won't fix for now. Once Concourse adds an actual delete call (concourse/concourse#534) you won't be able to trigger off a delete as it actually deletes a set of versions rather than adding a new "deleted" version.

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

No branches or pull requests

2 participants