-
Notifications
You must be signed in to change notification settings - Fork 626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define CUDA versions for workflows centrally #1052
base: main
Are you sure you want to change the base?
Conversation
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shell script heebie-jeebies within 😁
scripts/get_docker_info.sh
Outdated
#!/bin/sh | ||
|
||
version_only= | ||
if [ "$1" = "-v" ]; then | ||
version_only=1 | ||
shift 1 | ||
fi | ||
|
||
dockerfile=$1 | ||
shift 1 | ||
|
||
if [ ! -f $dockerfile ]; then | ||
echo "Dockerfile not found" >> /dev/stderr | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$1" ]; then | ||
echo "No target specified" >> /dev/stderr | ||
exit 1 | ||
fi | ||
|
||
tag=$(grep "AS $1\$" $dockerfile | sed -e 's/FROM *//' -e 's/ *AS .*//') | ||
if [ -z "$tag" ]; then | ||
echo "Target $1 not defined" >> /dev/stderr | ||
exit 1 | ||
fi | ||
if [ "$version_only" = "1" ]; then | ||
echo $tag | sed -e 's/.*://' | ||
else | ||
echo $tag | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😳 Could we write this in Python, pretty please? 😂
Something like
import argparse
import re
from_line_re = re.compile(r"FROM\s+(?P<image>\S+)\s+AS\s+(?P<target>\S+)")
def find_image_in_dockerfile(dockerfile, target):
with open(dockerfile) as f:
for line in f.readlines():
if (m := from_line_re.match(line)) and m.group("target") == target:
return m.group("image")
raise ValueError(f"Target {target} not defined in {dockerfile}")
def main():
ap = argparse.ArgumentParser()
ap.add_argument("dockerfile", required=True)
ap.add_argument("target", required=True)
ap.add_argument("-v", "--version-only", action="store_true")
args = ap.parse_args()
image = find_image_in_dockerfile(args.dockerfile, args.target)
if args.version_only:
image = image.rpartition(":")[-1]
print(image)
, I think...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No objection from me 😃 I just took this script off my library of useful stuff TBH
9b72679
to
7800734
Compare
This PR defines CUDA versions to be built in workflows centrally.
It uses a Dockerfile as a source of truth, as this can be updated automatically by Dependabot.
Currently, the Dockerfile is not used for building the compiler images, but we could do this in the future if we want to speed up buiilds (by caching on ghcr.io and e.g stripping static libs that we don't use, as they constitute about 50% of the image size), but the bottleneck is Windows anyway so this is not critical at the moment