Skip to content

Commit 9480738

Browse files
authored
[CI]: Avoid passing large number of args to dockerfile (#13273)
This is a refactor to avoid passing large number of ARGs when building docker image.
1 parent c5b174d commit 9480738

File tree

3 files changed

+21
-33
lines changed

3 files changed

+21
-33
lines changed

.github/workflows/sycl-containers.yaml

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,6 @@ jobs:
8181
uses: actions/checkout@v4
8282
with:
8383
fetch-depth: 2
84-
- name: Get dependencies configuration
85-
id: deps
86-
run: |
87-
DEPS=`cat devops/dependencies.json`
88-
DEPS="${DEPS//$'\r'/''}"
89-
DEPS="${DEPS//$'\n'/' '}"
90-
echo $DEPS
91-
echo "deps=$DEPS" >>$GITHUB_OUTPUT
9284
- name: Build and Push Container
9385
uses: ./devops/actions/build_container
9486
with:
@@ -100,13 +92,7 @@ jobs:
10092
ghcr.io/${{ github.repository }}/ubuntu2204_intel_drivers:latest-${{ github.sha }}
10193
ghcr.io/${{ github.repository }}/ubuntu2204_intel_drivers:latest
10294
build-args: |
103-
compute_runtime_tag=${{fromJson(steps.deps.outputs.deps).linux.compute_runtime.github_tag}}
104-
igc_tag=${{fromJson(steps.deps.outputs.deps).linux.igc.github_tag}}
105-
cm_tag=${{fromJson(steps.deps.outputs.deps).linux.cm.github_tag}}
106-
level_zero_tag=${{fromJson(steps.deps.outputs.deps).linux.level_zero.github_tag}}
107-
tbb_tag=${{fromJson(steps.deps.outputs.deps).linux.tbb.github_tag}}
108-
fpgaemu_tag=${{fromJson(steps.deps.outputs.deps).linux.fpgaemu.github_tag}}
109-
cpu_tag=${{fromJson(steps.deps.outputs.deps).linux.oclcpu.github_tag}}
95+
use_latest=false
11096
# This job produces a Docker container with the latest versions of Intel
11197
# drivers, that can be found on GitHub.
11298
drivers_image_ubuntu2204_unstable:
@@ -121,14 +107,6 @@ jobs:
121107
uses: actions/checkout@v4
122108
with:
123109
fetch-depth: 2
124-
- name: Get dependencies configuration
125-
id: deps
126-
run: |
127-
DEPS=`cat devops/dependencies.json`
128-
DEPS="${DEPS//$'\r'/''}"
129-
DEPS="${DEPS//$'\n'/' '}"
130-
echo $DEPS
131-
echo "deps=$DEPS" >>$GITHUB_OUTPUT
132110
- name: Build and Push Container
133111
uses: ./devops/actions/build_container
134112
with:
@@ -139,5 +117,5 @@ jobs:
139117
tags: |
140118
ghcr.io/${{ github.repository }}/ubuntu2204_intel_drivers:unstable-${{ github.sha }}
141119
ghcr.io/${{ github.repository }}/ubuntu2204_intel_drivers:unstable
142-
# build-args:empty, so we automatically take the "latest" tags as
143-
# unstable
120+
build-args: |
121+
use_latest=true

devops/containers/ubuntu2204_intel_drivers.Dockerfile

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,23 @@ FROM $base_image:$base_tag
55

66
ENV DEBIAN_FRONTEND=noninteractive
77

8-
ARG compute_runtime_tag=latest
9-
ARG igc_tag=latest
10-
ARG cm_tag=latest
11-
ARG level_zero_tag=latest
12-
ARG tbb_tag=latest
13-
ARG fpgaemu_tag=latest
14-
ARG cpu_tag=latest
8+
ARG use_latest=true
159

1610
RUN apt update && apt install -yqq wget
1711

1812
COPY scripts/get_release.py /
1913
COPY scripts/install_drivers.sh /
14+
COPY dependencies.json /
2015

2116
RUN mkdir /runtimes
2217
ENV INSTALL_LOCATION=/runtimes
23-
RUN --mount=type=secret,id=github_token GITHUB_TOKEN=$(cat /run/secrets/github_token) /install_drivers.sh --all
18+
RUN --mount=type=secret,id=github_token \
19+
if [ "$use_latest" = "true" ]; then \
20+
install_driver_opt=" --use-latest"; \
21+
else \
22+
install_driver_opt=" dependencies.json"; \
23+
fi && \
24+
GITHUB_TOKEN=$(cat /run/secrets/github_token) /install_drivers.sh $install_driver_opt --all
2425

2526
COPY scripts/drivers_entrypoint.sh /drivers_entrypoint.sh
2627

devops/scripts/install_drivers.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ if [ -f "$1" ]; then
1313
TBB_TAG=$(jq -r '.linux.tbb.github_tag' $CONFIG_FILE)
1414
FPGA_TAG=$(jq -r '.linux.fpgaemu.github_tag' $CONFIG_FILE)
1515
CPU_TAG=$(jq -r '.linux.oclcpu.github_tag' $CONFIG_FILE)
16+
elif [[ "$*" == *"--use-latest"* ]]; then
17+
CR_TAG=latest
18+
IGC_TAG=latest
19+
CM_TAG=latest
20+
L0_TAG=latest
21+
TBB_TAG=latest
22+
FPGA_TAG=latest
23+
CPU_TAG=latest
1624
else
1725
CR_TAG=$compute_runtime_tag
1826
IGC_TAG=$igc_tag
@@ -133,6 +141,7 @@ if [[ $# -eq 0 ]] ; then
133141
echo "--igfx - Install Intel Graphics drivers"
134142
echo "--cpu - Install Intel CPU OpenCL runtime"
135143
echo "--fpga-emu - Install Intel FPGA Fast emulator"
144+
echo "--use-latest - Use latest for all tags"
136145
echo "Set INSTALL_LOCATION env variable to specify install location"
137146
exit 0
138147
fi

0 commit comments

Comments
 (0)