Skip to content

feat(status): display pinned deployments #1285

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

p5
Copy link
Contributor

@p5 p5 commented Apr 25, 2025

Part of #904

Displays pinned deployments as part of "bootc status".
Includes unit tests to ensure correct parsing of the
pinned deployments, and that they are displayed in
human readable formats correctly.


Please find below how they look in both human and machine readable formats.
When the staged, booted or rollback deployments are pinned, the information is not duplicated in the outputs.

Please let me know if this output format is alright, or if you'd prefer some changes.

Human readable:

❯ sudo ./target/debug/bootc status          
[sudo] password for admin: 
  Staged image: ghcr.io/rsturla/eternal-linux/lumina:42-nvidia-open
        Digest: sha256:b1874fbb5f442657f3cc07a547c54292ca3f24fe828ab4f3132df4c9f23f1e3e (amd64)
       Version: 250425 (2025-04-25T01:46:32Z)

● Booted image: ghcr.io/rsturla/eternal-linux/lumina:42-nvidia-open
        Digest: sha256:90fd7bc0675e923511a6edabb2e584f752feddbf8f90e0d610f7fc63d3e03f23 (amd64)
       Version: 250423 (2025-04-23T01:46:06Z)

  Rollback image: ghcr.io/rsturla/eternal-linux/lumina:42-nvidia-open
          Digest: sha256:d646e4981e034c0ef3b74fbf5eb7f47016e4475f47e5c706369a974b699e15be (amd64)
         Version: 250421 (2025-04-21T01:47:16Z)
          Pinned: yes

  Pinned image: ghcr.io/rsturla/eternal-linux/lumina:stable-nvidia-open
        Digest: sha256:79403bb8be5515a7937710310a68020724c25488ba687269832189e6375da227 (amd64)
       Version: 250329 (2025-03-29T01:44:28Z)
        Pinned: yes

YAML:

❯ sudo ./target/debug/bootc status --format yaml
apiVersion: org.containers.bootc/v1
kind: BootcHost
metadata:
  name: host
spec:
  image:
    image: ghcr.io/rsturla/eternal-linux/lumina:42-nvidia-open
    transport: registry
    signature: containerPolicy
  bootOrder: default
status:
  staged:
    image:
      image:
        image: ghcr.io/rsturla/eternal-linux/lumina:42-nvidia-open
        transport: registry
        signature: containerPolicy
      version: '250425'
      timestamp: 2025-04-25T01:46:32Z
      imageDigest: sha256:b1874fbb5f442657f3cc07a547c54292ca3f24fe828ab4f3132df4c9f23f1e3e
      architecture: amd64
    cachedUpdate: null
    incompatible: false
    pinned: false
    store: ostreeContainer
    ostree:
      checksum: cac59f70910b5ef683d1e6589609789d104d206c18089efa14b51619466cfe17
      deploySerial: 0
  booted:
    image:
      image:
        image: ghcr.io/rsturla/eternal-linux/lumina:42-nvidia-open
        transport: registry
        signature: containerPolicy
      version: '250423'
      timestamp: 2025-04-23T01:46:06Z
      imageDigest: sha256:90fd7bc0675e923511a6edabb2e584f752feddbf8f90e0d610f7fc63d3e03f23
      architecture: amd64
    cachedUpdate:
      image:
        image: ghcr.io/rsturla/eternal-linux/lumina:42-nvidia-open
        transport: registry
        signature: containerPolicy
      version: '250425'
      timestamp: 2025-04-25T01:46:32Z
      imageDigest: sha256:b1874fbb5f442657f3cc07a547c54292ca3f24fe828ab4f3132df4c9f23f1e3e
      architecture: amd64
    incompatible: false
    pinned: false
    store: ostreeContainer
    ostree:
      checksum: db384322a96b78905985502d96bbeb7cedf0f26ec06603eab0aa7e7bc0f419ff
      deploySerial: 0
  rollback:
    image:
      image:
        image: ghcr.io/rsturla/eternal-linux/lumina:42-nvidia-open
        transport: registry
        signature: containerPolicy
      version: '250421'
      timestamp: 2025-04-21T01:47:16Z
      imageDigest: sha256:d646e4981e034c0ef3b74fbf5eb7f47016e4475f47e5c706369a974b699e15be
      architecture: amd64
    cachedUpdate:
      image:
        image: ghcr.io/rsturla/eternal-linux/lumina:42-nvidia-open
        transport: registry
        signature: containerPolicy
      version: '250423'
      timestamp: 2025-04-23T01:46:06Z
      imageDigest: sha256:90fd7bc0675e923511a6edabb2e584f752feddbf8f90e0d610f7fc63d3e03f23
      architecture: amd64
    incompatible: false
    pinned: false
    store: ostreeContainer
    ostree:
      checksum: a4570046dd6a34a3228fe74851505e2953682ca58fbe79d4760c2230baf71580
      deploySerial: 0
  rollbackQueued: false
  pinned:
  - image:
      image:
        image: ghcr.io/rsturla/eternal-linux/lumina:stable-nvidia-open
        transport: registry
        signature: containerPolicy
      version: '250329'
      timestamp: 2025-03-29T01:44:28Z
      imageDigest: sha256:79403bb8be5515a7937710310a68020724c25488ba687269832189e6375da227
      architecture: amd64
    cachedUpdate:
      image:
        image: ghcr.io/rsturla/eternal-linux/lumina:stable-nvidia-open
        transport: registry
        signature: containerPolicy
      version: '250401'
      timestamp: 2025-04-01T02:11:10Z
      imageDigest: sha256:1d7d40408ca6eda7a355162c7a89646d0f99b17b426eb95323fa6bd1ab4ebb85
      architecture: amd64
    incompatible: false
    pinned: true
    store: ostreeContainer
    ostree:
      checksum: 99b2cc3b6edce9ebaef6a6076effa5ee3e1dcff3523016ffc94a1b27c6c67e12
      deploySerial: 0
  type: bootcHost

YAML with rollback pinned:

❯ sudo ./target/debug/bootc status --format yaml
apiVersion: org.containers.bootc/v1
kind: BootcHost
metadata:
  name: host
spec:
  image:
    image: ghcr.io/rsturla/eternal-linux/lumina:42-nvidia-open
    transport: registry
    signature: containerPolicy
  bootOrder: default
status:
  staged:
    image:
      image:
        image: ghcr.io/rsturla/eternal-linux/lumina:42-nvidia-open
        transport: registry
        signature: containerPolicy
      version: '250425'
      timestamp: 2025-04-25T01:46:32Z
      imageDigest: sha256:b1874fbb5f442657f3cc07a547c54292ca3f24fe828ab4f3132df4c9f23f1e3e
      architecture: amd64
    cachedUpdate: null
    incompatible: false
    pinned: false
    store: ostreeContainer
    ostree:
      checksum: cac59f70910b5ef683d1e6589609789d104d206c18089efa14b51619466cfe17
      deploySerial: 0
  booted:
    image:
      image:
        image: ghcr.io/rsturla/eternal-linux/lumina:42-nvidia-open
        transport: registry
        signature: containerPolicy
      version: '250423'
      timestamp: 2025-04-23T01:46:06Z
      imageDigest: sha256:90fd7bc0675e923511a6edabb2e584f752feddbf8f90e0d610f7fc63d3e03f23
      architecture: amd64
    cachedUpdate:
      image:
        image: ghcr.io/rsturla/eternal-linux/lumina:42-nvidia-open
        transport: registry
        signature: containerPolicy
      version: '250425'
      timestamp: 2025-04-25T01:46:32Z
      imageDigest: sha256:b1874fbb5f442657f3cc07a547c54292ca3f24fe828ab4f3132df4c9f23f1e3e
      architecture: amd64
    incompatible: false
    pinned: false
    store: ostreeContainer
    ostree:
      checksum: db384322a96b78905985502d96bbeb7cedf0f26ec06603eab0aa7e7bc0f419ff
      deploySerial: 0
  rollback:
    image:
      image:
        image: ghcr.io/rsturla/eternal-linux/lumina:42-nvidia-open
        transport: registry
        signature: containerPolicy
      version: '250421'
      timestamp: 2025-04-21T01:47:16Z
      imageDigest: sha256:d646e4981e034c0ef3b74fbf5eb7f47016e4475f47e5c706369a974b699e15be
      architecture: amd64
    cachedUpdate:
      image:
        image: ghcr.io/rsturla/eternal-linux/lumina:42-nvidia-open
        transport: registry
        signature: containerPolicy
      version: '250423'
      timestamp: 2025-04-23T01:46:06Z
      imageDigest: sha256:90fd7bc0675e923511a6edabb2e584f752feddbf8f90e0d610f7fc63d3e03f23
      architecture: amd64
    incompatible: false
    pinned: true
    store: ostreeContainer
    ostree:
      checksum: a4570046dd6a34a3228fe74851505e2953682ca58fbe79d4760c2230baf71580
      deploySerial: 0
  rollbackQueued: false
  pinned:
  - image:
      image:
        image: ghcr.io/rsturla/eternal-linux/lumina:stable-nvidia-open
        transport: registry
        signature: containerPolicy
      version: '250329'
      timestamp: 2025-03-29T01:44:28Z
      imageDigest: sha256:79403bb8be5515a7937710310a68020724c25488ba687269832189e6375da227
      architecture: amd64
    cachedUpdate:
      image:
        image: ghcr.io/rsturla/eternal-linux/lumina:stable-nvidia-open
        transport: registry
        signature: containerPolicy
      version: '250401'
      timestamp: 2025-04-01T02:11:10Z
      imageDigest: sha256:1d7d40408ca6eda7a355162c7a89646d0f99b17b426eb95323fa6bd1ab4ebb85
      architecture: amd64
    incompatible: false
    pinned: true
    store: ostreeContainer
    ostree:
      checksum: 99b2cc3b6edce9ebaef6a6076effa5ee3e1dcff3523016ffc94a1b27c6c67e12
      deploySerial: 0
  type: bootcHost

@p5 p5 force-pushed the readonly-pinning branch 3 times, most recently from 12f9499 to 82f0a72 Compare April 25, 2025 17:37
@p5 p5 marked this pull request as ready for review April 25, 2025 17:38
Part of bootc-dev#904

Displays pinned deployments as part of "bootc status".
Includes unit tests to ensure correct parsing of the
pinned deployments, and that they are displayed in
human readable formats correctly.

Signed-off-by: Robert Sturla <[email protected]>
@p5 p5 force-pushed the readonly-pinning branch from 82f0a72 to 5f6622c Compare April 26, 2025 21:34
Comment on lines -362 to +374
fn human_render_imagestatus(
fn human_render_image_deployment(
Copy link
Contributor Author

@p5 p5 Apr 26, 2025

Choose a reason for hiding this comment

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

I feel this function may need a larger rework than this PR can handle.

● Booted image: ghcr.io/rsturla/eternal-linux/lumina:42-nvidia-open
        Digest: sha256:b1874fbb5f442657f3cc07a547c54292ca3f24fe828ab4f3132df4c9f23f1e3e (amd64)
       Version: 250425 (2025-04-25T01:46:32Z)

  Rollback image: ghcr.io/rsturla/eternal-linux/lumina:42-nvidia-open
          Digest: sha256:b1874fbb5f442657f3cc07a547c54292ca3f24fe828ab4f3132df4c9f23f1e3e (amd64)
         Version: 250425 (2025-04-25T01:46:32Z)

Rather than each block above being an "image", I feel it makes more sense being a "deployment" since it contains more information than just the image. For example, the index, pinned state, /usr overlay state etc. #1258 also updates this function to include HostStatus in order to access the /usr overlay state.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Rather than each block above being an "image", I feel it makes more sense being a "deployment" since it contains more information than just the image.

Right, we can change the function to take a BootEntry instead right? Actually I went ahead and tried that, can you review #1291 and then we'll rebase on that?

Copy link
Collaborator

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

Thanks so much for working on this!!

Comment on lines +256 to +264
let pinned = deployments
.other
.iter()
.filter_map(|d| {
d.is_pinned()
.then(|| boot_entry_from_deployment(sysroot, d).ok())
})
.collect::<Option<Vec<_>>>()
.filter(|v| !v.is_empty());
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it feels duplicative to include the "primary" outputs (staged/booted/rollback) additionally in the pinned set.

WDYT about instead operating on the other deployment list?

Though that basically scope creeps into generally showing information about those arbitrary other deployments which we don't do now either.

Copy link
Contributor Author

@p5 p5 Apr 29, 2025

Choose a reason for hiding this comment

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

I think it feels duplicative to include the "primary" outputs (staged/booted/rollback) additionally in the pinned set.

In this case, the primary outputs are not duplicated into the "pinned" object. They are already filtered out before reaching this point (deployments.other excludes staged/booted/rollback).

I'm happy with this approach though, and instead of specifically storing pinned deployments inside the HostStatus, storing all other deployments as a BootEntry array.

@@ -336,6 +346,7 @@ pub enum Slot {
Staged,
Booted,
Rollback,
Pinned,
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we follow the above suggestion I think instead of having a Slot for this we'd just display the other deployments unconditionally.

Copy link
Contributor Author

@p5 p5 Apr 29, 2025

Choose a reason for hiding this comment

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

What do you consider to be a "Slot"?
If we were operating on "Other" deployments, would these be considered "Other" slots? Or would these be deployments without a Slot?

My view as an outsider is of a "Slot" basically being a type of boot entry, where any image you're able to boot into should have a Slot, but I appreciate this probably isn't an accurate description once knowing the internals.

Comment on lines -362 to +374
fn human_render_imagestatus(
fn human_render_image_deployment(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rather than each block above being an "image", I feel it makes more sense being a "deployment" since it contains more information than just the image.

Right, we can change the function to take a BootEntry instead right? Actually I went ahead and tried that, can you review #1291 and then we'll rebase on that?

cgwalters added a commit that referenced this pull request Apr 29, 2025
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