When the Koji target support was added to the osbuild job, based on the osbuild-koji job, the meaning of target option values got messed up. The side effect of the issue is that when Koji composes are submitted via Cloud API the resulting image is currently always uploaded back to the worker server. `OsBuildKoji` job ----------------- - `OSBuildKojiJob.ImageName` is set to the filename of the image as exported by osbuild. - `OSBuildKojiJob.KojiFilename` is set to the desired filename which should be used when uploading the image to Koji. `OsBuild` job + `KojiTargetOptions` before ------------------------------------------ - `OSBuildJob.ImageName` is set to the filename of the image as exported by osbuild. This is done only by the Cloud API code for Koji composes. Cloud API does not set this for regular composes and any other target. The variable is set in common case only by Weldr API code with the same meaning and it is used by the `OsBuild` job implementation as an indication that the image should be uploaded back to the worker server. - `Target.ImageName` is not set at all. Other targets use it for the desired filename which should be used when uploading the image to the target environment. - `KojiTargetOptions.Filename` is set to the desired filename which should be used when uploading the image to Koji. All other target types use `Filename` variable in their options for the filename of the image as exported by osbuild. `OsBuild` job + `KojiTargetOptions` after ----------------------------------------- - `OSBuildJob.ImageName` is still set to the filename of the image as exported by osbuild. This is kept for a backward compatibility of new composer with older workers. - `Target.ImageName` is set to the desired filename which should be used when uploading the image to Koji. - `KojiTargetOptions.Filename` is set to the filename of the image as exported by osbuild. This change is backward incompatible, meaning that old worker won't be able to handle Koji compose requests submitted via Cloud API using a new composer and also a new worker won't be able to handle Koji compose requests submitted by a new composer. This is intentional, because after discussion with Ondrej Budai, the Cloud API Koji integration is currently not used anywhere in production.
25 lines
710 B
Go
25 lines
710 B
Go
package target
|
|
|
|
type KojiTargetOptions struct {
|
|
// Filename of the image as produced by osbuild for a given export
|
|
Filename string `json:"filename"`
|
|
UploadDirectory string `json:"upload_directory"`
|
|
Server string `json:"server"`
|
|
}
|
|
|
|
func (KojiTargetOptions) isTargetOptions() {}
|
|
|
|
func NewKojiTarget(options *KojiTargetOptions) *Target {
|
|
return newTarget("org.osbuild.koji", options)
|
|
}
|
|
|
|
type KojiTargetResultOptions struct {
|
|
ImageMD5 string `json:"image_md5"`
|
|
ImageSize uint64 `json:"image_size"`
|
|
}
|
|
|
|
func (KojiTargetResultOptions) isTargetResultOptions() {}
|
|
|
|
func NewKojiTargetResult(options *KojiTargetResultOptions) *TargetResult {
|
|
return newTargetResult("org.osbuild.koji", options)
|
|
}
|