-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
tests: cleanup stale packet namespace automatically #10245
Conversation
Skipping CI for Draft Pull Request. |
6169511
to
9a5969f
Compare
d6cad80
to
8423a1a
Compare
Cancelled job on Gitlab can produce stale VMs as the delete playbook will never be executed. This commits allow removing old vms by getting all the namespace created from the same branch with an older pipeline id. Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>
This ensure that we don't have any packet namespace remaining for more than 2 hours. All the jobs complete usually within 30min-1hour so 2 hours is enough to detect a stale namespace. Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>
Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>
…packet vm Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @MrFreezeex
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: MrFreezeex, mzaian The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Thanks @MrFreezeex Nice PR. /lgtm |
…10245) * tests: cleanup stale packet namespace automatically Cancelled job on Gitlab can produce stale VMs as the delete playbook will never be executed. This commits allow removing old vms by getting all the namespace created from the same branch with an older pipeline id. Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * tests: cleanup stale packet namespace after 2 hours This ensure that we don't have any packet namespace remaining for more than 2 hours. All the jobs complete usually within 30min-1hour so 2 hours is enough to detect a stale namespace. Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * tests: ignore vm cleanup failure Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * tests: use pipeline_id var instead of fetching namespace for cleanup packet vm Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> --------- Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>
What type of PR is this?
/kind bug
What this PR does / why we need it:
Trying to automatically cleanup stale packet vms from Gitlab cancelled jobs with two different approaches:
Pushing to the same branch should make the previous pipeline cancelled and they appears as the same branch on GItlab. So if we have a namespace with the same branch and an older pipeline id we know that we can delete it. Note that we are doing that in the first place because Gitlab cannot execute any script after a job has been cancelled, so we would be left with vms/namespaces hanging in case of cancelled jobs...
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: