2023-06-26 15:57:08 +08:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: Fetch a list of namespaces
|
|
|
|
kubernetes.core.k8s_info:
|
|
|
|
api_version: v1
|
|
|
|
kind: Namespace
|
|
|
|
label_selectors:
|
|
|
|
- cijobs = true
|
2023-08-08 16:54:15 +08:00
|
|
|
- branch = {{ branch_name_sane }}
|
2023-06-26 15:57:08 +08:00
|
|
|
register: namespaces
|
|
|
|
|
|
|
|
- name: Delete older namespaces
|
|
|
|
command: "kubectl delete namespace {{ item.metadata.name }}"
|
|
|
|
failed_when: false
|
|
|
|
loop: "{{ namespaces.resources }}"
|
|
|
|
when:
|
|
|
|
- (item.metadata.labels.pipeline_id | int) < (pipeline_id | int)
|