talos/hack/cloud-image-uploader/options.go
Christian Rolland ac2aff5cc5
fix: fix azure portion of cloud uploader
Correctly propagate errors back. Drop ARM templates and use native APIs.
Correctly handle restarted runs for creating image versions. fixes #7512.

Signed-off-by: Christian Rolland <christian.rolland@siderolabs.com>
2023-08-03 09:38:16 -04:00

50 lines
1.2 KiB
Go

// 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 (
"fmt"
"path/filepath"
)
// Options for the cli.
type Options struct {
Tag string
ArtifactsPath string
Architectures []string
// AWS options.
AWSRegions []string
// Azure options.
AzureRegions []Location
AzureCoreTag string
AzureAbbrevTag string
AzureGalleryName string
AzurePreRelease string
}
// Location is the struct for the Azure Regions Options.
type Location struct {
Abbreviation string
Name string
}
// DefaultOptions used throughout the cli.
var DefaultOptions = Options{
ArtifactsPath: "_out/",
Architectures: []string{"amd64", "arm64"},
}
// AWSImage returns path to AWS pre-built image.
func (o *Options) AWSImage(architecture string) string {
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.vhd.xz", architecture))
}