Skip to content

Commit a3d10cf

Browse files
[CI] Use GITHUB_TOKEN for API requests during drivers install (#10947)
Unauthenticated API requests are limited at 60 per hour per IP address, use our GITHUB_TOKEN to avoid "HTTP Error 403: rate limit exceeded".
1 parent 056719d commit a3d10cf

File tree

3 files changed

+29
-11
lines changed

3 files changed

+29
-11
lines changed

.github/workflows/sycl_detect_changes.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ jobs:
5454
- devops/*/**
5555
drivers:
5656
- devops/dependencies.json
57+
- devops/scripts/install_drivers.sh
5758
5859
- name: Set output
5960
id: result

.github/workflows/sycl_linux_run_tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ jobs:
164164
- name: Install drivers
165165
if: inputs.install_drivers == 'true'
166166
run: |
167-
sudo cp devops/scripts/get_release.py /opt/
168-
sudo -E devops/scripts/install_drivers.sh llvm/devops/dependencies.json --all
167+
sudo apt install curl
168+
echo "$GITHUB_TOKEN" | sudo -E devops/scripts/install_drivers.sh llvm/devops/dependencies.json --all
169169
- name: Source OneAPI TBB vars.sh
170170
shell: bash
171171
run: |

devops/scripts/install_drivers.sh

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,26 @@ else
2020
CPU_TAG=$cpu_tag
2121
fi
2222

23-
TBB_INSTALLED=false
23+
if [ -t 0 ]; then
24+
# Interactive run (?), no token expected. Might be changed later.
25+
TOKEN=""
26+
else
27+
TOKEN=$(</dev/stdin)
28+
fi
2429

25-
LOCATION=$(dirname -- "$(readlink -f "${BASH_SOURCE}")")
30+
function get_release() {
31+
REPO=$1
32+
TAG=$2
33+
URL="https://api.github.com/repos/${REPO}/releases/tags/${TAG}"
34+
HEADER=""
35+
if [ "$TOKEN" != "" ]; then
36+
HEADER="Authorization: Bearer $TOKEN"
37+
fi
38+
curl -s -L -H "$HEADER" $URL \
39+
| jq -r '. as $raw | try .assets[].browser_download_url catch error($raw)'
40+
}
41+
42+
TBB_INSTALLED=false
2643

2744
if [[ -v INSTALL_LOCATION ]]; then
2845
INSTALL_LOCATION=$(realpath "$INSTALL_LOCATION")
@@ -38,7 +55,7 @@ InstallTBB () {
3855
cd $INSTALL_LOCATION
3956
echo "Installing TBB..."
4057
echo "TBB version $TBB_TAG"
41-
python3 $LOCATION/get_release.py oneapi-src/onetbb $TBB_TAG \
58+
get_release oneapi-src/onetbb $TBB_TAG \
4259
| grep -E ".*-lin.tgz" \
4360
| wget -qi -
4461
tar -xf *.tgz && rm *.tgz && mv oneapi-tbb-* oneapi-tbb
@@ -53,18 +70,18 @@ InstallIGFX () {
5370
echo "IGC version $IGC_TAG"
5471
echo "CM compiler version $CM_TAG"
5572
echo "Level Zero version $L0_TAG"
56-
python3 $LOCATION/get_release.py intel/intel-graphics-compiler $IGC_TAG \
73+
get_release intel/intel-graphics-compiler $IGC_TAG \
5774
| grep ".*deb" \
5875
| wget -qi -
59-
python3 $LOCATION/get_release.py intel/compute-runtime $CR_TAG \
76+
get_release intel/compute-runtime $CR_TAG \
6077
| grep -E ".*((deb)|(sum))" \
6178
| wget -qi -
6279
sha256sum -c *.sum && \
63-
python3 $LOCATION/get_release.py intel/cm-compiler $CM_TAG \
80+
get_release intel/cm-compiler $CM_TAG \
6481
| grep ".*deb" \
6582
| grep -v "u18" \
6683
| wget -qi -
67-
python3 $LOCATION/get_release.py oneapi-src/level-zero $L0_TAG \
84+
get_release oneapi-src/level-zero $L0_TAG \
6885
| grep ".*deb" \
6986
| wget -qi -
7087
dpkg -i *.deb && rm *.deb *.sum
@@ -79,7 +96,7 @@ InstallCPURT () {
7996
echo "$INSTALL_LOCATION/oclcpu exists and will be removed!"
8097
rm -Rf $INSTALL_LOCATION/oclcpu;
8198
fi
82-
python3 $LOCATION/get_release.py intel/llvm $CPU_TAG \
99+
get_release intel/llvm $CPU_TAG \
83100
| grep -E ".*oclcpuexp.*tar.gz" \
84101
| wget -qi -
85102
mkdir oclcpu && tar -xf *.tar.gz -C oclcpu && rm *.tar.gz
@@ -99,7 +116,7 @@ InstallFPGAEmu () {
99116
echo "$INSTALL_LOCATION/fpgaemu exists and will be removed!"
100117
rm -Rf $INSTALL_LOCATION/fpgaemu;
101118
fi
102-
python3 $LOCATION/get_release.py intel/llvm $FPGA_TAG \
119+
get_release intel/llvm $FPGA_TAG \
103120
| grep -E ".*fpgaemu.*tar.gz" \
104121
| wget -qi - && \
105122
mkdir fpgaemu && tar -xf *.tar.gz -C fpgaemu && rm *.tar.gz

0 commit comments

Comments
 (0)