Skip to content

Commit a84bfc7

Browse files
committed
cmd-push-container-manifest: change image format
The `oscontainer` and `base-oscontainer` keys should follow the same schema. Currently, the former has a `digest` field, while the other one does not. Tweak `cosa push-container-manifest` and `cosa push-container` so that they follows the new schema. (Though note the latter command will be deleted soon). To keep previous 4.12 `meta.json` files valid, this loosens the `image` schema definition so that `digest` is now optional. Once we branch for 4.12, we will undo this change so that it becomes required again. Fixes coreos#3122
1 parent e4bf879 commit a84bfc7

File tree

7 files changed

+28
-92
lines changed

7 files changed

+28
-92
lines changed

mantle/vendor/github.com/coreos/coreos-assembler/pkg/builds/cosa_v1.go

Lines changed: 4 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mantle/vendor/github.com/coreos/coreos-assembler/pkg/builds/schema_doc.go

Lines changed: 4 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/builds/cosa_v1.go

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package builds
22

33
// generated by 'make schema'
4-
// source hash: 144450d458f89f637ca487d353af3dfd60096ddbf3179da8e2b42b2bd2d0a6eb
4+
// source hash: 1a456ce336dcdcc026bc6c3bb171f8a3a71cb39bebd38986e6e9ef3a2a25cf73
55

66
type AdvisoryDiff []AdvisoryDiffItems
77

@@ -27,18 +27,14 @@ type Artifact struct {
2727
UncompressedSize int `json:"uncompressed-size,omitempty"`
2828
}
2929

30-
type BaseOsContainer struct {
31-
Image string `json:"image"`
32-
}
33-
3430
type Build struct {
3531
AdvisoryDiffAgainstParent AdvisoryDiff `json:"parent-advisories-diff,omitempty"`
3632
AdvisoryDiffBetweenBuilds AdvisoryDiff `json:"advisories-diff,omitempty"`
3733
AlibabaAliyunUploads []AliyunImage `json:"aliyun,omitempty"`
3834
Amis []Amis `json:"amis,omitempty"`
3935
Architecture string `json:"coreos-assembler.basearch,omitempty"`
4036
Azure *Cloudartifact `json:"azure,omitempty"`
41-
BaseOsContainer *BaseOsContainer `json:"base-oscontainer,omitempty"`
37+
BaseOsContainer *Image `json:"base-oscontainer,omitempty"`
4238
BuildArtifacts *BuildArtifacts `json:"images,omitempty"`
4339
BuildID string `json:"buildid"`
4440
BuildRef string `json:"ref,omitempty"`
@@ -54,7 +50,7 @@ type Build struct {
5450
CosaImageChecksum string `json:"coreos-assembler.image-config-checksum,omitempty"`
5551
CosaImageVersion int `json:"coreos-assembler.image-genver,omitempty"`
5652
Extensions *Extensions `json:"extensions,omitempty"`
57-
ExtensionsContainer *ExtensionsContainer `json:"extensions-container,omitempty"`
53+
ExtensionsContainer *Image `json:"extensions-container,omitempty"`
5854
FedoraCoreOsParentCommit string `json:"fedora-coreos.parent-commit,omitempty"`
5955
FedoraCoreOsParentVersion string `json:"fedora-coreos.parent-version,omitempty"`
6056
Gcp *Gcp `json:"gcp,omitempty"`
@@ -133,10 +129,6 @@ type Extensions struct {
133129
Sha256 string `json:"sha256"`
134130
}
135131

136-
type ExtensionsContainer struct {
137-
Image string `json:"image"`
138-
}
139-
140132
type Gcp struct {
141133
ImageFamily string `json:"family,omitempty"`
142134
ImageName string `json:"image"`
@@ -153,7 +145,7 @@ type Git struct {
153145

154146
type Image struct {
155147
Comment string `json:"comment,omitempty"`
156-
Digest string `json:"digest"`
148+
Digest string `json:"digest,omitempty"`
157149
Image string `json:"image"`
158150
}
159151

pkg/builds/schema_doc.go

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated by ./generate-schema.sh
2-
// Source hash: 144450d458f89f637ca487d353af3dfd60096ddbf3179da8e2b42b2bd2d0a6eb
2+
// Source hash: 1a456ce336dcdcc026bc6c3bb171f8a3a71cb39bebd38986e6e9ef3a2a25cf73
33
// DO NOT EDIT
44

55
package builds
@@ -56,10 +56,10 @@ var generatedSchemaJSON = `{
5656
"image": {
5757
"type": "object",
5858
"required": [
59-
"digest",
6059
"image"
6160
],
6261
"optional": [
62+
"digest",
6363
"comment"
6464
],
6565
"properties": {
@@ -875,31 +875,13 @@ var generatedSchemaJSON = `{
875875
"$id": "#/properties/base-oscontainer",
876876
"type": "object",
877877
"title": "Base OS container",
878-
"required": [
879-
"image"
880-
],
881-
"properties": {
882-
"image": {
883-
"$id": "#/properties/base-oscontainer/image",
884-
"type": "string",
885-
"title": "Image"
886-
}
887-
}
878+
"$ref": "#/definitions/image"
888879
},
889880
"extensions-container": {
890881
"$id": "#/properties/extensions-container",
891882
"type": "object",
892883
"title": "Extensions container",
893-
"required": [
894-
"image"
895-
],
896-
"properties": {
897-
"image": {
898-
"$id": "#/properties/extensions-container/image",
899-
"type": "string",
900-
"title": "Image"
901-
}
902-
}
884+
"$ref": "#/definitions/image"
903885
},
904886
"gcp": {
905887
"$id": "#/properties/gcp",

src/cmd-push-container

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ with tempfile.NamedTemporaryFile(dir='tmp', prefix='push-container-digestfile')
6868
container = 'base-oscontainer'
6969
if args.image != 'ostree':
7070
container = args.image
71-
meta[container] = {'image': f"{container_name}@{digest}"}
71+
meta[container] = {
72+
'image': container_name,
73+
'digest': digest
74+
}
7275
metapath_new = f"{metapath}.new"
7376
with open(metapath_new, 'w') as f:
7477
json.dump(meta, f, sort_keys=True)

src/cmd-push-container-manifest

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ def main():
6868

6969
# Update the meta.json in each build/arch metadata
7070
for _, buildmeta in buildmetas.items():
71-
buildmeta[args.metajsonname] = {'image': f"{args.repo}@{digest}"}
71+
buildmeta[args.metajsonname] = {
72+
'image': args.repo,
73+
'digest': digest
74+
}
7275
buildmeta.write(artifact_name=args.metajsonname)
7376

7477

src/v1.json

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@
5050
"image": {
5151
"type": "object",
5252
"required": [
53-
"digest",
5453
"image"
5554
],
5655
"optional": [
56+
"digest",
5757
"comment"
5858
],
5959
"properties": {
@@ -869,31 +869,13 @@
869869
"$id": "#/properties/base-oscontainer",
870870
"type": "object",
871871
"title": "Base OS container",
872-
"required": [
873-
"image"
874-
],
875-
"properties": {
876-
"image": {
877-
"$id": "#/properties/base-oscontainer/image",
878-
"type": "string",
879-
"title": "Image"
880-
}
881-
}
872+
"$ref": "#/definitions/image"
882873
},
883874
"extensions-container": {
884875
"$id": "#/properties/extensions-container",
885876
"type": "object",
886877
"title": "Extensions container",
887-
"required": [
888-
"image"
889-
],
890-
"properties": {
891-
"image": {
892-
"$id": "#/properties/extensions-container/image",
893-
"type": "string",
894-
"title": "Image"
895-
}
896-
}
878+
"$ref": "#/definitions/image"
897879
},
898880
"gcp": {
899881
"$id": "#/properties/gcp",
@@ -970,4 +952,4 @@
970952
"$ref": "#/definitions/image"
971953
}
972954
}
973-
}
955+
}

0 commit comments

Comments
 (0)