Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

Commit ce6fae4

Browse files
committed
Use docker cli instead of Docker Hub v1 API
Docker Hub v1 API has been removed. See https://www.docker.com/blog/docker-hub-v1-api-deprecation/
1 parent d332ae2 commit ce6fae4

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

aws/hhvm1/lambdas/activities.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from urllib import request
1010

1111
import common
12-
12+
import subprocess
1313

1414
class Activity:
1515
# Subclasses must override these.
@@ -228,20 +228,18 @@ class PublishDockerImages(Activity):
228228
def task_env(self):
229229
return {'DOCKER_ONLY': '1'}
230230

231-
def docker_tags(self, repo):
232-
return {
233-
tag['name'] for tag in json.loads(
234-
request
235-
.urlopen(f'https://index.docker.io/v1/repositories/hhvm/{repo}/tags')
236-
.read()
237-
.decode('ascii')
238-
)
239-
}
231+
def is_docker_tag_absent(self, repo):
232+
docker_subprocess = subprocess.run(('docker', 'manifest', 'inspect', f'hhvm/hhvm:{self.version()}'), capture_output=True)
233+
if docker_subprocess.returncode == 1 and process.stderr.startswith(b'no such manifest'):
234+
return True
235+
else:
236+
docker_subprocess.check_returncode()
237+
return False
240238

241239
def should_run(self):
242240
return (
243-
self.version() not in self.docker_tags('hhvm') or
244-
self.version() not in self.docker_tags('hhvm-proxygen')
241+
self.is_docker_tag_absent('hhvm') or
242+
self.is_docker_tag_absent('hhvm-proxygen')
245243
)
246244

247245

0 commit comments

Comments
 (0)