Skip to content

Commit efa7ca8

Browse files
committed
build(linux): pin builds to specific versions
1 parent dcacef7 commit efa7ca8

File tree

2 files changed

+11
-41
lines changed

2 files changed

+11
-41
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ jobs:
1616
steps:
1717
- name: Checkout
1818
uses: actions/checkout@v4
19-
with:
20-
fetch-depth: 0
21-
- name: Update
22-
run: |
23-
sudo apt-get update -yqq
24-
sudo apt-get install bc -yqq
2519
- name: Build Kernel
2620
run: |
21+
sudo apt-get update -yqq
2722
sudo bash build-kernel
2823
cp linux-msft-wsl-*/vmlinux .
2924
- name: Upload Kernel
3025
uses: actions/upload-artifact@v3
3126
with:
3227
name: vmlinux
3328
path: vmlinux
29+
- name: Release
30+
uses: softprops/action-gh-release@v1
31+
if: startsWith(github.ref, 'refs/tags/')
32+
with:
33+
files: vmlinux

build-kernel

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ build_pkgs_fn()
234234
echo 'Installing required apt packages'
235235
echo '=================================='
236236

237-
pkgs=(build-essential curl flex bison dwarves gcc g++ gcc-12 g++-12 jq libssl-dev libelf-dev)
237+
pkgs=(build-essential curl flex bison dwarves gcc g++ gcc-12 g++-12 jq libssl-dev libelf-dev bc)
238238

239239
for pkg in ${pkgs[@]}
240240
do
@@ -261,42 +261,12 @@ build_pkgs_fn()
261261
# install required apt packages
262262
build_pkgs_fn
263263

264-
git_1_fn()
265-
{
266-
# SCRAPE GITHUB WEBSITE FOR LATEST REPO VERSION
267-
gh_repo="$1"
268-
gh_url="$2"
269-
270-
if curl_cmd="$(curl -m '5' -sSL "https://api.github.com/repos/$gh_repo/$gh_url")"; then
271-
g_ver="$(echo "$curl_cmd" | jq -r '.[0].name')"
272-
g_ver="${g_ver##* }"
273-
g_url="$(echo "$curl_cmd" | jq -r '.[0].tarball_url')"
274-
fi
275-
}
276-
277-
git_ver_fn()
278-
{
279-
local gv_url v_flag v_tag v_url url_tag
280-
281-
v_url="$1"
282-
v_tag="$2"
283-
284-
if [ -n "$3" ]; then v_flag="$3"; fi
285-
286-
if [ "$v_flag" = 'T' ] && [ "$v_tag" = '1' ]; then
287-
url_tag='git_1_fn' gv_url='tags'
288-
elif [ "$v_flag" = 'R' ] && [ "$v_tag" = '1' ]; then
289-
url_tag='git_1_fn'; gv_url='releases'
290-
fi
291-
292-
"$url_tag" "$v_url" "$gv_url" 2>/dev/null
293-
}
264+
VERSION=5.15.123.1
294265

295-
git_ver_fn 'microsoft/WSL2-Linux-Kernel' '1' 'R'
296-
if build 'wsl2-linux-kernel' "$g_ver"; then
297-
download "$g_url" "$g_ver.tar.gz"
266+
if build 'wsl2-linux-kernel' "linux-msft-wsl-${VERSION}"; then
267+
download "https://api.github.com/repos/microsoft/WSL2-Linux-Kernel/tarball/linux-msft-wsl-${VERSION}" "linux-msft-wsl-${VERSION}.tar.gz"
298268
echo 'yes' | make KCONFIG_CONFIG=../config-wsl -j "$cpu_cores"
299-
build_done 'wsl2-linux-kernel' "$g_ver"
269+
build_done 'wsl2-linux-kernel' "linux-msft-wsl-${VERSION}"
300270
fi
301271

302272
exit_fn

0 commit comments

Comments
 (0)