diff options
author | Vincent Ambo <tazjin@google.com> | 2019-11-05T12·57+0000 |
---|---|---|
committer | Vincent Ambo <github@tazj.in> | 2019-11-09T15·35+0000 |
commit | 3c2de4c037b52d20476a9c47d53a0e456229ae55 (patch) | |
tree | 3f2e444f21aed55d0b9144d50067320a9af0a59c /tools/nixery/server/manifest/manifest.go | |
parent | 7afbc912ceff01044b291388d1e0f567ac24bdef (diff) |
refactor(builder): Parameterise CPU architecture to use for images
Adds the CPU architecture to the image configuration. This will make it possible to let users toggle architecture via meta-packages. Relates to #13
Diffstat (limited to 'tools/nixery/server/manifest/manifest.go')
-rw-r--r-- | tools/nixery/server/manifest/manifest.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/tools/nixery/server/manifest/manifest.go b/tools/nixery/server/manifest/manifest.go index 11fef3ff0d0c..0d36826fb7e5 100644 --- a/tools/nixery/server/manifest/manifest.go +++ b/tools/nixery/server/manifest/manifest.go @@ -33,7 +33,6 @@ const ( configType = "application/vnd.docker.container.image.v1+json" // image config constants - arch = "amd64" os = "linux" fsType = "layers" ) @@ -84,7 +83,7 @@ type ConfigLayer struct { // Outside of this module the image configuration is treated as an // opaque blob and it is thus returned as an already serialised byte // array and its SHA256-hash. -func configLayer(hashes []string) ConfigLayer { +func configLayer(arch string, hashes []string) ConfigLayer { c := imageConfig{} c.Architecture = arch c.OS = os @@ -104,7 +103,7 @@ func configLayer(hashes []string) ConfigLayer { // layer. // // Callers do not need to set the media type for the layer entries. -func Manifest(layers []Entry) (json.RawMessage, ConfigLayer) { +func Manifest(arch string, layers []Entry) (json.RawMessage, ConfigLayer) { // Sort layers by their merge rating, from highest to lowest. // This makes it likely for a contiguous chain of shared image // layers to appear at the beginning of a layer. @@ -123,7 +122,7 @@ func Manifest(layers []Entry) (json.RawMessage, ConfigLayer) { layers[i] = l } - c := configLayer(hashes) + c := configLayer(arch, hashes) m := manifest{ SchemaVersion: schemaVersion, |