cloudapi: Make container name and tag optional
If the user does not pass a name, use the distribution as a name A provided tag is used only if name is provided. It The tag's default is a generated using UUID to avoid collisions
This commit is contained in:
parent
1847a6ae05
commit
ca32d7b729
4 changed files with 122 additions and 117 deletions
|
|
@ -375,8 +375,17 @@ func (h *apiHandlers) PostCompose(ctx echo.Context) error {
|
|||
return HTTPError(ErrorJSONUnMarshallingError)
|
||||
}
|
||||
|
||||
var name = request.Distribution
|
||||
var tag = uuid.New().String()
|
||||
if containerUploadOptions.Name != nil {
|
||||
name = *containerUploadOptions.Name
|
||||
if containerUploadOptions.Tag != nil {
|
||||
tag = *containerUploadOptions.Tag
|
||||
}
|
||||
}
|
||||
|
||||
t := target.NewContainerTarget(&target.ContainerTargetOptions{})
|
||||
t.ImageName = fmt.Sprintf("%s:%s", containerUploadOptions.Name, containerUploadOptions.Tag)
|
||||
t.ImageName = fmt.Sprintf("%s:%s", name, tag)
|
||||
t.OsbuildArtifact.ExportFilename = imageType.Filename()
|
||||
|
||||
irTarget = t
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue