@@ -10,7 +10,7 @@ if [ -f "$1" ]; then
1010 CR_TAG=$( jq -r ' .linux.compute_runtime.github_tag' $CONFIG_FILE )
1111 IGC_TAG=$( jq -r ' .linux.igc.github_tag' $CONFIG_FILE )
1212 CM_TAG=$( jq -r ' .linux.cm.github_tag' $CONFIG_FILE )
13- L0_TAG=$( jq -r ' .linux.level_zero.github_tag' $CONFIG_FILE )
13+ L0_TAG=$( jq -r ' .linux.level_zero.github_tag // .linux.level_zero.github_commit ' $CONFIG_FILE )
1414 TBB_TAG=$( jq -r ' .linux.tbb.github_tag' $CONFIG_FILE )
1515 FPGA_TAG=$( jq -r ' .linux.fpgaemu.github_tag' $CONFIG_FILE )
1616 CPU_TAG=$( jq -r ' .linux.oclcpu.github_tag' $CONFIG_FILE )
@@ -56,6 +56,43 @@ function get_pre_release_igfx() {
5656 unzip $HASH .zip && rm $HASH .zip
5757}
5858
59+ function get_commit_artifacts() {
60+ REPO=$1
61+ COMMIT=$2
62+ HEADER=" "
63+ if [ " $GITHUB_TOKEN " != " " ]; then
64+ HEADER=" Authorization: Bearer $GITHUB_TOKEN "
65+ fi
66+ # Get artifacts from GitHub Actions for the specific commit
67+ curl -s -L -H " $HEADER " -H " Accept: application/vnd.github.v3+json" \
68+ " https://api.github.com/repos/${REPO} /actions/runs?head_sha=${COMMIT} &status=completed&per_page=1" \
69+ | jq -r ' .workflow_runs[0] | select(.conclusion == "success") | .id' \
70+ | head -1 \
71+ | xargs -I {} curl -s -L -H " $HEADER " -H " Accept: application/vnd.github.v3+json" \
72+ " https://api.github.com/repos/${REPO} /actions/runs/{}/artifacts" \
73+ | jq -r ' .artifacts[] | select(.name | test(".*deb.*")) | .archive_download_url'
74+ }
75+
76+ function download_commit_artifacts() {
77+ REPO=$1
78+ COMMIT=$2
79+ UBUNTU_VER=$3
80+ HEADER=" "
81+ if [ " $GITHUB_TOKEN " != " " ]; then
82+ HEADER=" Authorization: Bearer $GITHUB_TOKEN "
83+ fi
84+
85+ echo " Downloading artifacts for commit $COMMIT from $REPO "
86+ get_commit_artifacts $REPO $COMMIT | while read -r artifact_url; do
87+ if [ -n " $artifact_url " ]; then
88+ echo " Downloading artifact: $artifact_url "
89+ curl -L -H " $HEADER " " $artifact_url " -o " artifact-$( basename $artifact_url ) .zip"
90+ unzip -j " artifact-$( basename $artifact_url ) .zip" " *.deb" 2> /dev/null || true
91+ rm " artifact-$( basename $artifact_url ) .zip"
92+ fi
93+ done
94+ }
95+
5996TBB_INSTALLED=false
6097
6198if [[ -v INSTALL_LOCATION ]]; then
@@ -96,6 +133,16 @@ CheckIGCdevTag() {
96133 fi
97134}
98135
136+ CheckIfCommitHash () {
137+ local arg=" $1 "
138+ # Check if it's a 40-character hex string (SHA-1 commit hash)
139+ if [[ $arg =~ ^[a-f0-9]{40}$ ]]; then
140+ echo " Yes"
141+ else
142+ echo " No"
143+ fi
144+ }
145+
99146InstallIGFX () {
100147 echo " Installing Intel Graphics driver..."
101148 echo " Compute Runtime version $CR_TAG "
@@ -122,9 +169,25 @@ InstallIGFX () {
122169 | grep " .*deb" \
123170 | grep -v " u18" \
124171 | wget -qi -
125- get_release oneapi-src/level-zero $L0_TAG \
126- | grep " .*$UBUNTU_VER .*deb$" \
127- | wget -qi -
172+
173+ # Check if L0_TAG is a commit hash or a regular tag
174+ IS_L0_COMMIT=$( CheckIfCommitHash $L0_TAG )
175+ if [ " $IS_L0_COMMIT " == " Yes" ]; then
176+ echo " Level Zero is using commit hash, attempting to download artifacts..."
177+ download_commit_artifacts oneapi-src/level-zero $L0_TAG $UBUNTU_VER
178+ # If no artifacts found, try direct source download
179+ if [ ! -f * .deb ] || [ $( ls -1 * .deb 2> /dev/null | wc -l) -eq 0 ]; then
180+ echo " No deb artifacts found for commit, downloading source..."
181+ curl -L " https://github.com/oneapi-src/level-zero/archive/$L0_TAG .tar.gz" -o level-zero-$L0_TAG .tar.gz
182+ # For now, skip building from source as it requires additional setup
183+ echo " WARNING: Level-zero source download completed but building from source is not implemented"
184+ echo " Please ensure level-zero packages are available or use a tagged release"
185+ fi
186+ else
187+ get_release oneapi-src/level-zero $L0_TAG \
188+ | grep " .*$UBUNTU_VER .*deb$" \
189+ | wget -qi -
190+ fi
128191 dpkg -i --force-all * .deb && rm * .deb * .sum
129192 mkdir -p /usr/local/lib/igc/
130193 echo " $IGC_TAG " > /usr/local/lib/igc/IGCTAG.txt
0 commit comments