Skip to content

Commit f320ca9

Browse files
authored
ci: switch to kas-container (#846)
Doing the build with kas-container will satisfy our requirements as it has most of the necessary tools. This container was created especially to do yocto build and it already has a good community of users who use it. Its development is quite active and has a significant group of contributors. This would also make things easier for our customers and end users as they would only have to install docker or podman on their machines to replicate what we do on our ci builds. Inside the kas-container the directory tree is the following: `/repo` is the meta-qcom layer `/work` is the work directory with all the other layer, bitbake and also the build dir: ``` /work ├── bitbake ├── build ├── meta-yocto └── oe-core ``` When the KAS_WORK_DIR is not defined the `/repo` and `/work` have the same content.
2 parents 1ff122e + 8091bc5 commit f320ca9

File tree

4 files changed

+45
-12
lines changed

4 files changed

+45
-12
lines changed

.github/workflows/build-yocto.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,19 @@ on:
1010
env:
1111
CACHE_DIR: /srv/gh-runners/quic-yocto
1212
KAS_REPO_REF_DIR: /srv/gh-runners/quic-yocto/kas-mirrors
13+
KAS_CONTAINER: /srv/gh-runners/quic-yocto/kas-mirrors/kas-container
1314

1415
jobs:
1516
kas-setup:
1617
if: github.repository == 'qualcomm-linux/meta-qcom'
1718
runs-on: [self-hosted, x86]
1819
steps:
20+
- name: Update kas-container
21+
run: |
22+
LATEST=$(git ls-remote --tags --refs --sort="v:refname" https://github.com/siemens/kas | tail -n1 | sed 's/.*\///')
23+
wget -qO ${KAS_CONTAINER} https://raw.githubusercontent.com/siemens/kas/refs/tags/$LATEST/kas-container
24+
chmod +x ${KAS_CONTAINER}
25+
1926
- name: Update kas mirrors
2027
run: |
2128
for r in $(find ${KAS_REPO_REF_DIR}/* -maxdepth 0 -type d); do
@@ -29,7 +36,7 @@ jobs:
2936

3037
- name: Run kas lock
3138
run: |
32-
kas dump --update --lock --inplace ci/base.yml
39+
${KAS_CONTAINER} dump --update --lock --inplace ci/base.yml
3340
3441
- uses: actions/upload-artifact@v4
3542
with:
@@ -52,7 +59,7 @@ jobs:
5259

5360
- name: Run yocto-check-layer
5461
run: |
55-
ci/kas-shell-helper.sh ci/yocto-check-layer.sh
62+
ci/kas-container-shell-helper.sh ci/yocto-check-layer.sh
5663
5764
yocto-patchreview:
5865
needs: kas-setup
@@ -70,7 +77,7 @@ jobs:
7077

7178
- name: Run Yocto patchreview
7279
run: |
73-
ci/kas-shell-helper.sh ci/yocto-patchreview.sh
80+
ci/kas-container-shell-helper.sh ci/yocto-patchreview.sh
7481
7582
compile:
7683
needs: kas-setup
@@ -107,14 +114,14 @@ jobs:
107114
export SSTATE_DIR=${CACHE_DIR}/sstate-cache
108115
export KAS_WORK_DIR=$PWD/../kas
109116
mkdir $KAS_WORK_DIR
110-
kas dump --resolve-env --resolve-local --resolve-refs \
117+
${KAS_CONTAINER} dump --resolve-env --resolve-local --resolve-refs \
111118
ci/mirror.yml:ci/${{ matrix.machine }}.yml > kas-build.yml
112-
kas build ci/mirror.yml:ci/${{ matrix.machine }}.yml
113-
ci/kas-shell-helper.sh ci/yocto-pybootchartgui.sh
119+
${KAS_CONTAINER} build ci/mirror.yml:ci/${{ matrix.machine }}.yml
120+
ci/kas-container-shell-helper.sh ci/yocto-pybootchartgui.sh
114121
mv $KAS_WORK_DIR/build/buildchart.svg .
115122
116123
if [ "${{ matrix.machine }}" = "qcom-armv8a" ]; then
117-
kas build ci/mirror.yml:ci/${{ matrix.machine }}.yml:ci/initramfs-test.yml
124+
${KAS_CONTAINER} build ci/mirror.yml:ci/${{ matrix.machine }}.yml:ci/initramfs-test.yml
118125
fi
119126
120127
- uses: actions/upload-artifact@v4

ci/kas-container-shell-helper.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/sh -e
2+
# Copyright (c) 2025 Qualcomm Innovation Center, Inc. All rights reserved.
3+
# SPDX-License-Identifier: MIT
4+
5+
TOPDIR=$(realpath $(dirname $(readlink -f $0))/..)
6+
SCRIPT=$(realpath $1)
7+
8+
if ! [ -f $SCRIPT ]; then
9+
echo "The script path argument is missing, please run it with:"
10+
echo " $0 /path/to/script"
11+
exit 1
12+
fi
13+
14+
# make it relative to the TOPDIR
15+
SCRIPT=${SCRIPT#$TOPDIR/}
16+
17+
# on ci the kas-container is not on the default path
18+
KAS_CONTAINER=${KAS_CONTAINER:-$(which kas-container)}
19+
20+
exec $KAS_CONTAINER shell $TOPDIR/ci/base.yml --command "/repo/$SCRIPT /repo /work"

ci/yocto-check-layer.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh -e
1+
#!/bin/bash -e
22
# Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
33
# SPDX-License-Identifier: MIT
44

@@ -21,17 +21,23 @@ _is_dir(){
2121
_is_dir "$REPO_DIR"
2222
_is_dir "$WORK_DIR"
2323

24+
# Creates a temporary build directory to run the yocto-check-layer
25+
# script to avoid a contaminated environment.
26+
BUILDDIR="$(mktemp -p $WORK_DIR -d -t build-yocto-check-layer-XXXX)"
27+
source $WORK_DIR/oe-core/oe-init-build-env $BUILDDIR
28+
git -c advice.detachedHead=false clone --quiet --shared $REPO_DIR meta-qcom
29+
2430
# Yocto Project layer checking tool
25-
CMD="yocto-check-layer-wrapper"
31+
CMD="yocto-check-layer"
2632
# Layer to check
27-
CMD="$CMD $REPO_DIR"
33+
CMD="$CMD meta-qcom"
2834
# Disable auto layer discovery
2935
CMD="$CMD --no-auto"
3036
# Layers to process for dependencies
3137
CMD="$CMD --dependency $WORK_DIR/oe-core/meta"
3238
# Disable automatic testing of dependencies
3339
CMD="$CMD --no-auto-dependency"
3440
# Set machines to all machines defined in this BSP layer
35-
CMD="$CMD --machines $(echo $(find $REPO_DIR/conf/machine/ -maxdepth 1 -name *.conf -exec basename {} .conf \; ))"
41+
CMD="$CMD --machines $(echo $(find meta-qcom/conf/machine/ -maxdepth 1 -name *.conf -exec basename {} .conf \; ))"
3642

3743
exec $CMD

ci/yocto-patchreview.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ $WORK_DIR/oe-core/scripts/contrib/patchreview.py -v -b -j status.json $REPO_DIR
2626

2727
# return an error if any malformed patch is found
2828
cat $WORK_DIR/build/status.json |
29-
python -c "import json,sys;obj=json.load(sys.stdin); sys.exit(1) if 'malformed-sob' in obj[0] or 'malformed-upstream-status' in obj[0] else sys.exit(0)"
29+
python3 -c "import json,sys;obj=json.load(sys.stdin); sys.exit(1) if 'malformed-sob' in obj[0] or 'malformed-upstream-status' in obj[0] else sys.exit(0)"

0 commit comments

Comments
 (0)