-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: append grader to image tag for build
Docker does not allow setting the image repository (essentially, a tag) as a 64-byte SHA Sum string.
- Loading branch information
1 parent
a9b84f4
commit bd82c58
Showing
3 changed files
with
26 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
import subprocess | ||
from typing import List | ||
|
||
|
||
def does_image_exist_locally(container_sha: str) -> bool: | ||
program_args = [ | ||
"docker", | ||
"image", | ||
"ls", | ||
"--format", | ||
"{{.Repository}}" | ||
] | ||
proc_res = subprocess.run(program_args, capture_output=True, check=True) | ||
image_names = proc_res.stdout.decode().split('\n')[:-1] | ||
return container_sha in image_names | ||
program_args = [ | ||
"docker", | ||
"image", | ||
"ls", | ||
"--format", | ||
"{{.Repository}}" | ||
] | ||
proc_res = subprocess.run(program_args, capture_output=True, check=True) | ||
image_names = proc_res.stdout.decode().split('\n')[:-1] | ||
return f"grader-{container_sha}" in image_names | ||
|
||
|
||
def get_all_docker_images() -> List[str]: | ||
res = subprocess.run(["docker", "image", "ls", "--format", "{{.Repository}}"], | ||
capture_output=True) | ||
output = res.stdout.decode() | ||
image_names = output.split('\n')[:-1] | ||
return image_names | ||
|
||
res = subprocess.run(["docker", "image", "ls", "--format", "{{.Repository}}"], | ||
capture_output=True) | ||
output = res.stdout.decode() | ||
image_names = output.split('\n')[:-1] | ||
return image_names |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters