Destroy expired environments#84
Conversation
|
@leightjohnson93 this is because the GitHub Token cannot perform the environment deletion. It can only delete deployments. There is a comment in the code about that: |
|
@crohr So I don't understand, what's the point of having I think I meant to say instances and deployments instead. Could we just like, remove the label after ttl? |
What about the option to pass in our own github token with administrator permissions? |
|
Could we add a new YAML option to attempt the deletion of the environment because we provided our own Github Token? So:
There's already a YAML parameter This actions has steps to get a suitable token: |
| environment = PullPreview.octokit.list_environments(repo, per_page: 100).environments.find { |env| env.name.includes("gh-pr-#{pr.number}") } | ||
| if pr_issue.state == "closed" | ||
| PullPreview.logger.warn "[clear_dangling_deployments] Found dangling #{label} label for PR##{pr.number}. Cleaning up..." | ||
| destroy_environment(repo, environment) |
There was a problem hiding this comment.
this will already be called when setting the GitHub status to destroyed -
action/lib/pull_preview/github_sync.rb
Line 271 in bcdf816
Instances are destroyed with the TTL, but the GitHub environment object is not, since it requires permissions the GitHub context cannot have.
Yes, I will open a separate PR for that |
The scheduled job doesn't seem to actually be cleaning up the expired
environmentsinstances. It just logs a message.#83