Skip to content

Commit d392015

Browse files
rnavmpe
authored andcommitted
build: Symlink to the latest build
With numerous build options, it is not always easy to guess/remember the output directory for the most recent build. Have the scripts add a symlink with the name latest-[build type] (latest-kernel, latest-selftests, latest-perf) pointing to the last successful build in the $CI_OUTPUT directory. This makes it very easy to refer to artifacts from the most recent build.
1 parent 6e4c334 commit d392015

3 files changed

Lines changed: 23 additions & 3 deletions

File tree

build/scripts/build.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ if [[ -n $TARGETS ]]; then
164164
cmd+="-e TARGETS=$TARGETS "
165165
fi
166166

167-
output_dir=$(get_output_dir "$script_base" "$subarch" "$distro" "$version" "$task" "$DEFCONFIG" "$TARGETS" "$CLANG")
167+
output_dir=$(get_output_dir "$script_base" "$subarch" "$distro" "$version" "$task" "$DEFCONFIG" "$TARGETS" "$CLANG" "")
168+
output_symlink=$(get_output_dir "$script_base" "$subarch" "$distro" "$version" "$task" "$DEFCONFIG" "$TARGETS" "$CLANG" "symlink")
168169
mkdir -p "$output_dir" || exit 1
169170

170171
cmd+="-v $output_dir:/output:rw "
@@ -202,4 +203,10 @@ cmd+="/bin/container-build.sh $task"
202203

203204
(set -x; $cmd)
204205

205-
exit $?
206+
ret=$?
207+
if [[ $ret -eq 0 && -n "$output_symlink" ]]; then
208+
rm -f $output_symlink
209+
ln -s $output_dir $output_symlink
210+
fi
211+
212+
exit $ret

build/scripts/clean.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ script_base="$(realpath "$dir")"
1111

1212
IFS=@ read -r task subarch distro version <<< "$1"
1313

14-
output_dir=$(get_output_dir "$script_base" "$subarch" "$distro" "$version" "$task" "$DEFCONFIG" "$TARGETS" "$CLANG")
14+
output_dir=$(get_output_dir "$script_base" "$subarch" "$distro" "$version" "$task" "$DEFCONFIG" "$TARGETS" "$CLANG" "")
1515

1616
(set -x ; rm -rf "$output_dir")

build/scripts/lib.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ function get_output_dir()
2525
local defconfig="$6"
2626
local targets="$7"
2727
local clang="$8"
28+
local symlink="$9"
2829
local d
2930

3031
if [[ -z "$script_base" || -z "$subarch" || -z "$distro" ]]; then
@@ -41,6 +42,10 @@ function get_output_dir()
4142
case "$task" in
4243
kernel) ;&
4344
clean-kernel)
45+
if [[ -n "$symlink" ]]; then
46+
echo "$d/latest-kernel"
47+
return 0
48+
fi
4449
if [[ -n "$defconfig" ]]; then
4550
defconfig="${defconfig//\//_}"
4651
d="$d/$defconfig"
@@ -49,6 +54,10 @@ function get_output_dir()
4954
ppctests) ;&
5055
selftests) ;&
5156
clean-selftests)
57+
if [[ -n "$symlink" ]]; then
58+
echo "$d/latest-selftests"
59+
return 0
60+
fi
5261
if [[ -n "$targets" ]]; then
5362
targets=${targets// /_}
5463
targets=${targets//\//_}
@@ -59,6 +68,10 @@ function get_output_dir()
5968
;;
6069
perf) ;&
6170
clean-perf)
71+
if [[ -n "$symlink" ]]; then
72+
echo "$d/latest-perf"
73+
return 0
74+
fi
6275
d="$d/perf"
6376
;;
6477
esac

0 commit comments

Comments
 (0)