diff --git a/hack/cloud-image-uploader/aws.go b/hack/cloud-image-uploader/aws.go index a0d96c47ac..c67b7a3665 100644 --- a/hack/cloud-image-uploader/aws.go +++ b/hack/cloud-image-uploader/aws.go @@ -18,6 +18,7 @@ import ( "github.com/aws/aws-sdk-go/service/s3/s3manager" "github.com/google/uuid" "github.com/siderolabs/go-retry/retry" + "github.com/ulikunitz/xz" "golang.org/x/sync/errgroup" ) @@ -171,7 +172,7 @@ func (au *AWSUploader) registerAMIArch(ctx context.Context, region string, svc * defer source.Close() //nolint:errcheck - image, err := ExtractFileFromTarGz("disk.raw", source) + image, err := xz.NewReader(source) if err != nil { return err } diff --git a/hack/cloud-image-uploader/azure-disk-template.json b/hack/cloud-image-uploader/azure-disk-template.json deleted file mode 100644 index 5f59b9d6e9..0000000000 --- a/hack/cloud-image-uploader/azure-disk-template.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "disk_name": { - "defaultValue": null, - "type": "String" - }, - "storage_account": { - "defaultValue": null, - "type": "String" - }, - "vhd_name": { - "defaultValue": null, - "type": "String" - }, - "region": { - "defaultValue": null, - "type": "String" - }, - "architecture": { - "defaultValue": null, - "type": "String" - } - }, - "variables": {}, - "resources": [ - { - "type": "Microsoft.Compute/disks", - "apiVersion": "2022-07-02", - "name": "[parameters('disk_name')]", - "location": "[parameters('region')]", - "sku": { - "name": "Premium_LRS", - "tier": "Premium" - }, - "properties": { - "osType": "Linux", - "hyperVGeneration": "V2", - "supportedCapabilities": { - "architecture": "[parameters('architecture')]" - }, - "creationData": { - "createOption": "Import", - "storageAccountId": "[concat('/subscriptions/7f739b7d-f399-4b97-9a9f-f1962309ee6e/resourceGroups/SideroGallery/providers/Microsoft.Storage/storageAccounts/', parameters('storage_account'))]", - "sourceUri": "[concat('https://siderogallery.blob.core.windows.net/images/talos/', parameters('vhd_name'))]" - }, - "diskSizeGB": 8, - "diskIOPSReadWrite": 120, - "diskMBpsReadWrite": 25, - "encryption": { - "type": "EncryptionAtRestWithPlatformKey" - }, - "networkAccessPolicy": "AllowAll", - "publicNetworkAccess": "Enabled", - "dataAccessAuthMode": "None", - "diskState": "Unattached", - "tier": "P2" - } - } - ] - } \ No newline at end of file diff --git a/hack/cloud-image-uploader/azure-image-version-template.json b/hack/cloud-image-uploader/azure-image-version-template.json deleted file mode 100644 index 10f7af032e..0000000000 --- a/hack/cloud-image-uploader/azure-image-version-template.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "gallery_name": { - "defaultValue": null, - "type": "String" - }, - "disk_name": { - "defaultValue": null, - "type": "String" - }, - "image_version": { - "defaultValue": null, - "type": "String" - }, - "definition_name": { - "defaultValue": null, - "type": "String" - }, - "region": { - "defaultValue": null, - "type": "String" - }, - "resourceGroupName": { - "type": "String" - }, - "targetRegions": { - "type": "array" - } - }, - "variables": {}, - "resources": [ - { - "type": "Microsoft.Compute/galleries/images/versions", - "apiVersion": "2022-03-03", - "name": "[concat(parameters('gallery_name'), '/', parameters('definition_name'), '/', parameters('image_version'))]", - "location": "[parameters('region')]", - "properties": { - "publishingProfile": { - "targetRegions": "[parameters('targetRegions')]", - "replicaCount": 1, - "excludeFromLatest": false, - "storageAccountType": "Standard_LRS", - "replicationMode": "Full" - }, - "storageProfile": { - "osDiskImage": { - "hostCaching": "None", - "source": { - "id": "[concat('/subscriptions/7f739b7d-f399-4b97-9a9f-f1962309ee6e/resourceGroups/SIDEROGALLERY/providers/Microsoft.Compute/disks/', parameters('disk_name'))]" - } - } - }, - "safetyProfile": { - "allowDeletionOfReplicatedLocations": true - } - } - } - ] - } \ No newline at end of file diff --git a/hack/cloud-image-uploader/azure.go b/hack/cloud-image-uploader/azure.go index 69370a3f45..bce5c7a59a 100644 --- a/hack/cloud-image-uploader/azure.go +++ b/hack/cloud-image-uploader/azure.go @@ -8,7 +8,6 @@ import ( "bytes" "context" _ "embed" - "encoding/json" "fmt" "io" "log" @@ -19,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob" "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/pageblob" @@ -27,6 +26,7 @@ import ( "github.com/Azure/go-autorest/autorest/azure/auth" "github.com/hashicorp/go-version" "github.com/siderolabs/gen/channel" + "github.com/ulikunitz/xz" "golang.org/x/sync/errgroup" ) @@ -36,19 +36,6 @@ const ( storageAccount = "siderogallery" ) -//go:embed azure-disk-template.json -var azureDiskTemplate []byte - -//go:embed azure-image-version-template.json -var azureImageVersionTemplate []byte - -// TargetRegion describes the region to upload to. -type TargetRegion struct { - Name string `json:"name"` - RegionalReplicaCount int `json:"regionalReplicaCount"` - StorageAccountType string `json:"storageAccountType"` -} - // Mapping CPU architectures to Azure architectures. var azureArchitectures = map[string]string{ "amd64": "x64", @@ -74,11 +61,11 @@ func (azu *AzureUploader) setVersion() error { if fmt.Sprintf("v%s", versionCore) != azu.Options.AzureAbbrevTag { azu.Options.AzureGalleryName = "SideroGalleryTest" azu.Options.AzureCoreTag = versionCore - azu.Options.AzurePreRelease = "-prerelease" + fmt.Println(azu.Options.AzureGalleryName) } else { - azu.Options.AzureGalleryName = "SideroGallery" + azu.Options.AzureGalleryName = "SideroLabs" azu.Options.AzureCoreTag = versionCore - azu.Options.AzurePreRelease = "" + fmt.Println(azu.Options.AzureGalleryName) } return err @@ -93,7 +80,7 @@ func (azu *AzureUploader) AzureGalleryUpload(ctx context.Context) error { err = azu.setVersion() if err != nil { - log.Printf("azure: error setting version: %v\n", err) + return fmt.Errorf("azure: error setting version: %w", err) } log.Printf("azure: setting default creds") @@ -107,11 +94,11 @@ func (azu *AzureUploader) AzureGalleryUpload(ctx context.Context) error { err = azu.helper.getAzureLocations(ctx) if err != nil { - return fmt.Errorf("error setting default Azure credentials: %w", err) + return fmt.Errorf("azure: error setting default Azure credentials: %w", err) } // Upload blob - log.Printf("azure: creating disks for architectures: %+v\n", azu.Options.Architectures) + log.Printf("azure: uploading blobs for architectures: %+v\n", azu.Options.Architectures) for _, arch := range azu.Options.Architectures { arch := arch @@ -123,16 +110,10 @@ func (azu *AzureUploader) AzureGalleryUpload(ctx context.Context) error { return fmt.Errorf("azure: error uploading page blob for %s: %w", arch, err) } - log.Printf("azure: starting disk creation for %s\n", arch) - err = azu.createAzureDisk(ctx, azureDiskTemplate, arch) - if err != nil { - log.Printf("azure: error creating disk: %v\n", err) - } - log.Printf("azure: starting image version creation for %s\n", arch) - err = azu.createAzureImageVersion(ctx, azureImageVersionTemplate, arch) + err = azu.createAzureImageVersion(ctx, arch) if err != nil { - log.Printf("azure: error creating image version: %v\n", err) + return fmt.Errorf("azure: error creating image version: %w", err) } return err @@ -148,7 +129,7 @@ func (azu *AzureUploader) uploadAzureBlob(ctx context.Context, arch string) erro pageBlobClient, err := pageblob.NewClient(blobURL, azu.helper.cred, nil) if err != nil { - log.Printf("azure: error creating pageblob client: %v\n", err) + return fmt.Errorf("azure: error creating pageblob client: %w", err) } source, err := os.Open(azu.Options.AzureImage(arch)) @@ -159,9 +140,9 @@ func (azu *AzureUploader) uploadAzureBlob(ctx context.Context, arch string) erro defer source.Close() //nolint:errcheck // calculate totalSize - file, err := ExtractFileFromTarGz("disk.vhd", source) + file, err := xz.NewReader(source) if err != nil { - return fmt.Errorf("azure: error extracting file from tar.gz: %w", err) + return fmt.Errorf("azure: error extracting file from xz: %w", err) } totalSize, err := io.Copy(io.Discard, file) @@ -176,19 +157,19 @@ func (azu *AzureUploader) uploadAzureBlob(ctx context.Context, arch string) erro return fmt.Errorf("azure: error seeking back: %w", err) } - file, err = ExtractFileFromTarGz("disk.vhd", source) + file, err = xz.NewReader(source) if err != nil { - return fmt.Errorf("azure: error extracting file from tar.gz: %w", err) + return fmt.Errorf("azure: error extracting file from xz: %w", err) } // Check if the file size is a multiple of 512 bytes if totalSize%pageblob.PageBytes != 0 { - panic("azure: error: the file size must be a multiple of 512 bytes") + return fmt.Errorf("azure: error: the file size must be a multiple of 512 bytes") } _, err = pageBlobClient.Create(ctx, totalSize, nil) if err != nil { - log.Printf("azure: error creating vhd: %v\n", err) + return fmt.Errorf("azure: error creating vhd: %w", err) } type work struct { @@ -262,80 +243,105 @@ uploadLoop: return nil } -func (azu *AzureUploader) createAzureDisk(ctx context.Context, armTemplate []byte, arch string) error { - diskParameters := map[string]interface{}{ - "disk_name": map[string]string{ - "value": fmt.Sprintf("talos-%s-%s%s", arch, azu.Options.AzureCoreTag, azu.Options.AzurePreRelease), - }, - "storage_account": map[string]string{ - "value": storageAccount, - }, - "vhd_name": map[string]string{ - "value": fmt.Sprintf("talos-%s-%s.vhd", arch, azu.Options.Tag), - }, - "region": map[string]string{ - "value": defaultRegion, - }, - "architecture": map[string]string{ - "value": azureArchitectures[arch], - }, +func (azu *AzureUploader) createAzureImageVersion(ctx context.Context, arch string) error { + targetRegions := make([]*armcompute.TargetRegion, 0, len(azu.helper.locations)) + + for _, region := range azu.helper.locations { + targetRegions = append(targetRegions, &armcompute.TargetRegion{ + Name: to.Ptr(region.Name), + ExcludeFromLatest: to.Ptr(false), + RegionalReplicaCount: to.Ptr[int32](1), + StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), + }) } - deploymentName := fmt.Sprintf("disk-talos-%s-%s", arch, azu.Options.Tag) + pager := azu.helper.clientFactory.NewGalleryImageVersionsClient().NewListByGalleryImagePager(resourceGroupName, azu.Options.AzureGalleryName, fmt.Sprintf("talos-%s", azureArchitectures[arch]), nil) - if err := azu.helper.deployResourceFromTemplate(ctx, armTemplate, diskParameters, deploymentName); err != nil { - return fmt.Errorf("azure: error applying Azure disk template: %w", err) - } + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + return fmt.Errorf("azure: failed to list image versions: %w", err) + } - return nil -} + for _, v := range page.Value { + if *v.Name == azu.Options.AzureCoreTag { + log.Printf("azure: image version exists for %s\n azure: removing old image version\n", *v.Name) -func (azu *AzureUploader) createAzureImageVersion(ctx context.Context, armTemplate []byte, arch string) error { - targetRegions := make([]TargetRegion, 0, len(azu.helper.locations)) + err = azu.deleteImageVersion(ctx, arch) - for _, region := range azu.helper.locations { - targetRegions = append(targetRegions, TargetRegion{ - Name: region.Name, - RegionalReplicaCount: 1, - StorageAccountType: "Standard_LRS", - }) + if err != nil { + return err + } + } + } } - versionParameters := map[string]interface{}{ - "disk_name": map[string]string{ - "value": fmt.Sprintf("talos-%s-%s%s", arch, azu.Options.AzureCoreTag, azu.Options.AzurePreRelease), - }, - "image_version": map[string]string{ - "value": azu.Options.AzureCoreTag, - }, - "gallery_name": map[string]string{ - "value": azu.Options.AzureGalleryName, - }, - "definition_name": map[string]string{ - "value": fmt.Sprintf("talos-%s", azureArchitectures[arch]), - }, - "region": map[string]string{ - "value": defaultRegion, - }, - "resourceGroupName": map[string]string{ - "value": resourceGroupName, - }, - "targetRegions": map[string]interface{}{ - "value": targetRegions, + log.Printf("azure: creating %s image version", arch) + + poller, err := azu.helper.clientFactory.NewGalleryImageVersionsClient().BeginCreateOrUpdate( + ctx, + resourceGroupName, + azu.Options.AzureGalleryName, + fmt.Sprintf("talos-%s", azureArchitectures[arch]), + azu.Options.AzureCoreTag, + armcompute.GalleryImageVersion{ + Location: to.Ptr(defaultRegion), + Properties: &armcompute.GalleryImageVersionProperties{ + PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ + TargetRegions: targetRegions, + }, + SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ + AllowDeletionOfReplicatedLocations: to.Ptr(true), + }, + StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ + OSDiskImage: &armcompute.GalleryOSDiskImage{ + HostCaching: to.Ptr(armcompute.HostCachingReadOnly), + Source: &armcompute.GalleryDiskImageSource{ + ID: to.Ptr(fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s", azu.helper.subscriptionID, resourceGroupName, storageAccount)), + URI: to.Ptr(fmt.Sprintf("https://siderogallery.blob.core.windows.net/images/talos/talos-%s-%s.vhd", arch, azu.Options.Tag)), + }, + }, + }, + }, }, + nil) + if err != nil { + return fmt.Errorf("azure: failed to create image version: %w", err) } - deploymentName := fmt.Sprintf("img-version-talos-%s-%s", arch, azu.Options.Tag) + _, err = poller.PollUntilDone(ctx, nil) - if err := azu.helper.deployResourceFromTemplate(ctx, armTemplate, versionParameters, deploymentName); err != nil { - return fmt.Errorf("azure: error applying Azure image version template: %w", err) + if err != nil { + return fmt.Errorf("azure: failed to pull the result for image version creation: %w", err) } - return nil + return err +} + +func (azu *AzureUploader) deleteImageVersion(ctx context.Context, arch string) error { + poller, err := azu.helper.clientFactory.NewGalleryImageVersionsClient().BeginDelete( + ctx, + resourceGroupName, + azu.Options.AzureGalleryName, + fmt.Sprintf("talos-%s", azureArchitectures[arch]), + azu.Options.AzureCoreTag, + nil) + if err != nil { + return fmt.Errorf("azure: failed to delete image: %w", err) + } + + _, err = poller.PollUntilDone(ctx, nil) + + if err != nil { + return fmt.Errorf("azure: failed to pull the result for image deletion: %w", err) + } + + return err } type azureHelper struct { subscriptionID string + clientFactory *armcompute.ClientFactory cred *azidentity.DefaultAzureCredential authorizer autorest.Authorizer providersClient resources.ProvidersClient @@ -345,7 +351,7 @@ type azureHelper struct { func (helper *azureHelper) setDefaultAzureCreds() error { helper.subscriptionID = os.Getenv("AZURE_SUBSCRIPTION_ID") if len(helper.subscriptionID) == 0 { - log.Fatalln("AZURE_SUBSCRIPTION_ID is not set.") + return fmt.Errorf("azure: AZURE_SUBSCRIPTION_ID is not set") } authFromEnvironment, err := auth.NewAuthorizerFromEnvironment() @@ -361,6 +367,11 @@ func (helper *azureHelper) setDefaultAzureCreds() error { return err } + helper.clientFactory, err = armcompute.NewClientFactory(helper.subscriptionID, helper.cred, nil) + if err != nil { + return fmt.Errorf("azure: failed to create client: %w", err) + } + // Initialize the Storage Accounts Client var storageClientFactory *armstorage.ClientFactory @@ -411,7 +422,7 @@ func (helper *azureHelper) getAzureLocations(ctx context.Context) error { } } - return nil + return err } func (helper *azureHelper) listProviders(ctx context.Context) (result []resources.Provider, err error) { @@ -425,44 +436,3 @@ func (helper *azureHelper) listProviders(ctx context.Context) (result []resource return } - -func (helper *azureHelper) deployResourceFromTemplate(ctx context.Context, templateBytes []byte, parameters map[string]interface{}, deploymentName string) error { - // Create a new instance of the DeploymentsClient - deploymentsClient, err := armresources.NewDeploymentsClient(helper.subscriptionID, helper.cred, nil) - if err != nil { - return err - } - - // Replace these variables with your own values - resourceGroupName := "SideroGallery" - - // Parse the template JSON - var template map[string]interface{} - - if err = json.Unmarshal(templateBytes, &template); err != nil { - return fmt.Errorf("azure: error parsing template JSON: %w", err) - } - - deployment := armresources.Deployment{ - Properties: &armresources.DeploymentProperties{ - Template: template, - Parameters: parameters, - Mode: to.Ptr(armresources.DeploymentModeIncremental), - }, - } - - poller, err := deploymentsClient.BeginCreateOrUpdate(ctx, resourceGroupName, deploymentName, deployment, nil) - if err != nil { - return fmt.Errorf("azure: failed to create deployment: %w", err) - } - - // PollUntilDone requires a context and a poll interval - result, err := poller.PollUntilDone(ctx, nil) - if err != nil { - return fmt.Errorf("azure: failed to poll deployment status: %w", err) - } - - log.Printf("azure: deployment operation for %s: %+v\n", *result.Name, *result.Properties.ProvisioningState) - - return nil -} diff --git a/hack/cloud-image-uploader/extract.go b/hack/cloud-image-uploader/extract.go deleted file mode 100644 index f298538fb2..0000000000 --- a/hack/cloud-image-uploader/extract.go +++ /dev/null @@ -1,43 +0,0 @@ -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at http://mozilla.org/MPL/2.0/. - -package main - -import ( - "archive/tar" - "compress/gzip" - "fmt" - "io" -) - -// ExtractFileFromTarGz reads a single file data from an archive. -func ExtractFileFromTarGz(filename string, r io.Reader) (io.Reader, error) { - zr, err := gzip.NewReader(r) - if err != nil { - return nil, fmt.Errorf("error initializing gzip: %w", err) - } - - tr := tar.NewReader(zr) - - for { - hdr, err := tr.Next() - if err != nil { - if err == io.EOF { - break - } - - return nil, err - } - - if hdr.Name == filename { - if hdr.Typeflag == tar.TypeDir || hdr.Typeflag == tar.TypeSymlink { - return nil, fmt.Errorf("%s is not a file", filename) - } - - return tr, nil - } - } - - return nil, fmt.Errorf("couldn't find file %s in the archive", filename) -} diff --git a/hack/cloud-image-uploader/go.mod b/hack/cloud-image-uploader/go.mod index cfd196b246..180968ebe8 100644 --- a/hack/cloud-image-uploader/go.mod +++ b/hack/cloud-image-uploader/go.mod @@ -6,6 +6,7 @@ require ( github.com/Azure/azure-sdk-for-go v68.0.0+incompatible github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 v5.1.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.3.0 github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.1.0 @@ -17,6 +18,7 @@ require ( github.com/siderolabs/gen v0.4.5 github.com/siderolabs/go-retry v0.3.2 github.com/spf13/pflag v1.0.5 + github.com/ulikunitz/xz v0.5.11 golang.org/x/sync v0.3.0 ) diff --git a/hack/cloud-image-uploader/go.sum b/hack/cloud-image-uploader/go.sum index 2aa92b439a..0a0f8e4f60 100644 --- a/hack/cloud-image-uploader/go.sum +++ b/hack/cloud-image-uploader/go.sum @@ -6,6 +6,8 @@ github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybI github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0/go.mod h1:OQeznEEkTZ9OrhHJoDD8ZDq51FHgXjqtP9z6bEwBq9U= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 v5.1.0 h1:Sg/D8VuUQ+bw+FOYJF+xRKcwizCOP13HL0Se8pWNBzE= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 v5.1.0/go.mod h1:Kyqzdqq0XDoCm+o9aZ25wZBmBUBzPBzPAj1R5rYsT6I= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 h1:mLY+pNLjCUeKhgnAJWAKhEUQM+RJQo2H1fuGSw1Ky1E= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.0.0 h1:pPvTJ1dY0sA35JOeFq6TsY2xj6Z85Yo23Pj4wCCvu4o= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1 h1:7CBQ+Ei8SP2c6ydQTGCCrS35bDxgTMfoP2miAwK++OU= @@ -86,6 +88,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= +github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= diff --git a/hack/cloud-image-uploader/main.go b/hack/cloud-image-uploader/main.go index f40f26805e..662d7c2924 100644 --- a/hack/cloud-image-uploader/main.go +++ b/hack/cloud-image-uploader/main.go @@ -92,14 +92,13 @@ func run() error { return aws.Upload(ctx) }) - // disabled until https://github.com/siderolabs/talos/issues/7512 is resolved - // g.Go(func() error { - // azure := AzureUploader{ - // Options: DefaultOptions, - // } - - // return azure.AzureGalleryUpload(ctx) - // }) + g.Go(func() error { + azure := AzureUploader{ + Options: DefaultOptions, + } + + return azure.AzureGalleryUpload(ctx) + }) if err = g.Wait(); err != nil { return fmt.Errorf("failed: %w", err) diff --git a/hack/cloud-image-uploader/options.go b/hack/cloud-image-uploader/options.go index 10dce675af..8507d7ac31 100644 --- a/hack/cloud-image-uploader/options.go +++ b/hack/cloud-image-uploader/options.go @@ -40,10 +40,10 @@ var DefaultOptions = Options{ // AWSImage returns path to AWS pre-built image. func (o *Options) AWSImage(architecture string) string { - return filepath.Join(o.ArtifactsPath, fmt.Sprintf("aws-%s.tar.gz", architecture)) + return filepath.Join(o.ArtifactsPath, fmt.Sprintf("aws-%s.raw.xz", architecture)) } // AzureImage returns path to AWS pre-built image. func (o *Options) AzureImage(architecture string) string { - return filepath.Join(o.ArtifactsPath, fmt.Sprintf("azure-%s.tar.gz", architecture)) + return filepath.Join(o.ArtifactsPath, fmt.Sprintf("azure-%s.vhd.xz", architecture)) }