-
Notifications
You must be signed in to change notification settings - Fork 688
/
release-wait-for-ga-image
executable file
·51 lines (41 loc) · 1.67 KB
/
release-wait-for-ga-image
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
#!/usr/bin/env python3
"""Waits for ga docker image
"""
import argparse
import http.client
import sys
import time
import subprocess
import fileinput
from lib import ansiterm
def check_docker(image: str) -> bool:
p = subprocess.run(["docker", "pull", image], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return p.returncode == 0
def main(ga_tag: str, release_registry: str, image_name: str) -> int:
image = f"{release_registry}/{image_name}:{ga_tag}"
print(f"{ansiterm.sgr.bold.fg_cyn}==> Waiting for GA image {image}")
print(f" Check Circle CI if you would like to check progress:")
print(f" https://app.circleci.com/pipelines/github/emissary-ingress/emissary")
print(f" The 'OSS: GA Release' workflow for tag {ga_tag} should create these artifacts.{ansiterm.sgr.reset}")
docker_found = False
while not docker_found:
if check_docker(image):
print(f"==> {ansiterm.sgr.bold.fg_grn}Image {image} found!{ansiterm.sgr}")
docker_found = True
else:
print(f" {ansiterm.sgr.fg_red}Image {image} not found, sleeping before trying again.{ansiterm.sgr}")
time.sleep(30)
if not docker_found:
return 1
return 0
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Wait for commit to show up in s3')
parser.add_argument('--ga-tag', required=True)
parser.add_argument('--release-registry', default="docker.io/datawire")
parser.add_argument('--image-name', default="emissary")
args = parser.parse_args()
sys.exit(main(
ga_tag=args.ga_tag,
release_registry=args.release_registry,
image_name=args.image_name,
))