-
Notifications
You must be signed in to change notification settings - Fork 19
ci: fix workflow_dispatch handling in build workflows, tagging, and version metadata #75
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
Conversation
Move the buildbot version from duplicate workflow env blocks to a single .github/buildbot-version file. Signed-off-by: Petr Štetiar <ynezz@true.cz>
Add CONTAINER_TAG build argument to indicate whether the container was built from a tag (v25), PR (pr-73), or branch (main). This makes it easier to identify which version of the container is running. While at it, drop Docker prefix to make it shorter. Signed-off-by: Petr Štetiar <ynezz@true.cz>
The old name was misleading as it suggested an OpenWrt release version. The variable holds the git SHA of this buildbot config repository, used for quick URL links to the configuration commit. Signed-off-by: Petr Štetiar <ynezz@true.cz>
Currently workflow_dispatch pushes branch tags, so lets fix it by disabling branch tagging for dispatch runs. Signed-off-by: Petr Štetiar <ynezz@true.cz>
…ildx
Without explicit context, docker/build-push-action defaults to fetching
from the GitHub repository using github.sha as the ref. For workflow_dispatch
events, github.sha points to the default branch (main), not the checked-out
PR ref. This caused PR container builds to contain main branch code instead
of the PR changes.
With `context: .` makes Docker build uses the locally checked-out files
from refs/pull/{N}/merge.
The issue was identified by inspecting the workflow run logs which showed:
docker buildx build ... https://github.com/openwrt/buildbot.git#93918cc2e2257ae8838166d2baad30617295df4e
The #93918cc2... ref at the end is the main branch SHA, not the PR merge
commit. This is the default behavior when context is not specified - the
action uses ${{ github.server_url }}/${{ github.repository }}.git#${{ github.sha }}
Signed-off-by: Petr Štetiar <ynezz@true.cz>
1a56e9c to
f92acc6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ci: fix workflow_dispatch on PRs by using local context for docker buildx
Without explicit context, docker/build-push-action defaults to fetching
from the GitHub repository using github.sha as the ref. For workflow_dispatch
events, github.sha points to the default branch (main), not the checked-out
PR ref. This caused PR container builds to contain main branch code instead
of the PR changes.
With
context: .makes Docker build uses the locally checked-out filesfrom refs/pull/{N}/merge.
The issue was identified by inspecting the workflow run logs which showed:
The #93918cc2... ref at the end is the main branch SHA, not the PR merge
commit. This is the default behavior when context is not specified - the
action uses ${{ github.server_url }}/${{ github.repository }}.git#${{ github.sha }}
ci: avoid branch tags on workflow_dispatch
Currently workflow_dispatch pushes branch tags, so lets fix it by
disabling branch tagging for dispatch runs.
ci: rename OPENWRT_VERSION to BUILDBOT_CONFIG_SHA
The old name was misleading as it suggested an OpenWrt release version.
The variable holds the git SHA of this buildbot config repository, used
for quick URL links to the configuration commit.
ci: add container version tag to BUILDWORKER_DESCRIPTION
Add CONTAINER_TAG build argument to indicate whether the container
was built from a tag (v25), PR (pr-73), or branch (main). This makes
it easier to identify which version of the container is running.
While at it, drop Docker prefix to make it shorter.
ci: centralize BUILDBOT_VERSION in a shared file
Move the buildbot version from duplicate workflow env blocks to a single
.github/buildbot-version file.