Skip to content

Commit 111c5dd

Browse files
authored
feat(ci): add dockerfile_fragments.py to ci/generate_code.sh to ensure code is in sync (#1635)
1 parent 9af0111 commit 111c5dd

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

ci/generate_code.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env bash
22
set -Eeuxo pipefail
33

4+
python3 scripts/dockerfile_fragments.py
45
bash scripts/sync-requirements-txt.sh

jupyter/pytorch+llmcompressor/ubi9-python-3.11/Dockerfile.cuda

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ USER 1001
3030
# Install micropipenv to deploy packages from Pipfile.lock
3131
RUN pip install --no-cache-dir -U "micropipenv[toml]"
3232

33-
# Install the oc client
33+
# Install the oc client begin
3434
RUN curl -L https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/ocp/stable/openshift-client-linux.tar.gz \
3535
-o /tmp/openshift-client-linux.tar.gz && \
3636
tar -xzvf /tmp/openshift-client-linux.tar.gz oc && \
3737
rm -f /tmp/openshift-client-linux.tar.gz
38+
# Install the oc client end
3839

3940
####################
4041
# cuda-base #

runtimes/pytorch+llmcompressor/ubi9-python-3.11/Dockerfile.cuda

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ USER 1001
1717
# Install micropipenv to deploy packages from Pipfile.lock
1818
RUN pip install --no-cache-dir -U "micropipenv[toml]"
1919

20-
# Install the oc client
20+
# Install the oc client begin
2121
RUN curl -L https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/ocp/stable/openshift-client-linux.tar.gz \
2222
-o /tmp/openshift-client-linux.tar.gz && \
2323
tar -xzvf /tmp/openshift-client-linux.tar.gz oc && \
2424
rm -f /tmp/openshift-client-linux.tar.gz
25+
# Install the oc client end
2526

2627
####################
2728
# cuda-base #

scripts/dockerfile_fragments.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
import os
55
import textwrap
66
import pathlib
7+
from typing import TYPE_CHECKING
8+
9+
if TYPE_CHECKING:
10+
from pyfakefs.fake_filesystem import FakeFilesystem
711

812
ROOT_DIR = pathlib.Path(__file__).parent.parent
913

@@ -60,7 +64,7 @@ def blockinfile(filename: str | os.PathLike, contents: str, prefix: str | None =
6064
lines.extend(new_contents)
6165
lines.append(f"\n{end_marker}\n")
6266
else:
63-
lines[begin : end + 1] = [f"{begin_marker}\n", *new_contents, f"\n{end_marker}\n"]
67+
lines[begin: end + 1] = [f"{begin_marker}\n", *new_contents, f"\n{end_marker}\n"]
6468

6569
if lines == original_lines:
6670
return
@@ -73,8 +77,6 @@ def blockinfile(filename: str | os.PathLike, contents: str, prefix: str | None =
7377

7478

7579
class TestBlockinfile:
76-
from pyfakefs.fake_filesystem import FakeFilesystem
77-
7880
def test_adding_new_block(self, fs: FakeFilesystem):
7981
fs.create_file("/config.txt", contents="hello\nworld")
8082

0 commit comments

Comments
 (0)