Skip to content

Commit

Permalink
adding basic structure to store / think about labels
Browse files Browse the repository at this point in the history
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
  • Loading branch information
vsoch committed Aug 28, 2021
1 parent d2f649d commit 7470864
Show file tree
Hide file tree
Showing 9 changed files with 258 additions and 87 deletions.
38 changes: 35 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,43 @@ $ $ ./containerspec host
{x86 [] [generic] 0 [] map[]}
```

### Container Update

**Under development** I'd like to have commands that can read a Dockerfile, or
a directory / repository of `Dockerfile`s, and be able to tell us:

1. Is the digest up to date?
2. Are there new tags we might want to build?

And then this can be integrated into a GitHub action. The reason this is packaged
here is because if this tool can parse and reason about `Dockerfile`, we want to
make sure that we add the right metadata (for now, `LABEL`s) that can then inform
about later compatibility.

I'm not decided yet about how to implement this, but I want the following:

For base images and updating them:

1. User can target a Dockerfile directly for one off update, or a folder with tags for scaled
2. Read in Dockerfile, keep track of labels and FROMS (add dockerfile parser)
3. Look at labels to see if a tag is there for the hash
4. For each FROM, look up list of tags, update hash
5. For each FROM, if a label exists after it for opencontainers, delete it
6. Update label to use new tag

Try to use the labels here with [opencontainers labels](https://github.com/opencontainers/image-spec/blob/main/annotations.md)
So far we have the following labels demonstrated in [this paper](https://conferences.computer.org/sc19w/2019/pdfs/CANOPIE-HPC2019-7nd7J7oXBlGtzeJIHi79mM/3AyZkyZVlhldzPU6UEo655/3OqM2Lkt9DqiE2sDu1jvaS.pdf):

| Label | Values | Comment |
|-------|--------|---------|
| org.supercontainers.mpi| {mpich,openmpi} |Required MPI support, ABI compatibility|
| org.supercontainers.gpu| {cuda,opencl,rocm, etc} |Required GPU library support|
| org.supercontainers.glibc| Semantic version: XX.YY.Z |Specific version of GLIBC|


# TODO
# TODO for host matching

- define "database" of architectures
- archspec/archspec-go doesn't have parsing / matching functions?
- start with a basic container with some mpi and operating system
- create a grid that can generate the "same" container with different operating systems
- create a library and extract from the container:
Expand All @@ -59,4 +91,4 @@ $ $ ./containerspec host

## Previous Art

- [archspec](https://github.com/archspec/archspec): by the Spack team, which provides a database of architectures to start with.
- [archspec](https://github.com/archspec/archspec): by the Spack team, which provides the database of architectures to start with. We want to use [archspec-go](https://github.com/archspec/archspec-go) which I don't think is done yet.
6 changes: 5 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ module github.com/vsoch/containerspec

go 1.13

require github.com/DataDrake/cli-ng/v2 v2.0.2 // indirect
require (
github.com/DataDrake/cli-ng/v2 v2.0.2 // indirect
github.com/archspec/archspec-go v0.0.0-20200618083206-89a4a3fc5891 // indirect
github.com/scylladb/go-set v1.0.2 // indirect
)
9 changes: 9 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
github.com/DataDrake/cli-ng/v2 v2.0.2 h1:7+25l25VmlERCE95glW6QKBUF13vxqAM2jasFiN02xQ=
github.com/DataDrake/cli-ng/v2 v2.0.2/go.mod h1:bU9YaNNWWVq0eIdDsU3TCe9+7Jb398iBBoqee5EiKWQ=
github.com/archspec/archspec-go v0.0.0-20200618083206-89a4a3fc5891 h1:onl72E6v1+IdcE+muOrNPt3e4LnNByKCaESJnAIHZ4Y=
github.com/archspec/archspec-go v0.0.0-20200618083206-89a4a3fc5891/go.mod h1:YHtgXFjfzDUzAU+aLdLgo3uO2NuSRNqcV7gcJosdBRA=
github.com/fatih/set v0.2.1/go.mod h1:+RKtMCH+favT2+3YecHGxcc0b4KyVWA1QWWJUs4E0CI=
github.com/rakyll/statik v0.1.6 h1:uICcfUXpgqtw2VopbIncslhAmE5hwc4g20TEyEENBNs=
github.com/rakyll/statik v0.1.6/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs=
github.com/scylladb/go-set v1.0.2 h1:SkvlMCKhP0wyyct6j+0IHJkBkSZL+TDzZ4E7f7BCcRE=
github.com/scylladb/go-set v1.0.2/go.mod h1:DkpGd78rljTxKAnTDPFqXSGxvETQnJyuSOQwsHycqfs=
30 changes: 30 additions & 0 deletions labels/labels.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package labels

// Labels for the supercontainers metadata

type Label struct {
Key string
Value string
Allowed []string
Description string
}

var Labels = map[string]Label{
"org.supercontainers.mpi": {
Key: "org.supercontainers.mpi",
Allowed: []string{"mpich", "openmpi", "unknown"},
Description: "Required MPI support, ABI compatibility",
},

"org.supercontainers.gpu": {
Key: "org.supercontainers.gpu",
Allowed: []string{"cuda", "opencl", "rocm", "unknown"},
Description: "Required GPU library support",
},

// TODO this can be validated by regex for semver when parsed
"org.supercontainers.glibc": {
Key: "org.supercontainers.gpu",
Description: "Specific version of GLIBC, in Semantic format XX.YY.Z",
},
}

0 comments on commit 7470864

Please sign in to comment.