From 760bcfd658fb38d609fa8a2d86fa5121b459a18d Mon Sep 17 00:00:00 2001 From: Marcel_Henselin Date: Fri, 30 Jan 2026 14:28:48 +0000 Subject: [PATCH] fix: fix releaser (#23) ## Description relates to #1234 ## Checklist - [ ] Issue was linked above - [ ] Code format was applied: `make fmt` - [ ] Examples were added / adjusted (see `examples/` directory) - [x] Docs are up-to-date: `make generate-docs` (will be checked by CI) - [ ] Unit tests got implemented or updated - [ ] Acceptance tests got implemented or updated (see e.g. [here](https://github.com/stackitcloud/terraform-provider-stackit/blob/f5f99d170996b208672ae684b6da53420e369563/stackit/internal/services/dns/dns_acc_test.go)) - [x] Unit tests are passing: `make test` (will be checked by CI) - [x] No linter issues: `make lint` (will be checked by CI) Reviewed-on: https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/pulls/23 --- cmd/cmd/publish/architecture.go | 28 +++++++++++++++++++--------- cmd/cmd/publish/versions.go | 9 ++------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/cmd/cmd/publish/architecture.go b/cmd/cmd/publish/architecture.go index 1b73283f..76a64aa7 100644 --- a/cmd/cmd/publish/architecture.go +++ b/cmd/cmd/publish/architecture.go @@ -22,6 +22,10 @@ type Architecture struct { } type SigningKey struct { + GpgPublicKeys []GpgPublicKey `json:"gpg_public_keys"` +} + +type GpgPublicKey struct { KeyId string `json:"key_id"` AsciiArmor string `json:"ascii_armor"` TrustSignature string `json:"trust_signature"` @@ -85,17 +89,23 @@ func (p *Provider) CreateArchitectureFiles() error { ShaSumsUrl: shasumsUrl, ShaSumsSignatureUrl: shasumsSigUrl, ShaSum: sum.Sum, - SigningKeys: []SigningKey{ - { - KeyId: p.GpgFingerprint, - AsciiArmor: gpgAsciiPub, - TrustSignature: "", - Source: "", - SourceUrl: "", - }, - }, + SigningKeys: []SigningKey{}, } + a.SigningKeys = append( + a.SigningKeys, + SigningKey{ + GpgPublicKeys: []GpgPublicKey{ + { + KeyId: p.GpgFingerprint, + AsciiArmor: gpgAsciiPub, + TrustSignature: "", + Source: "", + SourceUrl: "", + }, + }, + }, + ) // var architectureTemplate = []byte(fmt.Sprintf(` //{ // "protocols": [ diff --git a/cmd/cmd/publish/versions.go b/cmd/cmd/publish/versions.go index b5381355..4145612a 100644 --- a/cmd/cmd/publish/versions.go +++ b/cmd/cmd/publish/versions.go @@ -26,12 +26,6 @@ type Data struct { } func (d *Data) WriteToFile(filePath string) error { - //file, err := os.OpenFile(filePath, os.O_CREATE, os.ModePerm) - //if err != nil { - // return fmt.Errorf("error creating file: %w", err) - //} - //defer file.Close() - // jsonString, err := json.Marshal(d) if err != nil { return fmt.Errorf("error encoding data: %w", err) @@ -51,7 +45,8 @@ func (d *Data) AddVersion(v Version) error { newVersions = append(newVersions, ver) } } - d.Versions = append(d.Versions, v) + newVersions = append(newVersions, v) + d.Versions = newVersions return nil }