-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: build and push image index #81
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,77 +16,81 @@ import ( | |
) | ||
|
||
type Entry struct { | ||
Artifact api.Artifact | ||
Artifacts []api.Artifact | ||
UseForDocs bool | ||
UseForLatest bool | ||
SkipWhenNotFocused bool | ||
} | ||
|
||
var staticRegistry = []Entry{ | ||
{ | ||
Artifact: centos.New("8.4", nil), | ||
Artifacts: []api.Artifact{ | ||
centos.New("8.4", nil), | ||
}, | ||
UseForDocs: false, | ||
}, | ||
{ | ||
Artifact: centos.New( | ||
"7-2009", | ||
defaultEnvVariables("u1.small", "centos.7"), | ||
), | ||
Artifacts: []api.Artifact{ | ||
centos.New("7-2009", defaultEnvVariables("u1.small", "centos.7")), | ||
}, | ||
UseForDocs: true, | ||
}, | ||
{ | ||
Artifact: centosstream.New( | ||
"9", | ||
&docs.UserData{ | ||
Username: "cloud-user", | ||
}, | ||
defaultEnvVariables("u1.small", "centos.stream9"), | ||
), | ||
Artifacts: []api.Artifact{ | ||
centosstream.New("9", &docs.UserData{Username: "cloud-user"}, defaultEnvVariables("u1.small", "centos.stream9")), | ||
}, | ||
UseForDocs: true, | ||
}, | ||
{ | ||
Artifact: centosstream.New( | ||
"8", | ||
&docs.UserData{ | ||
Username: "centos", | ||
}, | ||
defaultEnvVariables("u1.small", "centos.stream8"), | ||
), | ||
Artifacts: []api.Artifact{ | ||
centosstream.New("8", &docs.UserData{Username: "centos"}, defaultEnvVariables("u1.small", "centos.stream8")), | ||
}, | ||
UseForDocs: false, | ||
}, | ||
{ | ||
Artifact: ubuntu.New( | ||
"22.04", | ||
defaultEnvVariables("u1.small", "ubuntu"), | ||
), | ||
Artifacts: []api.Artifact{ | ||
ubuntu.New("22.04", defaultEnvVariables("u1.small", "ubuntu")), | ||
}, | ||
UseForDocs: true, | ||
}, | ||
{ | ||
Artifact: ubuntu.New( | ||
"20.04", | ||
defaultEnvVariables("u1.small", "ubuntu"), | ||
), | ||
Artifacts: []api.Artifact{ | ||
ubuntu.New("20.04", defaultEnvVariables("u1.small", "ubuntu")), | ||
}, | ||
UseForDocs: false, | ||
}, | ||
{ | ||
Artifact: ubuntu.New( | ||
"18.04", | ||
defaultEnvVariables("u1.small", "ubuntu"), | ||
), | ||
Artifacts: []api.Artifact{ | ||
ubuntu.New("18.04", defaultEnvVariables("u1.small", "ubuntu")), | ||
}, | ||
UseForDocs: false, | ||
}, | ||
// for testing only | ||
{ | ||
Artifact: generic.New( | ||
&api.ArtifactDetails{ | ||
SHA256Sum: "cc704ab14342c1c8a8d91b66a7fc611d921c8b8f1aaf4695f9d6463d913fa8d1", | ||
DownloadURL: "https://download.cirros-cloud.net/0.6.1/cirros-0.6.1-x86_64-disk.img", | ||
}, | ||
&api.Metadata{ | ||
Name: "cirros", | ||
Version: "6.1", | ||
}, | ||
), | ||
Artifacts: []api.Artifact{ | ||
codingben marked this conversation as resolved.
Show resolved
Hide resolved
|
||
generic.New( | ||
&api.ArtifactDetails{ | ||
SHA256Sum: "cc704ab14342c1c8a8d91b66a7fc611d921c8b8f1aaf4695f9d6463d913fa8d1", | ||
DownloadURL: "https://download.cirros-cloud.net/0.6.1/cirros-0.6.1-x86_64-disk.img", | ||
ImageArchitecture: "amd64", | ||
}, | ||
&api.Metadata{ | ||
Name: "cirros", | ||
Version: "6.1", | ||
}, | ||
), | ||
generic.New( | ||
&api.ArtifactDetails{ | ||
SHA256Sum: "db9420c481c11dee17860aa46fb1a3efa05fa4fb152726d6344e24da03cb0ccf", | ||
DownloadURL: "https://download.cirros-cloud.net/0.6.1/cirros-0.6.1-aarch64-disk.img", | ||
ImageArchitecture: "arm64", | ||
}, | ||
&api.Metadata{ | ||
Name: "cirros", | ||
Version: "6.1", | ||
}, | ||
), | ||
}, | ||
SkipWhenNotFocused: true, | ||
UseForDocs: false, | ||
}, | ||
|
@@ -100,7 +104,7 @@ func gatherArtifacts(registry *[]Entry, gatherers []api.ArtifactsGatherer) { | |
} else { | ||
for i := range artifacts { | ||
*registry = append(*registry, Entry{ | ||
Artifact: artifacts[i], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That still looks wrong. The gatherer needs to return artifacts with multiple architectures and this loop needs to append them to the registry. ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you reviewed old revision. This is how it looks like today:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I reviewed the "left" side. The new is still wrong, since like this it probably run out of range. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah got it, thanks Felix! :) |
||
Artifacts: artifacts[i], | ||
UseForDocs: i == 0, | ||
UseForLatest: i == 0, | ||
}) | ||
|
@@ -131,12 +135,16 @@ func ShouldSkip(focus string, entry *Entry) bool { | |
return entry.SkipWhenNotFocused | ||
} | ||
|
||
if len(entry.Artifacts) == 0 { | ||
return true | ||
} | ||
|
||
focusSplit := strings.Split(focus, ":") | ||
wildcardFocus := len(focusSplit) == 2 && focusSplit[1] == "*" | ||
|
||
if wildcardFocus { | ||
return focusSplit[0] != entry.Artifact.Metadata().Name | ||
return focusSplit[0] != entry.Artifacts[0].Metadata().Name | ||
} | ||
|
||
return focus != entry.Artifact.Metadata().Describe() | ||
return focus != entry.Artifacts[0].Metadata().Describe() | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,10 +60,12 @@ func run(options *common.Options) error { | |
} | ||
|
||
focusMatched = true | ||
log := common.Logger(p.Artifact) | ||
name := p.Artifact.Metadata().Name | ||
|
||
description, err := createDescription(p.Artifact, options.PublishDocsOptions.Registry) | ||
artifact := p.Artifacts[0] | ||
log := common.Logger(artifact) | ||
name := artifact.Metadata().Name | ||
|
||
description, err := createDescription(artifact, options.PublishDocsOptions.Registry) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should add the supported architectures into the description. Maybe in a follow up. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, let's take care of docs later. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please create an issue for that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done: #83 |
||
if err != nil { | ||
success = false | ||
log.Errorf("error marshaling example for %q: %v", name, err) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would export this as variable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be a const, yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I'll take care of it in another PR where we'll add also
arm64
images.