This repository has been archived by the owner on Feb 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
generateDockerHubCommands.py
56 lines (48 loc) · 2.8 KB
/
generateDockerHubCommands.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import requests
import argparse
import json
import time
import threading
import sys
import datetime
def getConfig(config):
f = open(config, "r")
content = json.loads(f.read(), strict=False)
f.close()
return content
parser = argparse.ArgumentParser()
parser.add_argument('--newTag', "-t", help='new timestamp EG: 1906281234')
args = parser.parse_args()
if args.newTag == None:
tag = datetime.datetime.now().strftime("%y%m%d%H%M")
else:
tag = args.newTag
config = "blessedImageConfig-dev.json"
buildRequests = getConfig(config)
print("az login")
print("az acr login --name blimpacr")
for br in buildRequests:
print("docker pull blimpacr.azurecr.io/{}".format(br["outputImageName"]))
print("docker tag blimpacr.azurecr.io/{} appsvctest/{}:{}_{}".format(br["outputImageName"], br["stack"], br["version"], tag))
print("docker tag blimpacr.azurecr.io/{} appsvc/{}:{}_{}".format(br["outputImageName"], br["stack"], br["version"], tag))
print("docker push appsvctest/{}:{}_{}".format(br["stack"], br["version"], tag))
print("docker push appsvc/{}:{}_{}".format(br["stack"], br["version"], tag))
### LATEST / LTS ###
if br["version"] == "2.2":
print("docker pull blimpacr.azurecr.io/{}".format(br["outputImageName"]))
print("docker tag blimpacr.azurecr.io/{} appsvctest/{}:{}_{}".format(br["outputImageName"], br["stack"], "latest", tag))
print("docker tag blimpacr.azurecr.io/{} appsvctest/{}:{}".format(br["outputImageName"], br["stack"], "latest"))
print("docker tag blimpacr.azurecr.io/{} appsvctest/{}:{}_{}".format(br["outputImageName"], br["stack"], "lts", tag))
print("docker tag blimpacr.azurecr.io/{} appsvctest/{}:{}".format(br["outputImageName"], br["stack"], "lts"))
print("docker tag blimpacr.azurecr.io/{} appsvc/{}:{}_{}".format(br["outputImageName"], br["stack"], "latest", tag))
print("docker tag blimpacr.azurecr.io/{} appsvc/{}:{}".format(br["outputImageName"], br["stack"], "latest"))
print("docker tag blimpacr.azurecr.io/{} appsvc/{}:{}_{}".format(br["outputImageName"], br["stack"], "lts", tag))
print("docker tag blimpacr.azurecr.io/{} appsvc/{}:{}".format(br["outputImageName"], br["stack"], "lts"))
print("docker push appsvctest/{}:{}_{}".format(br["stack"], "latest", tag))
print("docker push appsvctest/{}:{}".format(br["stack"], "latest"))
print("docker push appsvctest/{}:{}_{}".format(br["stack"], "lts", tag))
print("docker push appsvctest/{}:{}".format(br["stack"], "lts"))
print("docker push appsvc/{}:{}_{}".format(br["stack"], "latest", tag))
print("docker push appsvc/{}:{}".format(br["stack"], "latest"))
print("docker push appsvc/{}:{}_{}".format(br["stack"], "lts", tag))
print("docker push appsvc/{}:{}".format(br["stack"], "lts"))