Skip to content

Enable pre-merge packaging via a manual promotion #10626

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 10, 2025

Conversation

nelljerram
Copy link
Member

Sometimes we want to test a change in our Calico/OpenStack ST (calico-test) before merging it. But the Calico/OpenStack ST is driven by packaged code, so this means we need to package the pre-merge code. The changes in this PR enable that, as follows:

  1. Push the relevant code to a branch of github.com/projectcalico/calico. It must be that repo, not a fork, because the process needs secrets that we don't share with forks.

  2. Create a PR from that branch.

  3. Create a PPA at https://launchpad.net/~project-calico named pr-<N>, where <N> is the number of the PR. (If that PPA doesn't already exist.)

  4. Click the "Publish openstack packages" promotion.

That should result in packages with the pre-merge code being uploaded to the pr-<N> PPA. When those have been built and published, you can push a branch to github.com/tigera/calico-test with, for example:

modified   build_and_run_fv.sh
@@ -23,7 +23,7 @@ CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD`
 : ${BUILD_NUMBER:=0}
 : ${WORKSPACE:="$(pwd)"}
 : ${PKG_SRC_STEM:='master'}
-: ${INSTALL_SOURCE:=""}
+: ${INSTALL_SOURCE:="ppa:project-calico/pr-10610"}
 # PKG_SRC_STEM is only used if INSTALL_SOURCE is not set.
 : ${TEST_BRANCH:=${CURRENT_BRANCH}}
 : ${TEST_REQ:='smoke'}

and that will kick off an ST run using that PPA.

Sometimes we want to test a change in our Calico/OpenStack ST (`calico-test`) before merging it.
But the Calico/OpenStack ST is driven by packaged code, so this means we need to package the
pre-merge code.  The changes in this PR enable that, as follows:

1. Push the relevant code to a branch of github.com/projectcalico/calico.  It must be that repo, not
a fork, because the process needs secrets that we don't share with forks.

2. Create a PR from that branch.

3. Create a PPA at https://launchpad.net/~project-calico named `pr-<N>`, where `<N>` is the number
of the PR.  (If that PPA doesn't already exist.)

4. Click the "Publish openstack packages" promotion.

That should result in packages with the pre-merge code being uploaded to the `pr-<N>` PPA.  When
those have been built and published, you can push a branch to github.com/tigera/calico-test with,
for example:

    modified   build_and_run_fv.sh
    @@ -23,7 +23,7 @@ CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD`
     : ${BUILD_NUMBER:=0}
     : ${WORKSPACE:="$(pwd)"}
     : ${PKG_SRC_STEM:='master'}
    -: ${INSTALL_SOURCE:=""}
    +: ${INSTALL_SOURCE:="ppa:project-calico/pr-10610"}
     # PKG_SRC_STEM is only used if INSTALL_SOURCE is not set.
     : ${TEST_BRANCH:=${CURRENT_BRANCH}}
     : ${TEST_REQ:='smoke'}

and that will kick off an ST run using that PPA.
@Copilot Copilot AI review requested due to automatic review settings July 2, 2025 15:41
@nelljerram nelljerram requested a review from a team as a code owner July 2, 2025 15:41
@marvin-tigera marvin-tigera added this to the Calico v3.31.0 milestone Jul 2, 2025
@marvin-tigera marvin-tigera added release-note-required Change has user-facing impact (no matter how small) docs-pr-required Change is not yet documented labels Jul 2, 2025
@nelljerram nelljerram added docs-not-required Docs not required for this change release-note-not-required Change has no user-facing impact and removed release-note-required Change has user-facing impact (no matter how small) docs-pr-required Change is not yet documented labels Jul 2, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enables manual pre-merge packaging for Calico/OpenStack ST by recognizing PR branches and exposing a CI promotion for them.

  • Support pr-<N> version pattern in the packaging script to set REPO_NAME for pre-merge PPAs.
  • Update Semaphore CI to show the "Publish openstack packages" button on PRs and publish to pr-<PR_NUMBER> PPA.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
release/packaging/utils/create-update-packages.sh Added pr-<number> pattern to require_version for PR branches
.semaphore/push-images/packaging.yaml Enabled packaging promotion on PRs and conditional PPA publish
Comments suppressed due to low confidence (4)

release/packaging/utils/create-update-packages.sh:69

  • [nitpick] Consider adding a brief comment above this elif explaining that it handles pre-merge PR packaging with pr-<PR_NUMBER>, to improve clarity for future maintainers.
    elif [[ $VERSION =~ ^pr-[0-9]+$ ]]; then

.semaphore/push-images/packaging.yaml:39

  • [nitpick] This comment block is indented two spaces but the surrounding comments use four spaces. Align comment indentation with the YAML block for readability.
  # branches, and PRs, it is available but not automatic.  This means a

.semaphore/push-images/packaging.yaml:56

  • Quote the constructed VERSION string to prevent word-splitting or globbing (e.g., VERSION="pr-${SEMAPHORE_GIT_PR_NUMBER}").
            - if [ -n "${SEMAPHORE_GIT_PR_NUMBER}" ]; then make -C release/packaging release-publish VERSION=pr-$SEMAPHORE_GIT_PR_NUMBER; fi

release/packaging/utils/create-update-packages.sh:69

  • [nitpick] Indentation appears mixed (spaces vs. tabs) between this line and the following assignment. Please standardize on spaces for consistent script formatting.
    elif [[ $VERSION =~ ^pr-[0-9]+$ ]]; then

Copy link
Member

@fasaxc fasaxc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice if there was a way to automate creation of PPAs, or re-use PPAs for multiple builds but this seems like a step in the right direction, even with extra manual steps needed.

@nelljerram
Copy link
Member Author

Indeed, I will take another look at that. I think I looked at the time of originating the packaging code, and it wasn't possible at that time, but maybe I was wrong, or things have changed.

@nelljerram
Copy link
Member Author

(In future work, I mean. Will bank this PR now.)

@nelljerram nelljerram merged commit f43b0fd into projectcalico:master Jul 10, 2025
6 of 8 checks passed
@nelljerram nelljerram deleted the pre-merge-packaging branch July 10, 2025 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-not-required Docs not required for this change release-note-not-required Change has no user-facing impact
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants