Skip to content
This repository was archived by the owner on Mar 24, 2022. It is now read-only.

Commit 05c096f

Browse files
committed
Fix missing tagger folder
1 parent a6aeddc commit 05c096f

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Concourse Pipeline Tagger
2+
3+
Tags every item in a plan with a given tag name
4+
```
5+
cat pipeline.yml | ./tagger.py remote-worker
6+
```
7+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env python3
2+
3+
import yaml
4+
import sys
5+
6+
def process_job(job):
7+
for item in job['plan']:
8+
process_item(item)
9+
10+
def process_item(item):
11+
if "aggregate" in item:
12+
for sub_item in item["aggregate"]:
13+
process_item(sub_item)
14+
else:
15+
try:
16+
item["tags"] = [sys.argv[1]]
17+
except:
18+
print("Couldn't tag item", item)
19+
20+
if __name__ == "__main__":
21+
pipeline = yaml.safe_load(sys.stdin.read())
22+
for job in pipeline['jobs']:
23+
process_job(job)
24+
print(yaml.dump(pipeline))
25+
26+

0 commit comments

Comments
 (0)