build: add tags local build option#260
Open
amd-aliem wants to merge 1 commit into
Open
Conversation
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>
There was a problem hiding this comment.
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 tagsstep for local builds to generate a.tagsenv file with dependency release tags. - Add a
tagstarget toimages/Makefileto fetch latest release tags from GitHub and write them to.tags. - Ignore the generated
images/.tagsfile 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 on lines
33
to
+34
| $(IMAGES): | ||
| mkosi --image-id=$@ -C $@ build | ||
| mkosi --image-id=$@ -C $@ --env-file=../.tags build |
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Building locally often gets you rate-limited by GH, since we do not support authenticated calls. Add a
make tagsoption 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.