Add option target imgref#50
Merged
Merged
Conversation
Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Reviewer's GuideAdds a new optional --target-imgref flag for cluster and node creation to override the bootc-tracked image reference inside the VM, wires it through Node and cloud-init data, and validates it via an integration test that checks bootc status. Sequence diagram for applying TargetImgRef inside VM via cloud-initsequenceDiagram
participant User
participant StartCmd
participant Node
participant CloudInit
participant bootc
User->>StartCmd: bink cluster start --target-imgref VALUE
StartCmd->>Node: WithTargetImgRef(targetImgRef)
Node->>Node: newCloudInitData(sshPubKey)
Node->>CloudInit: render user-data.yaml.tmpl (TargetImgRef)
CloudInit->>CloudInit: [TargetImgRef not empty]
CloudInit->>bootc: bootc status --json
bootc-->>CloudInit: deploySerial, checksum
CloudInit->>CloudInit: sed container-image-reference=ostree-unverified-registry:TargetImgRef
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The
sedline inuser-data.yaml.tmpldirectly embeds{{.TargetImgRef}}into a single-quoted script, which will break if the image reference ever contains a single quote; consider escaping the value or using double quotes + proper shell escaping to make this robust. - In the cloud-init
runcmdsnippet you invokebootc status --jsontwice withjq; you could run it once and reuse the parsed JSON or at least the shell variable to reduce duplication and potential inconsistencies.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `sed` line in `user-data.yaml.tmpl` directly embeds `{{.TargetImgRef}}` into a single-quoted script, which will break if the image reference ever contains a single quote; consider escaping the value or using double quotes + proper shell escaping to make this robust.
- In the cloud-init `runcmd` snippet you invoke `bootc status --json` twice with `jq`; you could run it once and reuse the parsed JSON or at least the shell variable to reduce duplication and potential inconsistencies.
## Individual Comments
### Comment 1
<location path="internal/node/templates/user-data.yaml.tmpl" line_range="91-92" />
<code_context>
+{{- if .TargetImgRef}}
+ - |
+ mount -o remount,rw /sysroot
+ DEPLOY_PATH=$(bootc status --json | jq -r '.status.booted.ostree.deploySerial // empty')
+ CHECKSUM=$(bootc status --json | jq -r '.status.booted.ostree.checksum')
+ ORIGIN="/ostree/deploy/default/deploy/${CHECKSUM}.${DEPLOY_PATH}.origin"
+ sed -i 's|^container-image-reference=.*|container-image-reference=ostree-unverified-registry:{{.TargetImgRef}}|' "$ORIGIN"
</code_context>
<issue_to_address>
**suggestion (performance):** bootc status is invoked twice; capturing it once would be simpler and avoid redundant work.
Consider running `bootc status --json` once (e.g., `STATUS=$(bootc status --json)`) and deriving both `DEPLOY_PATH` and `CHECKSUM` from that variable. This avoids duplicate work and guarantees both values come from the same status snapshot.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
Overwrite the reported bootc image. In this way, we can reference the image from the local registry.
Fixes: #45
Summary by Sourcery
Add support for overriding the bootc image reference tracked by cluster nodes via a new CLI option and propagate it through node configuration and initialization.
New Features:
Tests: