Skip to content

Commit 3f3e6a9

Browse files
[CI] Improve devops/scripts/install_drivers.sh (#10960)
* Use GITHUB_TOKEN from env instead of passing via stdin * Exit on error * Use "set -x" to make logs more useful. Github replaces the token with '***' so no security issue here. It doesn't change the CI containers job yet, I plan to work on that in a separate PR (to avoid unnecessary pre-commit CI jobs)
1 parent 6746114 commit 3f3e6a9

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

.github/workflows/sycl_linux_run_tests.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,10 @@ jobs:
163163
git -C khronos_sycl_cts submodule update --init
164164
- name: Install drivers
165165
if: inputs.install_drivers == 'true'
166+
env:
167+
GITHUB_TOKEN: ${{ github.token }}
166168
run: |
167-
sudo apt install curl
168-
echo "$GITHUB_TOKEN" | sudo -E devops/scripts/install_drivers.sh llvm/devops/dependencies.json --all
169+
sudo -E bash devops/scripts/install_drivers.sh llvm/devops/dependencies.json --all
169170
- name: Source OneAPI TBB vars.sh
170171
shell: bash
171172
run: |

devops/scripts/install_drivers.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/bash
22

3+
set -e
4+
set -x
5+
36
if [ -f "$1" ]; then
47
# Read data from the dependencies.json passed as the first argument.
58
CONFIG_FILE=$1
@@ -20,20 +23,17 @@ else
2023
CPU_TAG=$cpu_tag
2124
fi
2225

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
29-
3026
function get_release() {
3127
REPO=$1
3228
TAG=$2
33-
URL="https://api.github.com/repos/${REPO}/releases/tags/${TAG}"
29+
if [ "$TAG" == "latest" ]; then
30+
URL="https://api.github.com/repos/${REPO}/releases/latest"
31+
else
32+
URL="https://api.github.com/repos/${REPO}/releases/tags/${TAG}"
33+
fi
3434
HEADER=""
35-
if [ "$TOKEN" != "" ]; then
36-
HEADER="Authorization: Bearer $TOKEN"
35+
if [ "$GITHUB_TOKEN" != "" ]; then
36+
HEADER="Authorization: Bearer $GITHUB_TOKEN"
3737
fi
3838
curl -s -L -H "$HEADER" $URL \
3939
| jq -r '. as $raw | try .assets[].browser_download_url catch error($raw)'

0 commit comments

Comments
 (0)