Publishing worked; everything after it did not. Four things were wrong and each was silent in its own way. Versions were compared as text, so asking for "gromacs" with 2024.9 and 2024.10 published returned 2024.9. The whole meaning of an unversioned reference is "the newest one", and it was a wrong answer rather than a missing one - invisible until somebody noticed they had spent a week on last year's build. A recipe could hold one version while the catalogue could hold many, so an update either destroyed what it replaced or grew a parallel directory sharing nothing with the first. Recipes now carry a list, and the single-version form is read into the same shape, so nothing downstream knows which was written. An image was named by a mutable tag. Whoever repushes gromacs:2024.4 changed what every rebuilt cluster received, silently, and the record meant to freeze the cluster froze only its opinion of it. Two hashes are now recorded because they are checkable in different places: the manifest digest answers "has this moved" from the control plane, and the SIF hash is the only one a head can check with no network and no credential - which matters, because the head is where a wrong image does harm. Pulling by digest is deliberately not done: whether this Apptainer accepts an @sha256: reference is not established, and a provision failing at its last task over untested syntax would be worse than the problem. Module and binaries had been in the catalogue since it was written and were read by nothing - Module was referenced nowhere in the program. So a tenant was handed /opt/apps/gromacs.sif and left to work out Apptainer. They now become a wrapper per binary and an Lmod modulefile, and the answer is `module load gromacs`. Whether to pass --nv is decided on the node at run time: passing it without a driver fails outright, and omitting it where there is one leaves the job on the CPU saying nothing at all, which is the dangerous one. Four states replace `published:`. A withdrawn entry stays in the catalogue file, because dropping it would make it indistinguishable from one that never existed - and that difference is what an operator needs when a cluster is found still holding it. A pinned reference to one is refused with the recorded reason instead of "no application", which would send the user hunting for a typo in a correct name. The portal re-reads the catalogue when it changes, so publishing an application no longer needs a restart - the step that is invisible when forgotten. C20 ships the catalogue, which nothing did. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
62 lines
2.4 KiB
Go
62 lines
2.4 KiB
Go
package catalog
|
|
|
|
// Status is where an application is in its life.
|
|
//
|
|
// Until now an entry was on or off: `published:` in the recipe, overridden by
|
|
// whether the registry really held the tag. Two states where four are needed,
|
|
// and the missing two are the ones that matter after publication.
|
|
//
|
|
// draft never reaches this file at all - the generator leaves it out, because
|
|
// the image does not exist and offering it would fail a provision at its last
|
|
// task. The other three are all recorded here, including withdrawn: the
|
|
// catalogue is the record of what has been published, not only of what may be
|
|
// asked for today. Dropping a withdrawn entry would make it indistinguishable
|
|
// from one that never existed, and the difference is exactly what an operator
|
|
// needs when a cluster is found still holding it.
|
|
type Status string
|
|
|
|
const (
|
|
// StatusAvailable is the normal state.
|
|
StatusAvailable Status = "available"
|
|
// StatusDeprecated still works and is still supported. A newer version
|
|
// exists, so it is offered but is not what an unversioned reference
|
|
// resolves to.
|
|
StatusDeprecated Status = "deprecated"
|
|
// StatusWithdrawn must not be started on anything new. The image stays
|
|
// in the registry, because clusters already holding it may be rebuilt.
|
|
StatusWithdrawn Status = "withdrawn"
|
|
// StatusDraft has no image yet. It should not appear in a generated
|
|
// catalogue; it is recognised so that one which does is understood
|
|
// rather than treated as available.
|
|
StatusDraft Status = "draft"
|
|
)
|
|
|
|
// Status reports the entry's state, defaulting to available.
|
|
//
|
|
// Empty means available on purpose: every catalogue generated before this
|
|
// existed says nothing, and reading that as "not offered" would take every
|
|
// application off the plan page the moment this code shipped.
|
|
func (a App) Status() Status {
|
|
switch Status(a.StatusField) {
|
|
case StatusDeprecated:
|
|
return StatusDeprecated
|
|
case StatusWithdrawn:
|
|
return StatusWithdrawn
|
|
case StatusDraft:
|
|
return StatusDraft
|
|
default:
|
|
return StatusAvailable
|
|
}
|
|
}
|
|
|
|
// Offered reports whether a new cluster may ask for this.
|
|
//
|
|
// Deprecated is offered. Refusing it would break the pin of every user who
|
|
// named that version deliberately, which is the opposite of what deprecating
|
|
// something is for: it is a statement that a newer one exists, not that this
|
|
// one has stopped working.
|
|
func (a App) Offered() bool {
|
|
s := a.Status()
|
|
return s == StatusAvailable || s == StatusDeprecated
|
|
}
|