debian-forge-composer/internal/target/azure_image_target.go
Tomáš Hozza 5b414a4516 Target: expose osbuild artifact information in target result
Add the information about osbuid artifact to the target result.
Specifically the name of the osbuild pipeline which was exported for the
specific target, and the filename of the exported file.

This will later enable embedding this information in Koji build metadata
to make it easy to reproduce the image build using the attached
manifest.
2023-09-27 12:39:28 +02:00

44 lines
1.7 KiB
Go

package target
const TargetNameAzureImage TargetName = "org.osbuild.azure.image"
type AzureImageTargetOptions struct {
TenantID string `json:"tenant_id"`
Location string `json:"location,omitempty"`
SubscriptionID string `json:"subscription_id"`
ResourceGroup string `json:"resource_group"`
}
func (AzureImageTargetOptions) isTargetOptions() {}
// NewAzureImageTarget creates org.osbuild.azure.image target
//
// This target uploads and registers an Azure Image. The image can be then
// immediately used to spin up a virtual machine.
//
// The target uses Azure OAuth credentials. In most cases you want to create
// a service principal for this purpose, see:
// https://docs.microsoft.com/en-us/azure/active-directory/develop/app-objects-and-service-principals
// The credentials are not passed in the target options, instead they are
// defined in the worker. If the worker doesn't have Azure credentials
// and gets a job with this target, the job will fail.
//
// The Tenant ID for the authorization process is specified in the target
// options. This means that this target can be used for multi-tenant
// applications.
//
// If you need to just upload a PageBlob into Azure Storage, see the
// org.osbuild.azure target.
func NewAzureImageTarget(options *AzureImageTargetOptions) *Target {
return newTarget(TargetNameAzureImage, options)
}
type AzureImageTargetResultOptions struct {
ImageName string `json:"image_name"`
}
func (AzureImageTargetResultOptions) isTargetResultOptions() {}
func NewAzureImageTargetResult(options *AzureImageTargetResultOptions, artifact *OsbuildArtifact) *TargetResult {
return newTargetResult(TargetNameAzureImage, options, artifact)
}