bootc-dev / bootc-dev/bootc

Conflation between OCI labels and annotations

Aperta
#2,227 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Rust
Stelle
2.3k
Fork
230
Merge medio
3g 3h
PR unite (30g)
36

Descrizione

This came up in a chat.

We use the OCI annotation keys `org.opencontainers.image.created` and `org.opencontainers.image.version`, however at a glance it looks like we're inconsistent on whether we use those keys when looking at actual annotations, or rather looking at the labels on the container. Those are not the same thing. Quick AI-assisted dump of some places this comes up:

---

## Instances of annotation constants used to query labels

| File | Line | Constant | Queried from |
|------|------|----------|-------------|
| `crates/lib/src/status.rs` | 205 | `ANNOTATION_CREATED` | config labels |
| `crates/lib/src/install/aleph.rs` | 55 | `ANNOTATION_CREATED` | config labels |
| `crates/ostree-ext/src/container/mod.rs` | 490 | `ANNOTATION_VERSION` | config labels |

## Correct usages (for comparison)

| File | Line | Constant | Queried from |
|------|------|----------|-------------|
| `crates/ostree-ext/src/container/store.rs` | 597 | `ANNOTATION_CREATED` | manifest annotations |
| `crates/lib/src/bootc_composefs/status.rs` | 514 | `ANNOTATION_VERSION` | manifest annotations |

## Additional observations

1. **`ANNOTATION_VERSION` is less problematic in practice** because the write-side in `crates/ostree-ext/src/container/encapsulate.rs:265-318` intentionally writes the version to **both** config labels and manifest annotations. And for non-ostree-ext-built images, Dockerfiles typically use `LABEL org.opencontainers.image.version=...`, so it ends up in labels anyway.

2. **`ANNOTATION_CREATED` is the more problematic one.** The encapsulate code does *not* write it into labels — it only sets `config.set_created()`. So the label lookup at `status.rs:205` and `aleph.rs:55` will almost never match; they're saved by the fallback to `config.created()`.

3. **There's an inconsistency between the ostree and composefs code paths.** The composefs status code (`bootc_composefs/status.rs:514`) correctly reads `ANNOTATION_VERSION` from manifest annotations, while the ostree status code (`status.rs:211` via `version_for_config`) reads it from config labels. These could diverge for images where the value is only in one location.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia leggendo i lookup indicati in crates/lib/src/status.rs, crates/lib/src/install/aleph.rs, crates/ostree-ext/src/container/mod.rs e le corrispondenti letture del manifest in store.rs e bootc_composefs/status.rs. Confrontali con i percorsi di scrittura in crates/ostree-ext/src/container/encapsulate.rs e con il fallback per la creazione della config. Il lavoro è completato quando i percorsi interessati distinguono coerentemente tra config labels e manifest annotations e preservano il comportamento previsto per la versione e il tempo di creazione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
rust
Ambito
devops
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.