diff --git a/.goreleaser.yml b/.goreleaser.yml index 5c9bd801d..ff3b1ae54 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,14 +1,9 @@ --- -version: 2 before: hooks: - go mod download - go mod tidy -# NOTE(jkoelker) the changelog is managed by `release-please` -changelog: - disable: true - builds: - main: ./cmd/konvoy-image/main.go id: konvoy-image @@ -95,20 +90,3 @@ release: prerelease: auto ids: - konvoy-image-bundle - -notarize: - macos: - - enabled: '{{ isEnvSet "NOTARIZE_DARWIN_BINARY"}}' - ids: - - konvoy-image - - konvoy-image-wrapper - sign: - certificate: "{{.Env.MACOS_SIGN_P12}}" - password: "{{.Env.MACOS_SIGN_PASSWORD}}" - - notarize: - issuer_id: "{{.Env.MACOS_NOTARY_ISSUER_ID}}" - key_id: "{{.Env.MACOS_NOTARY_KEY_ID}}" - key: "{{.Env.MACOS_NOTARY_KEY}}" - wait: true - timeout: 20m diff --git a/cmd/konvoy-image-wrapper/cmd/create-package-bundle.go b/cmd/konvoy-image-wrapper/cmd/create-package-bundle.go index 85f911c92..0360c8fcc 100644 --- a/cmd/konvoy-image-wrapper/cmd/create-package-bundle.go +++ b/cmd/konvoy-image-wrapper/cmd/create-package-bundle.go @@ -73,6 +73,7 @@ func getKubernetesVerisonFromAnsible() (string, error) { return kubeVersion, nil } +//nolint:funlen // no need to split this function func (r *Runner) CreatePackageBundle(args []string) error { var ( osFlag string @@ -153,6 +154,7 @@ func (r *Runner) CreatePackageBundle(args []string) error { fetchKubernetesRPMs = false } if eusReposFlag { + //nolint:goconst // this is a flag r.env["EUS_REPOS"] = "true" } if fetchKubernetesRPMs { diff --git a/cmd/konvoy-image/cmd/gcp.go b/cmd/konvoy-image/cmd/gcp.go index 0ebb02c61..72cce6669 100644 --- a/cmd/konvoy-image/cmd/gcp.go +++ b/cmd/konvoy-image/cmd/gcp.go @@ -72,6 +72,13 @@ func addGCPArgs(fs *flag.FlagSet, gcp *app.GCPArgs) { "the project id to use when storing created image", ) + fs.StringSliceVar( + &gcp.ImageLocation, + "image-storage-locations", + []string{}, + "the location to use when storing created image", + ) + fs.StringVar( &gcp.Network, "network", diff --git a/pkg/app/build_gcp.go b/pkg/app/build_gcp.go index 0500c7b75..a52325cc9 100644 --- a/pkg/app/build_gcp.go +++ b/pkg/app/build_gcp.go @@ -6,9 +6,10 @@ import ( ) type GCPArgs struct { - ProjectID string // the project ID to which the source VM belongs. - Region string // the region where the source VM is located. - Network string // the network in which to load image creation, should have . + ProjectID string // the project ID to which the source VM belongs. + Region string // the region where the source VM is located. + Network string // the network in which to load image creation, should have . + ImageLocation []string // the location where the image will be stored. } func ensureGCP() error { diff --git a/pkg/app/config.go b/pkg/app/config.go index b22b61393..eac7eb75b 100644 --- a/pkg/app/config.go +++ b/pkg/app/config.go @@ -585,6 +585,10 @@ func MergeGCPUserArgs(config Config, gcpArgs *GCPArgs) error { return fmt.Errorf("failed to set %s: %w", PackerGCPProjectIDPath, err) } + if err := config.Set(PackerGCPImageLocationPath, gcpArgs.ImageLocation); err != nil { + return fmt.Errorf("failed to set %s: %w", PackerGCPImageLocationPath, err) + } + if err := config.Set(PackerGCPNetworkPath, gcpArgs.Network); err != nil { return fmt.Errorf("failed to set %s: %w", PackerGCPNetworkPath, err) } diff --git a/pkg/app/constants.go b/pkg/app/constants.go index 969c20a69..609903b51 100644 --- a/pkg/app/constants.go +++ b/pkg/app/constants.go @@ -49,9 +49,10 @@ const ( PackerAzureTenantIDPath = "/packer/tenant_id" PackerAzureCloudEndpointPath = "/packer/cloud_environment_name" - PackerGCPProjectIDPath = "/packer/project_id" - PackerGCPNetworkPath = "/packer/network" - PackerGCPRegionPath = "/packer/region" + PackerGCPProjectIDPath = "/packer/project_id" + PackerGCPNetworkPath = "/packer/network" + PackerGCPRegionPath = "/packer/region" + PackerGCPImageLocationPath = "/packer/image_storage_locations" PackerVSphereTemplatePath = "/packer/template" PackerVSphereClusterPath = "/packer/cluster" diff --git a/pkg/packer/manifests/gcp/packer.pkr.hcl b/pkg/packer/manifests/gcp/packer.pkr.hcl index 3c190ac97..75af17900 100644 --- a/pkg/packer/manifests/gcp/packer.pkr.hcl +++ b/pkg/packer/manifests/gcp/packer.pkr.hcl @@ -80,6 +80,11 @@ variable "project_id" { default = "" } +variable "image_storage_locations" { + type = string + default = "" +} + variable "region" { type = string default = "" @@ -238,6 +243,7 @@ locals { ansible_extra_vars = "${var.ansible_extra_vars}" build_timestamp = local.timestamp zone = "${var.region}-a" + image_storage_locations = split(",", var.image_storage_locations) generated_image_name = "konvoy-${var.build_name}-${var.kubernetes_full_version}-${local.build_timestamp}" # clean_resource_name https://github.com/hashicorp/packer-plugin-googlecompute/blob/81d8d5a740c0d7fb0b02be93133ac17a11557f34/builder/googlecompute/template_funcs.go#L20 image_name = regex_replace(lower(local.generated_image_name), "[^-a-z0-9]", "-") @@ -267,6 +273,7 @@ source "googlecompute" "kib_image" { image_name = local.image_name network = var.network project_id = var.project_id + image_storage_locations = local.image_storage_locations region = var.region source_image = var.source_image source_image_family = var.distribution_family @@ -274,7 +281,6 @@ source "googlecompute" "kib_image" { ssh_username = var.ssh_username wait_to_add_ssh_keys = "20s" zone = local.zone - skip_create_image = var.dry_run }