Created
November 25, 2019 18:41
-
-
Save petr-muller/8515e25509c5d3ec2fae64e3efe1d85d to your computer and use it in GitHub Desktop.
manual job pruner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import yaml | |
| import sys | |
| with open(sys.argv[1]) as f: | |
| all = yaml.full_load(f) | |
| for t in ("presubmits", "postsubmits"): | |
| if t not in all: | |
| continue | |
| for repo in all[t]: | |
| pruned = [] | |
| for job in all[t][repo]: | |
| if "labels" in job and "ci-operator.openshift.io/prowgen-controlled" in job["labels"] and job["labels"]["ci-operator.openshift.io/prowgen-controlled"] == "true": | |
| pruned.append(job) | |
| all[t][repo] = pruned | |
| with open(sys.argv[1], 'w') as f: | |
| yaml.dump(all, f, default_flow_style=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment