Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions .github/actions/build_container/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,27 @@ runs:
shell: bash
run: ./scripts/docker_deb_build.py --rebuild

- name: Checkout pkg-example at debian/latest and tags
uses: actions/checkout@v4
with:
repository: qualcomm-linux/pkg-example
ref: debian/latest
token: ${{inputs.token}}
path: ./pkg-example
fetch-depth: 0
fetch-tags: true
# - name: Checkout pkg-example at debian/latest and tags
# uses: actions/checkout@v4
# with:
# repository: qualcomm-linux/pkg-example
# ref: debian/latest
# token: ${{inputs.token}}
# path: ./pkg-example
# fetch-depth: 0
# fetch-tags: true

- name: Build example package for noble
shell: bash
run: |
mkdir -p build_noble
./scripts/docker_deb_build.py --source-dir pkg-example --output-dir build_noble --distro noble
# - name: Build example package for noble
# shell: bash
# run: |
# mkdir -p build_noble
# ./scripts/docker_deb_build.py --source-dir pkg-example --output-dir build_noble --distro noble

- name: Build example package for questing
shell: bash
run: |
mkdir -p build_questing
./scripts/docker_deb_build.py --source-dir pkg-example --output-dir build_questing --distro questing
# - name: Build example package for questing
# shell: bash
# run: |
# mkdir -p build_questing
# ./scripts/docker_deb_build.py --source-dir pkg-example --output-dir build_questing --distro questing

# Don't push to GHCR if build was triggered by a PR
- name: Push to GHCR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,5 +248,6 @@ jobs:
gh auth login --with-token <<< "${{secrets.TOKEN}}"

../qcom-build-utils/scripts/create_promotion_pr.py \
--base-branch "${{inputs.debian-branch}}" \
--upstream-tag "${{inputs.upstream-tag}}" \
--normalized-version "${{env.NORMALIZED_VERSION}}"
16 changes: 11 additions & 5 deletions .github/workflows/qcom-release-reusable-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ on:
type: string
required: true

debian-branch:
description: The debian branch to use to execute the release from. For example branch "debian/qcom-next"
type: string
required: false
default: debian/qcom-next

distro-codename:
description: The distribution codename to build for. Ex noble, jammy, etc
type: string
Expand Down Expand Up @@ -78,7 +84,7 @@ jobs:
fetch-tags: true

# Take the latest changelog entry and change the suite name from UNRELEASED to unstable and set timestamp and tag
# the debian/latest branch to debian/<version> where <version> is the version from the changelog. It is conceptually
# the inputs.debian-branch branch to debian/<version> where <version> is the version from the changelog. It is conceptually
# important that the changelog entry suite is UNRELEASED at any point except in the commit that represents the release.
# The commit that represents the release is created in this step and shall only contain the changelog change from UNRELEASED to unstable.
- name: Changelog suite name change
Expand All @@ -92,7 +98,7 @@ jobs:
export DEBFULLNAME="${{vars.DEB_PKG_BOT_CI_NAME}}"
export DEBEMAIL="${{vars.DEB_PKG_BOT_CI_EMAIL}}"

git checkout debian/latest
git checkout ${{inputs.debian-branch}}

echo "Initial changelog content:"
cat debian/changelog | sed 's/^/\x1b[34m/' | sed 's/$/\x1b[0m/'
Expand Down Expand Up @@ -135,9 +141,9 @@ jobs:
# Now, translate the upstream/* tag to the upstream tag it represents in the upstream repo


# Get the nearest reachable debian/* tag from debian/latest.
# Get the nearest reachable debian/* tag from inputs.debian-branch.
# This tag represents the packaging repository state for this release.
PACKAGE_REPO_TAG=$(git describe --tags --match 'debian/*' --abbrev=0 debian/latest)
PACKAGE_REPO_TAG=$(git describe --tags --match 'debian/*' --abbrev=0 ${{inputs.debian-branch}})

SOURCE=$(grep-dctrl -n -s Source -r '' debian/control | head -n1)

Expand Down Expand Up @@ -235,7 +241,7 @@ jobs:

git commit -a -m "Initial commit of new version ${newversion}"

git push origin debian/latest
git push origin ${{inputs.debian-branch}}
git push origin debian/${version}

git log --graph --oneline -n 10 --color=always
Expand Down
22 changes: 13 additions & 9 deletions scripts/create_promotion_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
def parse_arguments():
parser = argparse.ArgumentParser(description="Craft the content for a promotion PR and opoen it using GitHub CLI.")

parser.add_argument("--base-branch",
required=False,
default="debian/qcom-next",
help="Base branch for the promotion PR.")

parser.add_argument("--upstream-tag",
required=True,
help="Upstream tag corresponding to the version being promoted.")
Expand All @@ -32,13 +37,12 @@ def parse_arguments():
def create_pr_title(normalized_version: str) -> str:
return f"Promotion to {normalized_version}"

def create_pr_body(upstream_tag: str, normalized_version: str) -> str:
def create_pr_body(base_branch: str, upstream_tag: str, normalized_version: str) -> str:
pr_body = f"""
# This is an automated PR to test the promotion of this package repo to the upstream project version {normalized_version}.

This PR merges the upstream changes from the upstream tag '{upstream_tag}' into the debian/latest branch, and updated the debian/changelog version to reflect this new version. Whatever was the distro version before (the part after the '-' in a version x.y.z-a), it has been reset to -1.

The upstream tag '{upstream_tag}' has already been merged into the upstream/latest branch, and this PR merges that branch into debian/latest.
This PR merges the upstream changes from the upstream tag '{upstream_tag}' into the {base_branch} branch, and updated the debian/changelog version to reflect this new version. Whatever was the distro version before (the part after the '-' in a version x.y.z-a), it has been reset to -1.
The upstream tag '{upstream_tag}' has already been merged into the upstream/latest branch, and this PR merges that branch into {base_branch}.
In other words, this repo already contains the upstream changes in the upstream/latest branch, but the debian packaging is not yet updated to reflect this new upstream version. This is what this PR is doing.

The *build-debian-package.yml* workflow is triggered automatically in this PR to test the promotion by building the Debian package with the updated upstream code and packaging.
Expand All @@ -58,7 +62,7 @@ def create_pr_body(upstream_tag: str, normalized_version: str) -> str:
special git wizardry happened to perform a special filtering of any potential upstream .github/ and debian/ folders have been filtered out,
and only homonym folders from the debian/latest branch have been kept.
- To its left, this 'debian/pr/{normalized_version}-1' branch was created during the promotion workflow and is the head branch of this PR.
It represents the merge of the upstream/latest branch into debian/latest.
It represents the merge of the upstream/latest branch into {base_branch}.
- Note that an extra commit for updating the debian/changelog file to reflect the new version {normalized_version}-1 has been added on top of that merge.
"""

Expand All @@ -73,7 +77,7 @@ def create_pr_body(upstream_tag: str, normalized_version: str) -> str:
rotateCommitLabel: true
---
gitGraph BT:
branch debian/latest order: 1
branch {base_branch} order: 1
branch upstream-main order: 4
branch upstream/latest order: 3
checkout main
Expand All @@ -86,7 +90,7 @@ def create_pr_body(upstream_tag: str, normalized_version: str) -> str:
checkout upstream/latest
commit id: 'previous stuff'
merge upstream-main id: 'Filtered .github/debian folders' tag: 'upstream/{normalized_version}'
checkout debian/latest
checkout {base_branch}
commit
commit
commit
Expand All @@ -104,13 +108,13 @@ def main():
logger.debug(f"Print of the arguments: {args}")

pr_title = create_pr_title(args.normalized_version)
pr_body = create_pr_body(args.upstream_tag, args.normalized_version)
pr_body = create_pr_body(args.base_branch, args.upstream_tag, args.normalized_version)

# Printing the pr body in a .md file for manual review:
with open("promotion_pr_body.md", "w") as pr_body_file:
pr_body_file.write(pr_body)

pr_creation_command = f"gh pr create --title '{pr_title}' --body-file promotion_pr_body.md --base debian/latest --head debian/pr/{args.normalized_version}-1"
pr_creation_command = f"gh pr create --title '{pr_title}' --body-file promotion_pr_body.md --base {args.base_branch} --head debian/pr/{args.normalized_version}-1"

# Executing the PR creation command using GitHub CLI
subprocess.run(pr_creation_command, shell=True, check=True)
Expand Down
Loading