also deploy images with 'latest' tag
import shutil
import json
import os
+import copy
def main():
shutil.copyfile('/generator/infrabox.json', '/infrabox/output/infrabox.json')
@@ -13,8 +14,25 @@ def main():
tag = os.environ.get('INFRABOX_GIT_TAG', None)
if tag:
for j in deployments['jobs']:
- for d in j.get('deployments', []):
- d['tag'] = tag
+ deps = j.get('deployments', [])
+
+ if not deps:
+ continue
+
+ new_deps = []
+
+ for d in deps:
+ new_dep_tag = copy.deepcopy(d)
+ new_dep_latest = copy.deepcopy(d)
+
+ new_dep_tag['tag'] = tag
+ new_dep_latest['tag'] = 'latest'
+
+ new_deps.append(d)
+ new_deps.append(new_dep_tag)
+ new_deps.append(new_dep_latest)
+
+ j['deployments'] = new_deps
with open('/infrabox/output/deployments.json', 'w') as out:
print json.dumps(deployments, indent=4)
