Skip to content

Instantly share code, notes, and snippets.

@petr-muller
Created November 25, 2019 18:41
Show Gist options
  • Select an option

  • Save petr-muller/8515e25509c5d3ec2fae64e3efe1d85d to your computer and use it in GitHub Desktop.

Select an option

Save petr-muller/8515e25509c5d3ec2fae64e3efe1d85d to your computer and use it in GitHub Desktop.
manual job pruner
#!/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