Skip to content

Commit 2ab05e0

Browse files
committed
ci: Post-merge Yocto Build enablement
Changes for Yocto post-merge workflow: - Cache support for Build - Checkrun enablement Signed-off-by: Salendarsingh Gaud <sgaud@qti.qualcomm.com>
1 parent cdf3fc7 commit 2ab05e0

5 files changed

Lines changed: 84 additions & 50 deletions

File tree

.github/actions/build_yocto/action.yml

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,12 @@ name: Compile Yocto Build
33
description: Compile Yocto Build using kas files
44

55
inputs:
6-
target:
7-
description: target
8-
type: string
9-
required: true
106
workspace_path:
117
description: Workspace path
128
required: true
139
s3_bucket:
1410
description: S3 bucket name
1511
required: true
16-
docker_image:
17-
description: Docker image name
18-
required: true
19-
machine:
20-
description: Machine name
21-
required: true
2212
rootfs:
2313
description: rootfs name
2414
required: true
@@ -31,7 +21,8 @@ inputs:
3121
cache_dir:
3222
description: Cache directory
3323
required: true
34-
24+
kas:
25+
required: true
3526

3627
outputs:
3728
artifacts_location:
@@ -45,20 +36,20 @@ runs:
4536
shell: bash
4637
run: |
4738
set -ex
39+
40+
# use a monthly sstate cache folder
41+
echo "DL_DIR=${{inputs.cache_dir}}/downloads" >> $GITHUB_ENV
42+
echo "SSTATE_DIR=${{inputs.cache_dir}}/sstate-cache-$(date '+%Y-%m')" >> $GITHUB_ENV
43+
4844
workspace=${{ inputs.workspace_path }}
4945
s3_bucket=${{ inputs.s3_bucket }}
50-
docker_image=${{ inputs.docker_image }}
51-
machine=${{ inputs.machine }}
5246
rootfs=${{ inputs.rootfs }}
5347
build_dir="$workspace/../$rootfs"
5448
sha=${{ inputs.sha }}
5549
kernel_ver=${{ inputs.kernel_ver }}
5650
57-
echo "target=${{ inputs.target }}" >> $GITHUB_ENV
5851
echo "workspace=${{ inputs.workspace_path }}" >> $GITHUB_ENV
5952
echo "s3_bucket=${{ inputs.s3_bucket }}" >> $GITHUB_ENV
60-
echo "docker_image=${{ inputs.docker_image }}" >> $GITHUB_ENV
61-
echo "machine=${{ inputs.machine }}" >> $GITHUB_ENV
6253
echo "build_dir=$build_dir" >> $GITHUB_ENV
6354
echo "sha=${{ inputs.sha }}" >> $GITHUB_ENV
6455
echo "rootfs=${{ inputs.rootfs }}" >> $GITHUB_ENV
@@ -94,6 +85,19 @@ runs:
9485
sed -i "s/SRCREV:pn-linux-qcom-next = \"[^\"]*\"/SRCREV:pn-linux-qcom-next = \"$kernel_sha\"/" kernel-override.yml
9586
fi
9687
88+
- name: Download kas-container
89+
uses: actions/download-artifact@v6
90+
with:
91+
name: kas-container
92+
path: ${{runner.temp}}
93+
94+
- name: Setting up kas-container
95+
shell: bash
96+
run: |
97+
KAS_CONTAINER=$RUNNER_TEMP/kas-container
98+
echo "KAS_CONTAINER=$KAS_CONTAINER" >> $GITHUB_ENV
99+
chmod +x $KAS_CONTAINER
100+
97101
- name: Run Kas Build
98102
id: build
99103
shell: bash
@@ -104,13 +108,8 @@ runs:
104108
ls -la
105109
export KAS_WORK_DIR=$PWD/kas
106110
echo $KAS_WORK_DIR
107-
docker run -i --rm \
108-
--user "$(id -u):$(id -g)" \
109-
--workdir="$PWD" \
110-
-v "$(dirname "$PWD")":"$(dirname "$PWD")" \
111-
"${{ env.docker_image }}" bash -c "
112-
kas build kas-build-${{ env.rootfs }}.yml:kernel-override.yml
113-
"
111+
112+
$KAS_CONTAINER build kas-build-${{ env.rootfs }}.yml
114113
115114
- name: Prepare file list for log upload
116115
if: always()
@@ -122,18 +121,18 @@ runs:
122121
touch ${{ github.workspace }}/file_list.txt
123122
fi
124123
# # echo "${{ github.workspace}}/build-logs.log" >> file_list.txt
125-
cd ${{ env.build_dir }}/build/tmp/deploy/images/${{ env.rootfs }}/
124+
cd ${{ env.build_dir }}/kas/build/tmp/deploy/images/${{ env.rootfs }}/
126125
ls -la
127126
LINK="qcom-multimedia-image-${{ env.rootfs }}.rootfs.qcomflash.tar.gz"
128127
TARGET=$(readlink "$LINK")
129-
cp "$TARGET" ${{ env.build_dir }}/${{ env.rootfs }}.tar.gz
128+
cp "$TARGET" ${{ env.build_dir }}/${{ env.rootfs }}-rootfs.tar.gz
130129
131130
LINK_PROP="qcom-multimedia-proprietary-image-${{ env.rootfs }}.rootfs.qcomflash.tar.gz"
132131
TARGET_PROP=$(readlink "$LINK")
133-
cp "$TARGET_PROP" ${{ env.build_dir }}/${{ env.rootfs }}-prop.tar.gz
132+
cp "$TARGET_PROP" ${{ env.build_dir }}/${{ env.rootfs }}-rootfs-prop.tar.gz
134133
135-
echo "${{ env.build_dir }}/${{ env.rootfs }}.tar.gz" >> ${{ github.workspace }}/file_list.txt
136-
echo "${{ env.build_dir }}/${{ env.rootfs }}-prop.tar.gz" >> ${{ github.workspace }}/file_list.txt
134+
echo "${{ env.build_dir }}/${{ env.rootfs }}-rootfs.tar.gz" >> ${{ github.workspace }}/file_list.txt
135+
echo "${{ env.build_dir }}/${{ env.rootfs }}-rootfs-prop.tar.gz" >> ${{ github.workspace }}/file_list.txt
137136
echo "${{ env.build_dir }}/build_id.txt" >> ${{ github.workspace }}/file_list.txt
138137
139138
- name: Upload artifacts to S3

.github/templates/coral-kernel-template.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,18 @@ on:
108108
label: Add Reviewer Workflow ID
109109
description: ID of the Add Reviewer GitHub Workflow (Enter 0 to skip this run)
110110

111+
workflow.yocto_postmerge.id:
112+
type: number
113+
required: true
114+
coral.actions/metadata:
115+
ui-annotations:
116+
type: Number
117+
label: Yocto Post Merge Build generation Workflow ID
118+
description: ID of the Yocto Build GitHub Workflow to be executed
119+
rules:
120+
- type: required
121+
message: Yocto Build generation Workflow ID
122+
111123
labels:
112124
type: string
113125
coral.actions/metadata:
@@ -289,6 +301,24 @@ jobs:
289301
rm -rf $uuid
290302
coral.actions/expected-exit-codes: [0]
291303

304+
- name: post-merge-yocto
305+
if: ${{ inputs.workflow.reviewer.id != 0 }}
306+
run: |
307+
printenv
308+
uuid=$(openssl rand -hex 16)
309+
mkdir $uuid && cd $uuid
310+
echo ${{ inputs.changeSpec }} | base64 -d > changeSpec.json
311+
cp /bin/gh-utils/run_gh_action.sh script.sh
312+
chmod +x script.sh
313+
WORKFLOW_REPO_OWNER=${{ inputs.workflow.repo.owner }} \
314+
WORKFLOW_REPO=${{ inputs.workflow.repo.name }} \
315+
ACCESS_TOKEN=$(cat $GITHUB_TOKEN) \
316+
JSON_CHANGE_SPEC=changeSpec.json \
317+
WORKFLOW_ID=${{ inputs.workflow.yocto_postmerge.id }} \
318+
./script.sh
319+
rm -rf $uuid
320+
coral.actions/expected-exit-codes: [0]
321+
292322
coral.actions/secrets:
293323
labels:
294324
- name: GithubToken

.github/workflows/build-yocto.yml

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ description: Reusable workflow for Yocto Build
55
on:
66
workflow_call:
77
inputs:
8-
docker_image:
9-
description: Docker image
10-
type: string
11-
required: true
128
repo:
139
description: 'Repo Name'
1410
required: false
@@ -17,11 +13,6 @@ on:
1713
description: 'Branch or tag name'
1814
required: false
1915
type: string
20-
pr:
21-
description: 'Pull Request Number'
22-
required: false
23-
type: string
24-
default: ''
2516
sha:
2617
description: Head sha of the PR
2718
type: string
@@ -39,8 +30,31 @@ on:
3930
description: 'Artifacts Upload location'
4031
value: ${{ jobs.compile_yocto.outputs.artifacts_location }}
4132

33+
env:
34+
CACHE_DIR: /efs/kernel/meta-qcom
35+
4236
jobs:
37+
kas-setup:
38+
runs-on:
39+
group: GHA-Kernel-Stg-SelfHosted-RG
40+
labels: [self-hosted, kernel-stg-u2404-x64-large-od-ephem]
41+
steps:
42+
- name: Update kas-container
43+
run: |
44+
KAS_CONTAINER=$RUNNER_TEMP/kas-container
45+
echo "KAS_CONTAINER=$KAS_CONTAINER" >> $GITHUB_ENV
46+
LATEST=$(git ls-remote --tags --refs --sort="v:refname" https://github.com/siemens/kas | tail -n1 | sed 's/.*\///')
47+
wget -qO ${KAS_CONTAINER} https://raw.githubusercontent.com/siemens/kas/refs/tags/$LATEST/kas-container
48+
chmod +x ${KAS_CONTAINER}
49+
50+
- name: Upload kas-container
51+
uses: actions/upload-artifact@v4
52+
with:
53+
name: kas-container
54+
path: ${{ env.KAS_CONTAINER }}
55+
4356
compile_yocto:
57+
needs: kas-setup
4458
name: Build Yocto
4559
runs-on:
4660
group: GHA-Kernel-SelfHosted-RG
@@ -54,24 +68,17 @@ jobs:
5468
rootfs_matrix: ${{ fromJson(inputs.rootfs_matrix) }}
5569

5670
steps:
57-
- name: Pull docker image
58-
uses: qualcomm-linux/kernel-config/.github/actions/pull_docker_image@main
59-
with:
60-
image: ${{ inputs.docker_image }}
61-
6271
- name: Build Yocto
6372
id: build_yocto
6473
uses: qualcomm-linux/kernel-config/.github/actions/build_yocto@main
6574
with:
66-
docker_image: ${{ inputs.docker_image }}
67-
target: ${{ matrix.target }}
6875
workspace_path: ${{ github.workspace }}
6976
s3_bucket: qli-prd-kernel-gh-artifacts
70-
machine: ${{ matrix.rootfs_matrix.machine }}
7177
rootfs: ${{ matrix.rootfs_matrix.rootfs }}
72-
firmwareid: ${{ matrix.rootfs_matrix.firmwareid }}
7378
kernel_ver: ${{ inputs.kernel_ver }}
7479
sha: ${{ inputs.sha }}
80+
CACHE_DIR : ${CACHE_DIR}
81+
kas: ${{ env.KAS_CONTAINER }}
7582
env:
7683
token: ${{ secrets.PAT }}
7784
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}

.github/workflows/post-merge-yocto.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,8 @@ jobs:
6161
uses: qualcomm-linux/kernel-config/.github/workflows/build-yocto.yml@main
6262
secrets: inherit
6363
with:
64-
docker_image: kmake-image:ver.1.0
6564
repo: ${{ github.event.inputs.repo || 'qualcomm-linux/kernel' }}
6665
ref: ${{ github.event.inputs.ref || 'qcom-next' }}
67-
pr: ${{ github.event.inputs.pr || '' }}
6866
SHA: ${{ github.event.inputs.sha }}
6967
rootfs_matrix: ${{ needs.loading.outputs.rootfs_matrix }}
7068
kernel_ver: ${{ github.event.inputs.kernel_ver }}

ci/MACHINES.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"target": "kaanapali-qrd",
7070
"buildid": "",
7171
"firmwareid": "",
72-
"rootfs": "kaanapali-qrd"
72+
"rootfs": ""
7373
},
7474
"x1e80100-crd": {
7575
"machine": "x1e80100-crd",
@@ -78,6 +78,6 @@
7878
"target": "x1e80100-crd",
7979
"buildid": "",
8080
"firmwareid": "",
81-
"rootfs": "x1e80100-crd"
81+
"rootfs": ""
8282
}
8383
}

0 commit comments

Comments
 (0)