Skip to content

build: add tags local build option#260

Open
amd-aliem wants to merge 1 commit into
AMDEPYC:mainfrom
amd-aliem:local-build-tags
Open

build: add tags local build option#260
amd-aliem wants to merge 1 commit into
AMDEPYC:mainfrom
amd-aliem:local-build-tags

Conversation

@amd-aliem

Copy link
Copy Markdown
Contributor

Building locally often gets you rate-limited by GH, since we do not support authenticated calls. Add a make tags option that pre-fetches the tags. Due to how mkosi handles environments, this is done by creating an environment file and passing it to the mkosi command.

This commit does not affect the normal CI image builds, as the images/Makefile is just for local development.

Add `make tags` to images/ Makefile, to be used in local builds
if/when a developer starts encountering rate limit errors from
the Github API.

Signed-off-by: Amanda Liem <aliem@amd.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a local-development workflow to prefetch GitHub release tags once and pass them into mkosi builds via an env file, reducing unauthenticated GitHub API calls during local image builds.

Changes:

  • Document a new make tags step for local builds to generate a .tags env file with dependency release tags.
  • Add a tags target to images/Makefile to fetch latest release tags from GitHub and write them to .tags.
  • Ignore the generated images/.tags file in .gitignore.

Reviewed changes

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

File Description
images/README.md Documents the new make tags local-build step and how tags are injected into mkosi.
images/Makefile Adds GitHub tag fetching and passes an env file into mkosi builds.
.gitignore Ignores the generated images/.tags file.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread images/Makefile
Comment on lines 33 to +34
$(IMAGES):
mkosi --image-id=$@ -C $@ build
mkosi --image-id=$@ -C $@ --env-file=../.tags build
Comment thread images/Makefile
Comment on lines +5 to +16
GH_LATEST = curl -sf $(GH_AUTH) https://api.github.com/repos/$(1)/releases/latest | jq -r '.tag_name'

.PHONY: all clean list status tags $(IMAGES) $(CLEAN_IMAGES)

tags:
@printf '%s\n' \
"SNPGUEST_TAG=$$($(call GH_LATEST,virtee/snpguest))" \
"BEACON_TAG=$$($(call GH_LATEST,AMDEPYC/beacon))" \
"SNPHOST_TAG=$$($(call GH_LATEST,virtee/snphost))" \
> .tags \
|| { echo "Failed to fetch tags. Try: export GITHUB_TOKEN=\$$(gh auth token)"; exit 1; }
@cat .tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants