Skip to content

Commit 2306208

Browse files
committed
Consolidate PR build into qcom-build-utils
Previously, pkg-* repos relied on two separate PR check paths: 1. pr-pre-post-merge.yml → qcom-build-pkg-reusable-workflow.yml (GitHub Actions check run) 2. debusine-pr-hook.yml + debusine-pr-check.yml → debusine-action directly (Debusine CI commit status, bypassing qcom-build-utils entirely) This meant repos without DEBUSINE_TOKEN would fail on the hook+check path regardless of the effective build path, and the suite was always hardcoded to sid regardless of the target branch. This commit consolidates everything into qcom-build-utils: qcom-build-pkg-reusable-workflow.yml: - Add force-docker-build boolean input: when true, forces the local sbuild pkg-builder path for Debian-family suites instead of Debusine - Add force_docker_build output to the resolve job: true when family=debian and DEBUSINE_TOKEN is absent or force-docker-build is set; false otherwise - family retains its original suite-classification meaning; force_docker_build expresses the build-path intent - ubuntu-build: family == 'ubuntu' OR force_docker_build - debian-build: family == 'debian' AND NOT force_docker_build - All test and finalize job conditions updated consistently - Remove the now-redundant hard-fail Require Debusine token step from debian-build; job-level if gate handles it qcom-release-reusable-workflow.yml: - Use the actual suite name in dch --distribution instead of hardcoding unstable; map sid to unstable since sid is the codename and dch expects the suite name pkg-workflows/debian/pr-pre-post-merge.yml: - Add resolve-suite job: derives suite from target branch (qcom/ubuntu/<s> or qcom/debian/<s> → <s>, else sid) so PRs to qcom/ubuntu/resolute no longer use Debusine - Pass DEBUSINE_USER and DEBUSINE_TOKEN secrets through The debusine-pr-hook.yml and debusine-pr-check.yml files are no longer needed in pkg-* repos. Branch protection rules should require the PR Pre and Post Merge Build check run rather than the old Debusine CI commit status. Signed-off-by: Keerthi Gowda <kbalehal@qti.qualcomm.com>
1 parent 41de3fa commit 2306208

4 files changed

Lines changed: 102 additions & 48 deletions

File tree

.github/pkg-workflows/debian/pr-pre-post-merge.yml

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,41 @@ permissions:
1010
packages: read
1111

1212
jobs:
13-
build:
14-
# This condition ensures that the job runs for all PR actions except closed unmerged,
15-
# i.e., it runs for opened, synchronize, reopened (pre-merge) and closed merged (post-merge).
13+
resolve-suite:
14+
name: Resolve suite from branch
15+
runs-on: ubuntu-latest
16+
outputs:
17+
suite: ${{ steps.resolve.outputs.suite }}
18+
steps:
19+
- name: Derive suite from target branch
20+
id: resolve
21+
env:
22+
BASE_REF: ${{ github.base_ref }}
23+
run: |
24+
set -euo pipefail
25+
case "$BASE_REF" in
26+
qcom/ubuntu/*|qcom/debian/*)
27+
suite="${BASE_REF##*/}"
28+
;;
29+
*)
30+
suite=sid
31+
;;
32+
esac
33+
echo "suite=$suite" >> "$GITHUB_OUTPUT"
34+
echo "Resolved suite: $suite (from branch: $BASE_REF)"
1635
36+
build:
1737
name: Build Debian Package
18-
uses: qualcomm-linux/qcom-build-utils/.github/workflows/qcom-build-pkg-reusable-workflow.yml@main
38+
needs: resolve-suite
1939
if: ${{ github.event.action != 'closed' || github.event.pull_request.merged == true }}
40+
uses: qualcomm-linux/qcom-build-utils/.github/workflows/qcom-build-pkg-reusable-workflow.yml@main
2041
with:
2142
qcom-build-utils-ref: main
2243
# PRE-MERGE: use the PR head branch (github.head_ref)
23-
# POST-MERGE: use the base branch name from the PR (e.g. "debian/qcom-next")
44+
# POST-MERGE: use the base branch name from the PR
2445
debian-ref: ${{ (github.event.action == 'closed' && github.event.pull_request.merged) && github.event.pull_request.base.ref || github.head_ref }}
46+
suite: ${{ needs.resolve-suite.outputs.suite }}
2547
debusine-parent-workspace: ${{ vars.DEBUSINE_PARENT_WORKSPACE }}
48+
secrets:
49+
DEBUSINE_USER: ${{ secrets.DEBUSINE_USER }}
50+
DEBUSINE_TOKEN: ${{ secrets.DEBUSINE_TOKEN }}

.github/pkg-workflows/main/build-debian-package.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ on:
2626
- bookworm
2727
- sid
2828

29+
force-docker-build:
30+
description: Force local pkg-builder instead of Debusine for Debian-family suites
31+
type: boolean
32+
default: false
33+
2934
permissions:
3035
contents: read
3136
packages: read
@@ -37,4 +42,8 @@ jobs:
3742
qcom-build-utils-ref: main
3843
debian-ref: ${{ inputs.debian-ref }}
3944
suite: ${{ inputs.suite }}
45+
force-docker-build: ${{ inputs.force-docker-build }}
4046
debusine-parent-workspace: ${{ vars.DEBUSINE_PARENT_WORKSPACE }}
47+
secrets:
48+
DEBUSINE_USER: ${{ secrets.DEBUSINE_USER }}
49+
DEBUSINE_TOKEN: ${{ secrets.DEBUSINE_TOKEN }}

.github/workflows/qcom-build-pkg-reusable-workflow.yml

Lines changed: 53 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Qualcomm Build Debian Package Reusable Workflow
22
description: |
33
This reusable workflow is called by debian-packaging repos to offer a consistent
44
build-and-test process.
5-
Debian suites use the Debusine build service, while Ubuntu codenames keep using
6-
the local pkg-builder container flow.
5+
Debian suites use the Debusine build service, while Ubuntu codenames and Debian
6+
suites without a token use the local pkg-builder Docker container flow.
77
88
on:
99
workflow_call:
@@ -25,18 +25,18 @@ on:
2525
default: unstable
2626

2727
run-lintian:
28-
description: Run lintian or not during the Ubuntu pkg-builder build path
28+
description: Run lintian or not during the Docker pkg-builder build path
2929
type: boolean
3030
default: true
3131

3232
run-abi-checker:
33-
description: Run the ABI checker or not during the Ubuntu pkg-builder build path
33+
description: Run the ABI checker or not during the Docker pkg-builder build path
3434
type: boolean
3535
default: false
3636

3737
is-prebuilt:
3838
description: |
39-
Controls the build mode passed to the Ubuntu build_package action:
39+
Controls the build mode passed to the Docker build_package action:
4040
"true" — Force prebuilt binary mode.
4141
"false" — Force source build mode.
4242
"" — Auto-detect (default): prebuilt if upstream.conf exists in the repo, else source.
@@ -57,6 +57,13 @@ on:
5757
description: Parent Debusine workspace used to create per-run child CI workspaces for Debian builds
5858
type: string
5959

60+
force-docker-build:
61+
description: |
62+
When the suite is Debian-family, force the local sbuild pkg-builder path instead of Debusine.
63+
Automatically set to true when DEBUSINE_TOKEN is absent.
64+
type: boolean
65+
default: false
66+
6067
secrets:
6168
DEBUSINE_USER:
6269
required: false
@@ -68,10 +75,10 @@ on:
6875
description: The resolved suite/codename actually used by the workflow
6976
value: ${{ jobs.finalize.outputs.target_suite }}
7077
workspace:
71-
description: Debusine workspace ID for Debian builds; empty for Ubuntu builds
78+
description: Debusine workspace ID for Debusine builds; empty for Docker builds
7279
value: ${{ jobs.finalize.outputs.workspace }}
7380
workspace_url:
74-
description: Debusine workspace URL for Debian builds; empty for Ubuntu builds
81+
description: Debusine workspace URL for Debusine builds; empty for Docker builds
7582
value: ${{ jobs.finalize.outputs.workspace_url }}
7683
srcpkg_name:
7784
description: Source package name
@@ -96,6 +103,7 @@ jobs:
96103
runs-on: ubuntu-latest
97104
outputs:
98105
family: ${{ steps.resolve.outputs.family }}
106+
force_docker_build: ${{ steps.resolve.outputs.force_docker_build }}
99107
target_suite: ${{ steps.resolve.outputs.target_suite }}
100108
debian_builder_suite: ${{ steps.resolve.outputs.debian_builder_suite }}
101109
steps:
@@ -104,6 +112,8 @@ jobs:
104112
shell: bash
105113
env:
106114
SUITE_INPUT: ${{ inputs.suite }}
115+
DEBUSINE_TOKEN: ${{ secrets.DEBUSINE_TOKEN }}
116+
FORCE_DOCKER_BUILD: ${{ inputs.force-docker-build }}
107117
run: |
108118
set -euo pipefail
109119
@@ -123,13 +133,24 @@ jobs:
123133
debian_builder_suite=sid
124134
fi
125135
136+
force_docker_build=false
137+
if [[ "$family" == "debian" ]] && [[ -z "$DEBUSINE_TOKEN" || "$FORCE_DOCKER_BUILD" == "true" ]]; then
138+
force_docker_build=true
139+
if [[ -z "$DEBUSINE_TOKEN" ]]; then
140+
echo "::warning::DEBUSINE_TOKEN is not set or not accessible (fork PR secrets are unavailable to workflows triggered by external contributors) — falling back to local pkg-builder for suite '$target_suite'"
141+
else
142+
echo "::notice::force-docker-build is set — using local pkg-builder for suite '$target_suite'"
143+
fi
144+
fi
145+
126146
echo "family=$family" >> "$GITHUB_OUTPUT"
147+
echo "force_docker_build=$force_docker_build" >> "$GITHUB_OUTPUT"
127148
echo "target_suite=$target_suite" >> "$GITHUB_OUTPUT"
128149
echo "debian_builder_suite=$debian_builder_suite" >> "$GITHUB_OUTPUT"
129150
130151
ubuntu-build:
131-
name: Build (Ubuntu)
132-
if: ${{ needs.resolve.outputs.family == 'ubuntu' }}
152+
name: Build (Docker)
153+
if: ${{ needs.resolve.outputs.family == 'ubuntu' || needs.resolve.outputs.force_docker_build == 'true' }}
133154
needs: resolve
134155
runs-on: ubuntu-24.04-arm
135156
outputs:
@@ -186,21 +207,21 @@ jobs:
186207
with:
187208
apt-repository: "deb [arch=arm64 trusted=yes] https://qartifactory-edge.qualcomm.com/artifactory/qsc-deb-releases ${{ needs.resolve.outputs.target_suite }} main"
188209

189-
- name: Upload Ubuntu build artifacts
210+
- name: Upload Docker build artifacts
190211
run: |
191212
set -euxo pipefail
192-
tar -C build-area -czf ubuntu-build-area.tgz .
213+
tar -C build-area -czf docker-build-area.tgz .
193214
194-
- name: Upload Ubuntu build archive
215+
- name: Upload Docker build archive
195216
uses: actions/upload-artifact@v6
196217
with:
197-
name: ubuntu-build-area
198-
path: ubuntu-build-area.tgz
218+
name: docker-build-area
219+
path: docker-build-area.tgz
199220
if-no-files-found: error
200221

201222
debian-build:
202-
name: Build (Debian)
203-
if: ${{ needs.resolve.outputs.family == 'debian' }}
223+
name: Build (Debusine)
224+
if: ${{ needs.resolve.outputs.family == 'debian' && needs.resolve.outputs.force_docker_build != 'true' }}
204225
needs: resolve
205226
runs-on: ubuntu-latest
206227
container:
@@ -218,15 +239,6 @@ jobs:
218239
run:
219240
shell: bash
220241
steps:
221-
- name: Require Debusine token
222-
env:
223-
DEBUSINE_TOKEN: ${{ secrets.DEBUSINE_TOKEN }}
224-
run: |
225-
if [ -z "$DEBUSINE_TOKEN" ]; then
226-
echo "DEBUSINE_TOKEN is required for Debian/Debusine builds" >&2
227-
exit 1
228-
fi
229-
230242
- name: Checkout debusine-action helpers
231243
uses: actions/checkout@v5
232244
with:
@@ -296,7 +308,7 @@ jobs:
296308

297309
test:
298310
name: Test
299-
if: ${{ always() && ((needs.resolve.outputs.family == 'debian' && needs.debian-build.result == 'success') || (needs.resolve.outputs.family == 'ubuntu' && needs.ubuntu-build.result == 'success')) }}
311+
if: ${{ always() && ((needs.resolve.outputs.family == 'debian' && needs.resolve.outputs.force_docker_build != 'true' && needs.debian-build.result == 'success') || ((needs.resolve.outputs.family == 'ubuntu' || needs.resolve.outputs.force_docker_build == 'true') && needs.ubuntu-build.result == 'success')) }}
300312
needs:
301313
- resolve
302314
- debian-build
@@ -308,7 +320,7 @@ jobs:
308320
srcpkg_version: ${{ steps.select.outputs.srcpkg_version }}
309321
runs-on: ubuntu-24.04-arm
310322
container:
311-
image: ${{ needs.resolve.outputs.family == 'debian' && format('ghcr.io/qualcomm-linux/debusine-pkg-builder:{0}', needs.resolve.outputs.debian_builder_suite) || format('ghcr.io/qualcomm-linux/pkg-builder:{0}', needs.resolve.outputs.target_suite) }}
323+
image: ${{ needs.resolve.outputs.family == 'debian' && needs.resolve.outputs.force_docker_build != 'true' && format('ghcr.io/qualcomm-linux/debusine-pkg-builder:{0}', needs.resolve.outputs.debian_builder_suite) || format('ghcr.io/qualcomm-linux/pkg-builder:{0}', needs.resolve.outputs.target_suite) }}
312324
options: --user 0:0
313325
credentials:
314326
username: ${{ github.actor }}
@@ -318,7 +330,7 @@ jobs:
318330
shell: bash
319331
steps:
320332
- name: Require Debusine credentials
321-
if: ${{ needs.resolve.outputs.family == 'debian' }}
333+
if: ${{ needs.resolve.outputs.family == 'debian' && needs.resolve.outputs.force_docker_build != 'true' }}
322334
env:
323335
DEBUSINE_USER: ${{ secrets.DEBUSINE_USER }}
324336
DEBUSINE_TOKEN: ${{ secrets.DEBUSINE_TOKEN }}
@@ -329,7 +341,7 @@ jobs:
329341
fi
330342
331343
- name: Checkout debusine-action helpers
332-
if: ${{ needs.resolve.outputs.family == 'debian' }}
344+
if: ${{ needs.resolve.outputs.family == 'debian' && needs.resolve.outputs.force_docker_build != 'true' }}
333345
uses: actions/checkout@v5
334346
with:
335347
repository: qualcomm-linux/debusine-action
@@ -340,15 +352,15 @@ jobs:
340352
lib
341353
342354
- name: Checkout Repository
343-
if: ${{ needs.resolve.outputs.family == 'debian' }}
355+
if: ${{ needs.resolve.outputs.family == 'debian' && needs.resolve.outputs.force_docker_build != 'true' }}
344356
uses: actions/checkout@v5
345357
with:
346358
ref: ${{ inputs.debian-ref }}
347359
path: srcpkg
348360
fetch-depth: 1
349361

350362
- name: Validate installability from Debusine CI workspace
351-
if: ${{ needs.resolve.outputs.family == 'debian' }}
363+
if: ${{ needs.resolve.outputs.family == 'debian' && needs.resolve.outputs.force_docker_build != 'true' }}
352364
env:
353365
DEBUSINE_HOST: ${{ vars.DEBUSINE_HOST }}
354366
DEBUSINE_SCOPE: ${{ vars.DEBUSINE_SCOPE }}
@@ -408,22 +420,22 @@ jobs:
408420
409421
env DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y $packages
410422
411-
- name: Download Ubuntu build artifacts
412-
if: ${{ needs.resolve.outputs.family == 'ubuntu' }}
423+
- name: Download Docker build artifacts
424+
if: ${{ needs.resolve.outputs.family == 'ubuntu' || needs.resolve.outputs.force_docker_build == 'true' }}
413425
uses: actions/download-artifact@v8
414426
with:
415-
name: ubuntu-build-area
427+
name: docker-build-area
416428
path: .
417429

418-
- name: Extract Ubuntu build artifacts
419-
if: ${{ needs.resolve.outputs.family == 'ubuntu' }}
430+
- name: Extract Docker build artifacts
431+
if: ${{ needs.resolve.outputs.family == 'ubuntu' || needs.resolve.outputs.force_docker_build == 'true' }}
420432
run: |
421433
set -euxo pipefail
422434
mkdir -p build-area
423-
tar -C build-area -xzf ubuntu-build-area.tgz
435+
tar -C build-area -xzf docker-build-area.tgz
424436
425-
- name: Validate installability from Ubuntu build artifacts
426-
if: ${{ needs.resolve.outputs.family == 'ubuntu' }}
437+
- name: Validate installability from Docker build artifacts
438+
if: ${{ needs.resolve.outputs.family == 'ubuntu' || needs.resolve.outputs.force_docker_build == 'true' }}
427439
run: |
428440
set -euxo pipefail
429441
@@ -440,7 +452,7 @@ jobs:
440452
- name: Select test outputs
441453
id: select
442454
run: |
443-
if [[ "${{ needs.resolve.outputs.family }}" == "debian" ]]; then
455+
if [[ "${{ needs.resolve.outputs.family }}" == "debian" && "${{ needs.resolve.outputs.force_docker_build }}" != "true" ]]; then
444456
echo "workspace=${{ needs.debian-build.outputs.workspace }}" >> "$GITHUB_OUTPUT"
445457
echo "workspace_url=${{ needs.debian-build.outputs.workspace_url }}" >> "$GITHUB_OUTPUT"
446458
echo "srcpkg_name=${{ needs.debian-build.outputs.srcpkg_name }}" >> "$GITHUB_OUTPUT"
@@ -475,3 +487,4 @@ jobs:
475487
echo "workspace_url=${{ needs.test.outputs.workspace_url }}" >> "$GITHUB_OUTPUT"
476488
echo "srcpkg_name=${{ needs.test.outputs.srcpkg_name }}" >> "$GITHUB_OUTPUT"
477489
echo "srcpkg_version=${{ needs.test.outputs.srcpkg_version }}" >> "$GITHUB_OUTPUT"
490+

.github/workflows/qcom-release-reusable-workflow.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,14 +267,21 @@ jobs:
267267
268268
version=$(dpkg-parsechangelog --show-field Version)
269269
echo "version=${version}" >> "$GITHUB_OUTPUT"
270-
echo "Releasing version: ${version} for suite 'unstable'" | sed 's/^/\x1b[32m/' | sed 's/$/\x1b[0m/'
271270
272-
dch --release --distribution=unstable "Release"
271+
# dch expects the suite name; sid is the codename for unstable
272+
dch_suite="${DISTRO_CODENAME}"
273+
if [[ "${dch_suite}" == "sid" ]]; then
274+
dch_suite=unstable
275+
fi
276+
277+
echo "Releasing version: ${version} for suite '${dch_suite}'" | sed 's/^/\x1b[32m/' | sed 's/$/\x1b[0m/'
278+
279+
dch --release --distribution="${dch_suite}" "Release"
273280
274281
echo "Updated changelog content:"
275282
cat debian/changelog | sed 's/^/\x1b[34m/' | sed 's/$/\x1b[0m/'
276283
277-
git commit -a -m "debian/changelog: Release version ${version} for suite 'unstable'"
284+
git commit -a -m "debian/changelog: Release version ${version} for suite '${dch_suite}'"
278285
279286
git tag "${DISTRO_CODENAME}/${version}"
280287

0 commit comments

Comments
 (0)