Skip to content

Commit f28be78

Browse files
authored
chore(cdn): re-tag of cdn module v2 versions to prevent module path change (#3842)
1 parent ca0bcc2 commit f28be78

File tree

6 files changed

+100
-21
lines changed

6 files changed

+100
-21
lines changed

CHANGELOG.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
- Add `Etag` field to `Role` model struct
1111
- [v0.9.1](services/authorization/CHANGELOG.md#v091)
1212
- Bump STACKIT SDK core module from `v0.19.0` to `v0.20.0`
13-
- `cdn`: [v2.1.1](services/cdn/CHANGELOG.md#v211)
13+
- `cdn`: [v1.8.1](services/cdn/CHANGELOG.md#v181) (formerly `v2.1.1`)
14+
- **Note: This release was formerly known as `v2.1.1` and was re-tagged as `v1.8.1`, see statement in the [changelog of the STACKIT CDN SDK module](services/cdn/CHANGELOG).**
1415
- Bump STACKIT SDK core module from `v0.19.0` to `v0.20.0`
1516
- `certificates`: [v1.1.2](services/certificates/CHANGELOG.md#v112)
1617
- Bump STACKIT SDK core module from `v0.19.0` to `v0.20.0`
@@ -98,7 +99,8 @@
9899
- **Feature:** Add new field `ImportProgress` to `Image` model, which indicates the import progress of an image
99100
- [v1.1.0](services/iaas/CHANGELOG.md#v110)
100101
- **Breaking Change:** Removal of unused model structs: `Area`, `AreaConfig`, `AreaPrefixConfigIPv4`, `UpdateAreaIPv4`, `NetworkAreaIPv4`, `CreateAreaAddressFamily`, `CreateAreaIPv4`, `CreateNetworkAddressFamily`, `CreateNetworkIPv4Body`, `CreateNetworkIPv6Body`, `CreateServerPayloadBootVolume`, `CreateServerPayloadNetworking`, `NullableUpdateAreaAddressFamily`, `CreateServerPayloadNetworking`, `UpdateNetworkAddressFamily`, `CreateServerPayloadNetworking`, `CreateServerPayloadNetworking`
101-
- `cdn`: [v2.1.0](services/cdn/CHANGELOG.md#v210)
102+
- `cdn`: [v1.8.0](services/cdn/CHANGELOG.md#v180) (formerly `v2.1.0`)
103+
- **Note: This release was formerly known as `v2.1.0` and was re-tagged as `v1.8.0`, see statement in the [changelog of the STACKIT CDN SDK module](services/cdn/CHANGELOG).**
102104
- **Breaking change:** Removal of unused model structs: `GetLogsSearchFiltersResponse`, `PatchLokiLogSink`
103105
- `kms`: [v1.1.0](services/kms/CHANGELOG.md#v110)
104106
- **Bugfix:** Ensure correct state checking in `DisableKeyVersionWaitHandler` and `EnableKeyVersionWaitHandler`
@@ -139,7 +141,8 @@
139141
- **Feature:** Add support for list runner labels operation
140142
- new API client methods `ListRunnerLabels` and `ListRunnerLabelsExecute`
141143
- new model struct `RunnerLabel`
142-
- `cdn`: [v2.0.0](services/cdn/CHANGELOG.md#v200)
144+
- `cdn`: [v1.7.0](services/cdn/CHANGELOG.md#v170) (formerly `v2.0.0`)
145+
- **Note: This release was formerly known as `v2.0.0` and was re-tagged as `v1.7.0`, see statement in the [changelog of the STACKIT CDN SDK module](services/cdn/CHANGELOG).**
143146
- **Feature:** Switch from `v1beta` CDN API version to `v1beta2` version.
144147
- **Breaking change:** Changed spelling from `WAF` to `Waf` in model struct names
145148
- `WAFStatusRuleBlock` -> `WafStatusRuleBlock`

Makefile

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,12 @@ sync-tidy: ## Sync and tidy dependencies
4444
@echo ">> Syncing and tidying dependencies"
4545
@$(SCRIPTS_BASE)/sync-tidy.sh
4646

47-
lint: sync-tidy ## Lint all code
47+
lint: sync-tidy lint-versions ## Lint all code
4848
@$(MAKE) --no-print-directory lint-golangci-lint skip-non-generated-files=${skip-non-generated-files} service=${service}
4949

50+
lint-versions:
51+
@go run $(SCRIPTS_BASE)/lint-versions.go
52+
5053
# TEST
5154
test-go: ## Run Go tests
5255
@echo ">> Running Go tests"
@@ -59,10 +62,3 @@ test-scripts: ## Run tests for scripts
5962
test: ## Run all tests
6063
@$(MAKE) --no-print-directory test-go skip-non-generated-files=${skip-non-generated-files} service=${service}
6164

62-
# AUTOMATIC TAG
63-
sdk-tag-services:
64-
@go run $(SCRIPTS_BASE)/automatic_tag.go --update-type ${update-type} --ssh-private-key-file-path ${ssh-private-key-file-path};
65-
66-
67-
sdk-tag-core:
68-
@go run $(SCRIPTS_BASE)/automatic_tag.go --update-type ${update-type} --ssh-private-key-file-path ${ssh-private-key-file-path} --target core;

scripts/lint-versions.go

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"io/fs"
6+
"log"
7+
"os"
8+
"path/filepath"
9+
"regexp"
10+
"strings"
11+
)
12+
13+
const (
14+
targetFileName = "VERSION"
15+
)
16+
17+
var (
18+
targetDirs = []string{"services", "core"}
19+
)
20+
21+
func main() {
22+
fmt.Println(">> Linting SDK module versions...")
23+
24+
// e.g., versions["services/iaas"] = "v1.2.3"
25+
versions := make(map[string]string)
26+
27+
for _, rootDir := range targetDirs {
28+
err := filepath.WalkDir(rootDir, func(path string, d fs.DirEntry, err error) error {
29+
if err != nil {
30+
return fmt.Errorf("error accessing path %s: %w", path, err)
31+
}
32+
33+
if d.IsDir() && d.Name() == ".openapi-generator" {
34+
return filepath.SkipDir
35+
}
36+
37+
if !d.IsDir() && d.Name() == targetFileName {
38+
content, err := os.ReadFile(path)
39+
if err != nil {
40+
return fmt.Errorf("could not read file %s: %v", path, err)
41+
}
42+
43+
dirPath := filepath.Dir(path)
44+
version := strings.TrimSpace(string(content))
45+
46+
versions[dirPath] = version
47+
}
48+
49+
return nil
50+
})
51+
52+
if err != nil {
53+
log.Fatalf("failed to walk directory %s: %v", rootDir, err)
54+
}
55+
}
56+
57+
re := regexp.MustCompile(`^v[0-1]\.\d+\.\d+$`)
58+
for dir, version := range versions {
59+
versionOk := re.MatchString(version)
60+
61+
if !versionOk {
62+
log.Fatalf("Invalid version for %s: %s\n", dir, version)
63+
}
64+
}
65+
}

scripts/update-service-tags.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ set -e
1010
for file in $(git diff --name-only HEAD~1..HEAD | grep -E "(^services/[^/]+/VERSION$|^core/VERSION$)"); do
1111

1212
# Extract the current version and build the expected tag
13-
dirpath=$(dirname $file)
13+
dirpath=$(dirname "$file")
1414
version_path="$dirpath/VERSION"
1515
version=$(<"$version_path")
1616
expected_tag="$dirpath/$version"
1717
# Check if the tag already exists
18-
if git rev-parse --verify $expected_tag &> /dev/null; then
18+
if git rev-parse --verify "$expected_tag" &> /dev/null; then
1919
echo "Tag '$expected_tag' already exists."
2020
else
2121
# Tag doesn't exist. Create a tag and push it.
2222
echo "Tag '$expected_tag' does not exist."
23-
git tag -a $expected_tag -m "Release $version"
24-
git push origin tag $expected_tag
23+
git tag -a "$expected_tag" -m "Release $version"
24+
git push origin tag "$expected_tag"
2525
fi
2626
done

services/cdn/CHANGELOG.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
1-
## v2.1.1
2-
- Bump STACKIT SDK core module from `v0.19.0` to `v0.20.0`
3-
4-
## v2.1.0
1+
## v1.8.1
2+
- **Note: This release was formerly known as `v2.1.1` and was re-tagged, see statement below.**
3+
- Bump STACKIT SDK core module from `v0.19.0` to `v0.20.0`
4+
5+
> [!IMPORTANT]
6+
> The 3 releases, which contained the previously tagged `v2.x.x` changes, are now re-released as `v1.7.0`, `v1.8.0` and `v1.8.1`.
7+
> We have retagged the releases as `v1.x.x` versions to avoid forcing a module path change on all consumers.
8+
>
9+
> **Reason:** According to [Go module conventions](https://go.dev/blog/v2-go-modules), major versions ≥2 require the module path to be updated with a `/v2` suffix (`github.com/stackitcloud/stackit-sdk-go/services/cdn`).
10+
>
11+
> **Impact:** By remaining at `v1`, all users can continue to import the module using the original, clean import path (`github.com/stackitcloud/stackit-sdk-go/services/cdn`) without needing to update their import statements.
12+
>
13+
> **Note: If you were trying to use any `v2.x.x` tag, please downgrade to `v1.7.0` or higher. There won't be any `v2.x.x` release in the near future of any STACKIT SDK module.**
14+
>
15+
> We apologize for any confusion caused by the `v2.x.x` tags. We have a linter in place to prevent this in the future.
16+
17+
## v1.8.0
18+
- **Note: This release was formerly known as `v2.1.0` and was re-tagged, see statement above.**
519
- **Breaking change:** Removal of unused model structs: `GetLogsSearchFiltersResponse`, `PatchLokiLogSink`
620

7-
## v2.0.0
21+
## v1.7.0
22+
- **Note: This release was formerly known as `v2.0.0` and was re-tagged, see statement above.**
823
- **Feature:** Switch from `v1beta` CDN API version to `v1beta2` version.
924
- **Breaking change:** Changed spelling from `WAF` to `Waf` in model struct names
1025
- `WAFStatusRuleBlock` -> `WafStatusRuleBlock`

services/cdn/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v2.1.1
1+
v1.8.1

0 commit comments

Comments
 (0)