Skip to content

Delete environment mutation

Hunter Stewart requested to merge hustewart-add-delete-env-mutation into master

Why

See GraphQL Mutation: Stop and Delete Environment (#388206 - closed) for more context

What

  • add a new graphQL mutation to destroy an environment
  • a new delete service

Local test

You'll need an Environment (I just used Environment.last)

  • start gdk
  • bundle exec rails c
  • e = Environment.last
  • e.state
  • Make sure environment state is already stopped (otherwise policy prevents deleting)
  • copy e.id
  • go to https://gdk.test:3443/-/graphql-explorer or wherever your graphiql is
  • run something like
mutation {
  environmentDelete(input: { id: "gid://gitlab/Environment/19"}) {
    errors
  }
}

you should see an output like

{
  "data": {
    "environmentDelete": {
      "errors": []
    }
  }
}

verify environment is destroyed

Edited by Hunter Stewart

Merge request reports

Loading