artifact: this represents the artifacts a manifest exports

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.
This commit is contained in:
Tom Gundersen 2022-07-12 21:10:37 +01:00 committed by Christian Kellner
parent 9b77e67576
commit ce40e1d810
10 changed files with 101 additions and 0 deletions

View file

@ -0,0 +1,31 @@
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
}