Skip to content

Commit 2311237

Browse files
committed
conf,ci: Transition to KAS for build and workflow management
KAS for build and workflow management brings significant improvements in efficiency, maintainability, and consistency to our build process. Replacingthe repo tool with kas streamlines the management of Yocto build configurations. * Replace `repo` with `kas` for managing Yocto build configurations. * Update GitHub Actions to use `kas` for checkout, build, and test processes. * Simplify build environment setup in `README.md` with `kas` commands. * Remove obsolete `manifest-scarthgap.xml` and related `repo` configurations. * Introduce new KAS configuration files for machines and presets. * Enhance workflow automation by integrating timestamp generation and matrix strategies. Change-Type: major Maintenance-Type: ci Signed-Off-By: Pablo Saavedra <psaavedra@igalia.com>
1 parent 860ec13 commit 2311237

File tree

23 files changed

+336
-452
lines changed

23 files changed

+336
-452
lines changed
Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
inputs:
2-
bitbake_buildname:
3-
default: 'build'
4-
bitbake_prefix:
5-
default: ''
6-
bitbake_machine:
2+
machine:
73
default: 'raspberrypi5'
8-
bitbake_target:
9-
default: 'core-image-weston-wpe'
10-
bitbake_source:
11-
default: 'source'
124
repo_release:
135
default: 'scarthgap'
146
s3_storage:
157
required: true
8+
target:
9+
default: 'core-image-weston-wpe'
10+
wpe_version:
11+
default: 'nightly'
12+
1613
runs:
1714
using: 'composite'
1815
steps:
@@ -21,12 +18,10 @@ runs:
2118
run: |
2219
echo "Environment:"
2320
echo "======================================================================"
24-
echo "BITBAKE_BUILDNAME=${{ inputs.bitbake_buildname }}"
25-
echo "BITBAKE_MACHINE=${{ inputs.bitbake_machine }}"
26-
echo "BITBAKE_PREFIX=${{ inputs.bitbake_prefix }}"
27-
echo "BITBAKE_SOURCE=${{ inputs.bitbake_source }}"
28-
echo "BITBAKE_TARGET=${{ inputs.bitbake_target }}"
21+
echo "MACHINE=${{ inputs.machine }}"
2922
echo "RELEASE=${{ inputs.repo_release }}"
23+
echo "TARGET=${{ inputs.target }}"
24+
echo "WPE_VERSION=${{ inputs.wpe_version }}"
3025
echo "======================================================================"
3126
- name: Download timestamp artifact
3227
uses: actions/download-artifact@v4
@@ -47,7 +42,7 @@ runs:
4742
- name: Download workdir artifact
4843
uses: actions/download-artifact@v4
4944
with:
50-
name: yocto-meta-wpe-image-${{ inputs.repo_release }}
45+
name: yocto-meta-wpe-image-${{ inputs.repo_release }}-${{ inputs.machine }}-${{ inputs.wpe_version }}
5146
path: ~/
5247
- name: Untar workdir
5348
shell: bash
@@ -58,16 +53,20 @@ runs:
5853
- name: Build
5954
shell: bash
6055
run: |
56+
export KAS_WORK_DIR="workdir"
57+
58+
# requires: sudo apt-get install -y git git-lfs pip
59+
# pip/pipx install kas
60+
export PATH=$PATH:~/.local/bin
61+
6162
cd ~/yocto-meta-wpe-image-${{ inputs.repo_release }}
62-
mkdir ~/yocto-meta-wpe-image-${{ inputs.repo_release }}/builds/
63-
cp /local-host.conf ~/yocto-meta-wpe-image-${{ inputs.repo_release }}/builds/ || true
63+
cp /kas-local.yml ~/yocto-meta-wpe-image-${{ inputs.repo_release }}/
64+
6465
ulimit -n 4096
65-
source sources/meta-wpe-image/scripts/setup-environment ${{ inputs.bitbake_buildname}} ${{ inputs.bitbake_machine }} ${{ inputs.bitbake_source }}
6666
MAX_RETRIES=5
67-
export ${{ inputs.bitbake_prefix }}
6867
for i in $(seq 1 $MAX_RETRIES); do
6968
echo "Attempt $i to fetch sources for $IMAGE..."
70-
if bitbake ${{ inputs.bitbake_target }} --runall=fetch; then
69+
if kas shell kas.yml:kas/machines/${{ inputs.machine }}.yml:kas/presets/wpe-${{ inputs.wpe_version }}.yml:kas-local.yml -c "bitbake ${{ inputs.target }} --runall=fetch"; then
7170
echo "All sources fetched successfully."
7271
break
7372
fi
@@ -78,15 +77,18 @@ runs:
7877
echo "Max retries reached. Some sources may still be missing."
7978
fi
8079
done
81-
buildhistory-collect-srcrevs -a > ~/srcrev_${{ inputs.bitbake_target }}_${{ inputs.bitbake_machine }}.inc
82-
diff -u ../../sources/meta-wpe-image/conf/include/srcrev_${{ inputs.bitbake_target }}_${{ inputs.bitbake_machine }}.inc ~/srcrev_${{ inputs.bitbake_target }}_${{ inputs.bitbake_machine }}.inc || true
80+
81+
kas shell \
82+
kas.yml:kas/machines/${{ inputs.machine }}.yml:kas/presets/wpe-${{ inputs.wpe_version }}.yml:kas/presets/buildhistory.yml:kas-local.yml \
83+
-c "buildhistory-collect-srcrevs -a > ${KAS_WORK_DIR}/srcrev_${{ inputs.target }}_${{ inputs.machine }}.inc"
84+
diff -u meta-wpe-image/conf/include/srcrev_${{ inputs.target }}_${{ inputs.machine }}.inc ${KAS_WORK_DIR}/srcrev_${{ inputs.target }}_${{ inputs.machine }}.inc || true
8385
- name: Upload buildhistory-collect-srcrevs.inc artifact
8486
uses: actions/upload-artifact@v4
8587
with:
86-
name: srcrev_${{ inputs.bitbake_target }}_${{ inputs.bitbake_machine }}.inc
87-
path: ~/srcrev_${{ inputs.bitbake_target }}_${{ inputs.bitbake_machine }}.inc
88+
name: srcrev_${{ inputs.target }}_${{ inputs.machine }}.inc
89+
path: ~/yocto-meta-wpe-image-${{ inputs.repo_release }}/workdir/srcrev_${{ inputs.bitbake_target }}_${{ inputs.bitbake_machine }}.inc
8890
- name: Clean the tmp dir
8991
if: always()
9092
shell: bash
9193
run: |
92-
rm -rf ~/yocto-meta-wpe-image-${{ inputs.repo_release }}/builds/${{ inputs.bitbake_buildname }}/tmp
94+
rm -rf ~/yocto-meta-wpe-image-${{ inputs.repo_release }}
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
inputs:
2-
bitbake_buildname:
3-
default: 'build'
4-
bitbake_prefix:
5-
default: ''
6-
bitbake_machine:
2+
machine:
73
default: 'raspberrypi5'
8-
bitbake_target:
9-
default: 'core-image-weston-wpe'
10-
bitbake_source:
11-
default: 'source'
4+
presets_extra:
5+
default: ''
126
repo_release:
137
default: 'scarthgap'
148
s3_storage:
159
required: true
10+
target:
11+
default: 'core-image-weston-wpe'
12+
wpe_version:
13+
default: 'nightly'
14+
1615
runs:
1716
using: 'composite'
1817
steps:
@@ -21,12 +20,11 @@ runs:
2120
run: |
2221
echo "Environment:"
2322
echo "======================================================================"
24-
echo "BITBAKE_BUILDNAME=${{ inputs.bitbake_buildname }}"
25-
echo "BITBAKE_MACHINE=${{ inputs.bitbake_machine }}"
26-
echo "BITBAKE_PREFIX=${{ inputs.bitbake_prefix }}"
27-
echo "BITBAKE_SOURCE=${{ inputs.bitbake_source }}"
28-
echo "BITBAKE_TARGET=${{ inputs.bitbake_target }}"
23+
echo "MACHINE=${{ inputs.machine }}"
24+
echo "PRESETS_EXTRA=${{ inputs.presets_extra }}"
2925
echo "RELEASE=${{ inputs.repo_release }}"
26+
echo "TARGET=${{ inputs.target }}"
27+
echo "WPE_VERSION=${{ inputs.wpe_version }}"
3028
echo "======================================================================"
3129
- name: Download timestamp artifact
3230
uses: actions/download-artifact@v4
@@ -47,7 +45,7 @@ runs:
4745
- name: Download workdir artifact
4846
uses: actions/download-artifact@v4
4947
with:
50-
name: yocto-meta-wpe-image-${{ inputs.repo_release }}
48+
name: yocto-meta-wpe-image-${{ inputs.repo_release }}-${{ inputs.machine }}-${{ inputs.wpe_version }}
5149
path: ~/
5250
- name: Untar workdir
5351
shell: bash
@@ -58,16 +56,20 @@ runs:
5856
- name: Build
5957
shell: bash
6058
run: |
59+
export KAS_WORK_DIR="workdir"
60+
61+
# requires: sudo apt-get install -y git git-lfs pip
62+
# pip/pipx install kas
63+
export PATH=$PATH:~/.local/bin
64+
6165
cd ~/yocto-meta-wpe-image-${{ inputs.repo_release }}
62-
mkdir ~/yocto-meta-wpe-image-${{ inputs.repo_release }}/builds/
63-
cp /local-host.conf ~/yocto-meta-wpe-image-${{ inputs.repo_release }}/builds/ || true
66+
cp /kas-local.yml ~/yocto-meta-wpe-image-${{ inputs.repo_release }}/
67+
6468
ulimit -n 4096
65-
source sources/meta-wpe-image/scripts/setup-environment ${{ inputs.bitbake_buildname}} ${{ inputs.bitbake_machine }} ${{ inputs.bitbake_source }}
6669
MAX_RETRIES=5
67-
export ${{ inputs.bitbake_prefix }}
6870
for i in $(seq 1 $MAX_RETRIES); do
6971
echo "Attempt $i to fetch sources for $IMAGE..."
70-
if bitbake ${{ inputs.bitbake_target }} --runall=fetch; then
72+
if kas shell kas.yml:kas/machines/${{ inputs.machine }}.yml:kas/presets/wpe-${{ inputs.wpe_version }}.yml:kas-local.yml -c "bitbake ${{ inputs.target }} --runall=fetch"; then
7173
echo "All sources fetched successfully."
7274
break
7375
fi
@@ -78,21 +80,22 @@ runs:
7880
echo "Max retries reached. Some sources may still be missing."
7981
fi
8082
done
81-
${{ inputs.bitbake_prefix }} bitbake ${{ inputs.bitbake_target }}
83+
84+
kas build kas.yml:kas/machines/${{ inputs.machine }}.yml:kas/presets/wpe-${{ inputs.wpe_version }}.yml${{ inputs.presets_extra}}:kas-local.yml
8285
- name: Artifacts
8386
if: always()
8487
shell: bash
8588
run: |
86-
ls -lh ~/yocto-meta-wpe-image-${{ inputs.repo_release }}/builds/${{ inputs.bitbake_buildname }}/tmp/deploy/images/${{ inputs.bitbake_machine }}/
89+
ls -lh ~/yocto-meta-wpe-image-${{ inputs.repo_release }}/${KAS_WORK_DIR}/build/tmp/deploy/images/${{ inputs.machine }}/
8790
TIMESTAMP=${{ steps.timestamp.outputs.timestamp }}
88-
s3cmd put -F ~/yocto-meta-wpe-image-${{ inputs.repo_release }}/builds/${{ inputs.bitbake_buildname }}/tmp/deploy/images/${{ inputs.bitbake_machine }}/${{ inputs.bitbake_target }}-${{ inputs.bitbake_machine }}.rootfs.wic.bmap \
89-
s3://${{ inputs.s3_storage }}/${TIMESTAMP}-${{ inputs.bitbake_buildname }}/${{ inputs.bitbake_target }}-${{ inputs.bitbake_machine }}.wic.bmap
90-
s3cmd put -F ~/yocto-meta-wpe-image-${{ inputs.repo_release }}/builds/${{ inputs.bitbake_buildname }}/tmp/deploy/images/${{ inputs.bitbake_machine }}/${{ inputs.bitbake_target }}-${{ inputs.bitbake_machine }}.rootfs.wic.bz2 \
91-
s3://${{ inputs.s3_storage }}/${TIMESTAMP}-${{ inputs.bitbake_buildname }}/${{ inputs.bitbake_target }}-${{ inputs.bitbake_machine }}.wic.bz2
92-
s3cmd put -F ~/yocto-meta-wpe-image-${{ inputs.repo_release }}/builds/${{ inputs.bitbake_buildname }}/tmp/deploy/images/${{ inputs.bitbake_machine }}/${{ inputs.bitbake_target }}-${{ inputs.bitbake_machine }}.rootfs-dbg.tar.bz2 \
93-
s3://${{ inputs.s3_storage }}/${TIMESTAMP}-${{ inputs.bitbake_buildname }}/${{ inputs.bitbake_target }}-${{ inputs.bitbake_machine }}.dbg.tar.bz2
91+
s3cmd put -F ~/yocto-meta-wpe-image-${{ inputs.repo_release }}/${KAS_WORK_DIR}/build/tmp/deploy/images/${{ inputs.machine }}/${{ inputs.target }}-${{ inputs.machine }}.rootfs.wic.bmap \
92+
s3://${{ inputs.s3_storage }}/${TIMESTAMP}-wpe-${{ inputs.wpe_version }}-${{ inputs.machine }}/${{ inputs.target }}-${{ inputs.machine }}.wic.bmap
93+
s3cmd put -F ~/yocto-meta-wpe-image-${{ inputs.repo_release }}/${KAS_WORK_DIR}/build/tmp/deploy/images/${{ inputs.machine }}/${{ inputs.target }}-${{ inputs.machine }}.rootfs.wic.bz2 \
94+
s3://${{ inputs.s3_storage }}/${TIMESTAMP}-wpe-${{ inputs.wpe_version }}-${{ inputs.machine }}/${{ inputs.target }}-${{ inputs.machine }}.wic.bz2
95+
s3cmd put -F ~/yocto-meta-wpe-image-${{ inputs.repo_release }}/${KAS_WORK_DIR}/build/tmp/deploy/images/${{ inputs.machine }}/${{ inputs.target }}-${{ inputs.machine }}.rootfs.dbg.tar.bz2 \
96+
s3://${{ inputs.s3_storage }}/${TIMESTAMP}-wpe-${{ inputs.wpe_version }}-${{ inputs.machine }}/${{ inputs.target }}-${{ inputs.machine }}.dbg.tar.bz2
9497
- name: Clean the tmp dir
9598
if: always()
9699
shell: bash
97100
run: |
98-
rm -rf ~/yocto-meta-wpe-image-${{ inputs.repo_release }}/builds/${{ inputs.bitbake_buildname }}/tmp
101+
# rm -rf ~/yocto-meta-wpe-image-${{ inputs.repo_release }}
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
inputs:
2+
machine:
3+
default: 'raspberrypi5'
24
repo_url:
35
default: https://github.com/${{ github.repository }}.git
46
repo_ref:
57
default: ${{ github.ref }}
68
repo_release:
79
default: 'scarthgap'
10+
wpe_version:
11+
default: 'nightly'
12+
813
runs:
914
using: 'composite'
1015
steps:
@@ -15,48 +20,43 @@ runs:
1520
echo "======================================================================"
1621
echo "CI_REPOSITORY_URL=${{ inputs.repo_url }}"
1722
echo "CI_COMMIT_SHA=${{ inputs.repo_ref }}"
18-
echo "CI_RELEASE=${{ inputs.repo_release }}"
23+
echo "MACHINE=${{ inputs.machine }}"
24+
echo "RELEASE=${{ inputs.repo_release }}"
25+
echo "WPE_VERSION=${{ inputs.wpe_version }}"
1926
echo "======================================================================"
20-
- name: Generate timestamped prefix
21-
id: timestamp
22-
shell: bash
23-
run: |
24-
TIMESTAMP=$(date +"%Y%m%d%H%M")
25-
echo ${TIMESTAMP} > timestamp.txt
2627
- name: Set bitbake environment
2728
shell: bash
2829
run: |
29-
sudo apt-get install -y git git-lfs repo
30-
mkdir -p ~/yocto-meta-wpe-image-${{ inputs.repo_release }}
31-
cd ~/yocto-meta-wpe-image-${{ inputs.repo_release }}
32-
repo init -u ${{ inputs.repo_url }} -m manifest-${{ inputs.repo_release }}.xml -b ${{ inputs.repo_ref }}
33-
34-
attempt=0
35-
until repo sync --force-sync; do
36-
attempt=$((attempt+1))
37-
if [ $attempt -ge 5 ]; then
38-
echo "repo sync failed after 5 attempts. Exiting."
39-
exit 1
40-
fi
41-
echo "repo sync failed. Retrying in 30 seconds... ($attempt/5)"
42-
sleep 30
43-
done
30+
sudo apt-get install -y git git-lfs pip
31+
export PATH=$PATH:~/.local/bin
32+
pip install kas
4433
45-
pushd sources/meta-wpe-image
4634
git config --global user.email "meta-wpe-image-bot@igalia.com"
4735
git config --global user.name "meta-wpe-image CI Bot"
36+
git clone ${{ inputs.repo_url }} ~/yocto-meta-wpe-image-${{ inputs.repo_release }}
37+
cd ~/yocto-meta-wpe-image-${{ inputs.repo_release }}
38+
4839
git remote remove tmp || true
4940
git remote add tmp ${{ inputs.repo_url }}
5041
git fetch tmp main
5142
git fetch tmp ${{ inputs.repo_ref }}:${{ inputs.repo_ref }}
5243
git checkout ${{ inputs.repo_ref }}
5344
git rebase tmp/main
54-
popd
55-
- name: Upload timestamp prefix artifact
56-
uses: actions/upload-artifact@v4
57-
with:
58-
name: timestamp.txt
59-
path: timestamp.txt
45+
46+
export KAS_CLONE_DEPTH="1"
47+
export KAS_WORK_DIR="workdir"
48+
mkdir "${KAS_WORK_DIR}"
49+
50+
attempt=0
51+
until kas checkout kas.yml:kas/machines/${{ inputs.machine }}.yml:kas/presets/wpe-${{ inputs.wpe_version }}.yml; do
52+
attempt=$((attempt+1))
53+
if [ $attempt -ge 5 ]; then
54+
echo "kas checkout failed after 5 attempts. Exiting."
55+
exit 1
56+
fi
57+
echo "kas checkout failed. Retrying in 30 seconds... ($attempt/5)"
58+
sleep 30
59+
done
6060
- name: Tar workdir
6161
shell: bash
6262
run: |
@@ -65,6 +65,6 @@ runs:
6565
- name: Upload tar workdir artifact
6666
uses: actions/upload-artifact@v4
6767
with:
68-
name: yocto-meta-wpe-image-${{ inputs.repo_release }}
68+
name: yocto-meta-wpe-image-${{ inputs.repo_release }}-${{ inputs.machine }}-${{ inputs.wpe_version }}
6969
path: ~/yocto-meta-wpe-image-${{ inputs.repo_release }}.tar
7070

0 commit comments

Comments
 (0)