For now this encapsulates osbuild export and filename in that exported tree. In the future we could add MIME type. For now this is a concrete type, but should probably be an interface, so the consumer of artefacts know they are the right type. Enforcing we only push AMIs to EC2, etc. Similarly to how checkpoints work, each pipeline can be marked for export, and the manifest can return all the names of the exported pipelines, to be passed to osbuild. Additionally, the Export function returns an artefact object, which can be used to know how to access the exports once osbuild is done. For now, this is unused.
31 lines
523 B
Go
31 lines
523 B
Go
package artifact
|
|
|
|
type Artifact struct {
|
|
export string
|
|
filename string
|
|
mimeType string
|
|
}
|
|
|
|
func New(export, filename string, mimeType *string) *Artifact {
|
|
artifact := &Artifact{
|
|
export: export,
|
|
filename: filename,
|
|
mimeType: "application/octet-stream",
|
|
}
|
|
if mimeType != nil {
|
|
artifact.mimeType = *mimeType
|
|
}
|
|
return artifact
|
|
}
|
|
|
|
func (a *Artifact) Export() string {
|
|
return a.export
|
|
}
|
|
|
|
func (a *Artifact) Filename() string {
|
|
return a.filename
|
|
}
|
|
|
|
func (a *Artifact) MIMEType() string {
|
|
return a.mimeType
|
|
}
|