From 0982a8931a2f153e43ab76a4a1c4f1a1a5002a44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20Gro=C3=9Fmann?= Date: Thu, 28 May 2026 13:53:24 +0200 Subject: [PATCH 1/8] feat: added check for generated files and linter check --- .github/workflows/ci.yml | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76e7a1f..f771273 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,13 +3,44 @@ name: CI / CD Pipeline on: push: branches: - - main - - pipeline + - * tags: - 'v*.*' + pull_request: + branches: + - * workflow_dispatch: jobs: + check-generated-and-lint-code: + name: Check Generated files and lint Code + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + + - name: Run Make Generate + run: make generate + + - name: Check for Uncommitted Changes + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "::error::Files were modified after running 'make generate'. Please run 'make generate' locally and commit the changes." + git status + git diff + exit 1 + else + echo "Generated code is up to date!" + fi + + - name: Run Make Prepare + run: make prepare + test-and-resources: name: Test & Resource Management runs-on: ubuntu-latest @@ -56,7 +87,7 @@ jobs: else echo "Profile 'pubsub-qa' not found, skipping deletion." fi - + echo "pubsub-qa should been removed. Creating..." stackit config profile import -c "@$RUNNER_TEMP/qa-env.json" --name pubsub-qa stackit config profile set pubsub-qa From 4a4e077913c067a2c961d74f6030eb9e177451db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20Gro=C3=9Fmann?= Date: Thu, 28 May 2026 13:54:56 +0200 Subject: [PATCH 2/8] feat: set name of pipeline to CI --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f771273..427bfde 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CI / CD Pipeline +name: CI Pipeline on: push: From 8793c8be2331752e65b1b1d6d41d4c6020bb2a69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20Gro=C3=9Fmann?= Date: Thu, 28 May 2026 13:56:33 +0200 Subject: [PATCH 3/8] fix: ci pipeline syntax --- .github/workflows/ci.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 427bfde..589d698 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,12 +3,12 @@ name: CI Pipeline on: push: branches: - - * + - '*' tags: - 'v*.*' pull_request: branches: - - * + - '*' workflow_dispatch: jobs: @@ -24,6 +24,9 @@ jobs: with: go-version-file: 'go.mod' + - name: Make Scripts Executable + run: chmod +x ./scripts/*.sh + - name: Run Make Generate run: make generate @@ -87,7 +90,7 @@ jobs: else echo "Profile 'pubsub-qa' not found, skipping deletion." fi - + echo "pubsub-qa should been removed. Creating..." stackit config profile import -c "@$RUNNER_TEMP/qa-env.json" --name pubsub-qa stackit config profile set pubsub-qa From 3918e3fd3bae585c0370b92e788bece6d4dd4f5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20Gro=C3=9Fmann?= Date: Thu, 28 May 2026 14:02:52 +0200 Subject: [PATCH 4/8] chore: ran make generate --- pkg/pubsub/api/sdk.gen.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/pubsub/api/sdk.gen.go b/pkg/pubsub/api/sdk.gen.go index 07804c7..59f688e 100644 --- a/pkg/pubsub/api/sdk.gen.go +++ b/pkg/pubsub/api/sdk.gen.go @@ -1,6 +1,6 @@ // Package api provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.6.0 DO NOT EDIT. +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.1 DO NOT EDIT. package api import ( @@ -363,7 +363,7 @@ func NewAckMessagesRequestWithBody(server string, subscriptionId SubscriptionId, var pathParam0 string - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "subscriptionId", subscriptionId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "subscriptionId", runtime.ParamLocationPath, subscriptionId) if err != nil { return nil, err } @@ -410,7 +410,7 @@ func NewNackMessagesRequestWithBody(server string, subscriptionId SubscriptionId var pathParam0 string - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "subscriptionId", subscriptionId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "subscriptionId", runtime.ParamLocationPath, subscriptionId) if err != nil { return nil, err } @@ -446,7 +446,7 @@ func NewPullMessagesRequest(server string, subscriptionId SubscriptionId, params var pathParam0 string - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "subscriptionId", subscriptionId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "subscriptionId", runtime.ParamLocationPath, subscriptionId) if err != nil { return nil, err } @@ -476,7 +476,7 @@ func NewPullMessagesRequest(server string, subscriptionId SubscriptionId, params if params.PubSubMaxMessages != nil { var headerParam0 string - headerParam0, err = runtime.StyleParamWithOptions("simple", false, "PubSub-Max-Messages", *params.PubSubMaxMessages, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationHeader, Type: "integer", Format: "int32"}) + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "PubSub-Max-Messages", runtime.ParamLocationHeader, *params.PubSubMaxMessages) if err != nil { return nil, err } From 35d9d3e9fffce01e47850c17e128ebe896eca2a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20Gro=C3=9Fmann?= Date: Thu, 28 May 2026 14:20:23 +0200 Subject: [PATCH 5/8] fix: corrected that shims, go.mod and mise.toml use same "versions" of pkgs --- bin/golangci-lint | 2 +- go.mod | 4 ++-- go.sum | 8 ++++---- mise.toml | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bin/golangci-lint b/bin/golangci-lint index cd4ca71..1ac4fda 100755 --- a/bin/golangci-lint +++ b/bin/golangci-lint @@ -1,3 +1,3 @@ #!/usr/bin/env bash -exec mise exec go:github.com/golangci/golangci-lint/v2/cmd/golangci-lint -- golangci-lint "$@" +exec mise exec golangci-lint -- golangci-lint "$@" diff --git a/go.mod b/go.mod index a31b30e..fc9b8e2 100644 --- a/go.mod +++ b/go.mod @@ -1,13 +1,13 @@ module github.com/stackitcloud/pubsub-sdk-go -go 1.25.0 +go 1.25.0 // Make sure this matches the version specified in the mise.toml require ( github.com/go-logr/logr v1.4.3 github.com/google/uuid v1.6.0 github.com/joho/godotenv v1.5.1 github.com/kelseyhightower/envconfig v1.4.0 - github.com/oapi-codegen/runtime v1.3.1 + github.com/oapi-codegen/runtime v1.4.0 github.com/onsi/ginkgo/v2 v2.28.1 github.com/onsi/gomega v1.39.1 github.com/stackitcloud/stackit-sdk-go/core v0.22.0 diff --git a/go.sum b/go.sum index ff2bd7e..152b017 100644 --- a/go.sum +++ b/go.sum @@ -42,8 +42,8 @@ github.com/maruel/natural v1.1.1 h1:Hja7XhhmvEFhcByqDoHz9QZbkWey+COd9xWfCfn1ioo= github.com/maruel/natural v1.1.1/go.mod h1:v+Rfd79xlw1AgVBjbO0BEQmptqb5HvL/k9GRHB7ZKEg= github.com/mfridman/tparse v0.18.0 h1:wh6dzOKaIwkUGyKgOntDW4liXSo37qg5AXbIhkMV3vE= github.com/mfridman/tparse v0.18.0/go.mod h1:gEvqZTuCgEhPbYk/2lS3Kcxg1GmTxxU7kTC8DvP0i/A= -github.com/oapi-codegen/runtime v1.3.1 h1:RgDY6J4OGQLbRXhG/Xpt3vSVqYpHQS7hN4m85+5xB9g= -github.com/oapi-codegen/runtime v1.3.1/go.mod h1:kOdeacKy7t40Rclb1je37ZLFboFxh+YLy0zaPCMibPY= +github.com/oapi-codegen/runtime v1.4.0 h1:KLOSFOp7UzkbS7Cs1ms6NBEKYr0WmH2wZG0KKbd2er4= +github.com/oapi-codegen/runtime v1.4.0/go.mod h1:5sw5fxCDmnOzKNYmkVNF8d34kyUeejJEY8HNT2WaPec= github.com/onsi/ginkgo/v2 v2.28.1 h1:S4hj+HbZp40fNKuLUQOYLDgZLwNUVn19N3Atb98NCyI= github.com/onsi/ginkgo/v2 v2.28.1/go.mod h1:CLtbVInNckU3/+gC8LzkGUb9oF+e8W8TdUsxPwvdOgE= github.com/onsi/gomega v1.39.1 h1:1IJLAad4zjPn2PsnhH70V4DKRFlrCzGBNrNaru+Vf28= @@ -57,8 +57,8 @@ github.com/stackitcloud/stackit-sdk-go/core v0.22.0 h1:6rViz7GnNwXSh51Lur5xuDzO8 github.com/stackitcloud/stackit-sdk-go/core v0.22.0/go.mod h1:osMglDby4csGZ5sIfhNyYq1bS1TxIdPY88+skE/kkmI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= diff --git a/mise.toml b/mise.toml index 1800d13..280e661 100644 --- a/mise.toml +++ b/mise.toml @@ -1,11 +1,11 @@ [tools] -go = "1.26.2" +go = "1.25.0" # Make sure this matches the go.mod "go:gitlab.com/backbone/changelog/cmd/changelog" = "v1.1.0" ginkgo = "2.28.1" "go:github.com/axw/gocov/gocov" = "v1.1.0" "go:github.com/AlekSi/gocov-xml" = "v1.2.0" golangci-lint = "2.8.0" -oapi-codegen = "v2.6.0" +"go:github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen" = "v2.7.0" [settings] # The go backend is experimental From 84efb5342719c76d4c536e4c3b367b3c97859b9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20Gro=C3=9Fmann?= Date: Thu, 28 May 2026 14:20:30 +0200 Subject: [PATCH 6/8] chore: ran make generate --- pkg/pubsub/api/sdk.gen.go | 60 ++++++++++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 10 deletions(-) diff --git a/pkg/pubsub/api/sdk.gen.go b/pkg/pubsub/api/sdk.gen.go index 59f688e..5f49317 100644 --- a/pkg/pubsub/api/sdk.gen.go +++ b/pkg/pubsub/api/sdk.gen.go @@ -1,6 +1,6 @@ // Package api provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.1 DO NOT EDIT. +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. package api import ( @@ -309,7 +309,7 @@ func NewPublishMessagesRequestWithBody(server string, contentType string, body i return nil, err } - req, err := http.NewRequest("POST", queryURL.String(), body) + req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) if err != nil { return nil, err } @@ -338,7 +338,7 @@ func NewPurgeTopicRequest(server string) (*http.Request, error) { return nil, err } - req, err := http.NewRequest("POST", queryURL.String(), nil) + req, err := http.NewRequest(http.MethodPost, queryURL.String(), nil) if err != nil { return nil, err } @@ -363,7 +363,7 @@ func NewAckMessagesRequestWithBody(server string, subscriptionId SubscriptionId, var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "subscriptionId", runtime.ParamLocationPath, subscriptionId) + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "subscriptionId", subscriptionId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) if err != nil { return nil, err } @@ -383,7 +383,7 @@ func NewAckMessagesRequestWithBody(server string, subscriptionId SubscriptionId, return nil, err } - req, err := http.NewRequest("POST", queryURL.String(), body) + req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) if err != nil { return nil, err } @@ -410,7 +410,7 @@ func NewNackMessagesRequestWithBody(server string, subscriptionId SubscriptionId var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "subscriptionId", runtime.ParamLocationPath, subscriptionId) + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "subscriptionId", subscriptionId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) if err != nil { return nil, err } @@ -430,7 +430,7 @@ func NewNackMessagesRequestWithBody(server string, subscriptionId SubscriptionId return nil, err } - req, err := http.NewRequest("POST", queryURL.String(), body) + req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) if err != nil { return nil, err } @@ -446,7 +446,7 @@ func NewPullMessagesRequest(server string, subscriptionId SubscriptionId, params var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "subscriptionId", runtime.ParamLocationPath, subscriptionId) + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "subscriptionId", subscriptionId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) if err != nil { return nil, err } @@ -466,7 +466,7 @@ func NewPullMessagesRequest(server string, subscriptionId SubscriptionId, params return nil, err } - req, err := http.NewRequest("POST", queryURL.String(), nil) + req, err := http.NewRequest(http.MethodPost, queryURL.String(), nil) if err != nil { return nil, err } @@ -476,7 +476,7 @@ func NewPullMessagesRequest(server string, subscriptionId SubscriptionId, params if params.PubSubMaxMessages != nil { var headerParam0 string - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "PubSub-Max-Messages", runtime.ParamLocationHeader, *params.PubSubMaxMessages) + headerParam0, err = runtime.StyleParamWithOptions("simple", false, "PubSub-Max-Messages", *params.PubSubMaxMessages, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationHeader, Type: "integer", Format: "int32"}) if err != nil { return nil, err } @@ -576,6 +576,14 @@ func (r PublishMessagesResponse) StatusCode() int { return 0 } +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r PublishMessagesResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + type PurgeTopicResponse struct { Body []byte HTTPResponse *http.Response @@ -597,6 +605,14 @@ func (r PurgeTopicResponse) StatusCode() int { return 0 } +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r PurgeTopicResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + type AckMessagesResponse struct { Body []byte HTTPResponse *http.Response @@ -618,6 +634,14 @@ func (r AckMessagesResponse) StatusCode() int { return 0 } +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r AckMessagesResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + type NackMessagesResponse struct { Body []byte HTTPResponse *http.Response @@ -639,6 +663,14 @@ func (r NackMessagesResponse) StatusCode() int { return 0 } +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r NackMessagesResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + type PullMessagesResponse struct { Body []byte HTTPResponse *http.Response @@ -661,6 +693,14 @@ func (r PullMessagesResponse) StatusCode() int { return 0 } +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r PullMessagesResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + // PublishMessagesWithBodyWithResponse request with arbitrary body returning *PublishMessagesResponse func (c *ClientWithResponses) PublishMessagesWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PublishMessagesResponse, error) { rsp, err := c.PublishMessagesWithBody(ctx, contentType, body, reqEditors...) From 8916717406fcd822c2eb869118d4efe9b3c4db85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20Gro=C3=9Fmann?= Date: Thu, 28 May 2026 14:24:36 +0200 Subject: [PATCH 7/8] fix: permissions of scripts --- scripts/create-pubsub-resources.sh | 0 scripts/install_mise.sh | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/create-pubsub-resources.sh mode change 100644 => 100755 scripts/install_mise.sh diff --git a/scripts/create-pubsub-resources.sh b/scripts/create-pubsub-resources.sh old mode 100644 new mode 100755 diff --git a/scripts/install_mise.sh b/scripts/install_mise.sh old mode 100644 new mode 100755 From cd8ffd3d3db8bf09bee134f1f1123ac9875e971c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20Gro=C3=9Fmann?= Date: Thu, 28 May 2026 14:28:23 +0200 Subject: [PATCH 8/8] refactor: removed unnecessary permission and path settings steps from CI --- .github/workflows/ci.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 589d698..3c9509d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,9 +24,6 @@ jobs: with: go-version-file: 'go.mod' - - name: Make Scripts Executable - run: chmod +x ./scripts/*.sh - - name: Run Make Generate run: make generate @@ -62,12 +59,6 @@ jobs: with: go-version-file: 'go.mod' - - name: Make Scripts Executable - run: chmod +x ./scripts/*.sh - - - name: Add Binaries to PATH - run: echo "$PWD/bin" >> $GITHUB_PATH - - name: Load Key from GitHub Secrets run: | echo '${{ secrets.STACKIT_SERVICE_ACCOUNT_KEY }}' > $RUNNER_TEMP/service_account_key.json