Skip to content

Commit 738cb39

Browse files
committed
cmd-push-container-manifest: change image key schema
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 #3122
1 parent d335641 commit 738cb39

File tree

7 files changed

+27
-91
lines changed

7 files changed

+27
-91
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: 3508b2f150e72b8e24151d870789809cf4070cec6b4716966a4e8bc585e0c5f1
4+
// source hash: 1e32ab25dfdd0724f8e8246008b9d91b88a40e9ea834cf779ab0da818bf1cf25
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"`
@@ -134,10 +130,6 @@ type Extensions struct {
134130
Sha256 string `json:"sha256"`
135131
}
136132

137-
type ExtensionsContainer struct {
138-
Image string `json:"image"`
139-
}
140-
141133
type Gcp struct {
142134
ImageFamily string `json:"family,omitempty"`
143135
ImageName string `json:"image"`
@@ -154,7 +146,7 @@ type Git struct {
154146

155147
type Image struct {
156148
Comment string `json:"comment,omitempty"`
157-
Digest string `json:"digest"`
149+
Digest string `json:"digest,omitempty"`
158150
Image string `json:"image"`
159151
}
160152

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: 3508b2f150e72b8e24151d870789809cf4070cec6b4716966a4e8bc585e0c5f1
2+
// Source hash: 1e32ab25dfdd0724f8e8246008b9d91b88a40e9ea834cf779ab0da818bf1cf25
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": {
@@ -882,31 +882,13 @@ var generatedSchemaJSON = `{
882882
"$id": "#/properties/base-oscontainer",
883883
"type": "object",
884884
"title": "Base OS container",
885-
"required": [
886-
"image"
887-
],
888-
"properties": {
889-
"image": {
890-
"$id": "#/properties/base-oscontainer/image",
891-
"type": "string",
892-
"title": "Image"
893-
}
894-
}
885+
"$ref": "#/definitions/image"
895886
},
896887
"extensions-container": {
897888
"$id": "#/properties/extensions-container",
898889
"type": "object",
899890
"title": "Extensions container",
900-
"required": [
901-
"image"
902-
],
903-
"properties": {
904-
"image": {
905-
"$id": "#/properties/extensions-container/image",
906-
"type": "string",
907-
"title": "Image"
908-
}
909-
}
891+
"$ref": "#/definitions/image"
910892
},
911893
"gcp": {
912894
"$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: 3 additions & 21 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": {
@@ -876,31 +876,13 @@
876876
"$id": "#/properties/base-oscontainer",
877877
"type": "object",
878878
"title": "Base OS container",
879-
"required": [
880-
"image"
881-
],
882-
"properties": {
883-
"image": {
884-
"$id": "#/properties/base-oscontainer/image",
885-
"type": "string",
886-
"title": "Image"
887-
}
888-
}
879+
"$ref": "#/definitions/image"
889880
},
890881
"extensions-container": {
891882
"$id": "#/properties/extensions-container",
892883
"type": "object",
893884
"title": "Extensions container",
894-
"required": [
895-
"image"
896-
],
897-
"properties": {
898-
"image": {
899-
"$id": "#/properties/extensions-container/image",
900-
"type": "string",
901-
"title": "Image"
902-
}
903-
}
885+
"$ref": "#/definitions/image"
904886
},
905887
"gcp": {
906888
"$id": "#/properties/gcp",

0 commit comments

Comments
 (0)