Skip to content

Commit 69f9912

Browse files
committed
fix(dev): increase patch version to get correct check
1 parent f4d3902 commit 69f9912

File tree

3 files changed

+26
-8
lines changed

3 files changed

+26
-8
lines changed

CHANGELOG.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
88
<!-- insertion marker -->
99
## Unreleased
1010

11-
<small>[Compare with latest](https://github.com/pmoscode/helm-chart-update-check/compare/v0.1.1...HEAD)</small>
11+
<small>[Compare with latest](https://github.com/pmoscode/helm-chart-update-check/compare/v0.1.2...HEAD)</small>
12+
13+
### Bug Fixes
14+
15+
- increase patch version to get correct check ([cb55865](https://github.com/pmoscode/helm-chart-update-check/commit/cb558657a5d805584fabf3f9081acca43ce86794) by Peter Motzko).
16+
17+
<!-- insertion marker -->
18+
## [v0.1.2](https://github.com/pmoscode/helm-chart-update-check/releases/tag/v0.1.2) - 2023-12-11
19+
20+
<small>[Compare with v0.1.1](https://github.com/pmoscode/helm-chart-update-check/compare/v0.1.1...v0.1.2)</small>
1221

1322
### Features
1423

24+
- add CHANGELOG.md ([f4d3902](https://github.com/pmoscode/helm-chart-update-check/commit/f4d390269f88523db566d64be82b0bfb777d5783) by Peter Motzko).
1525
- add build and test workflow ([2efe0b1](https://github.com/pmoscode/helm-chart-update-check/commit/2efe0b1e8f42072e07ff49375f7ce611ff21b3fb) by Peter Motzko).
1626
- add test task and add "go get" to build task ([137f7f5](https://github.com/pmoscode/helm-chart-update-check/commit/137f7f57c6bc2758c911b2ec0791f0aba063f3d6) by Peter Motzko).
1727
- add tests ([f278e97](https://github.com/pmoscode/helm-chart-update-check/commit/f278e972e512ba5a45876a0490f5f56bab4b3a3a) by Peter Motzko).
@@ -20,7 +30,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
2030

2131
- versions with meta information are handled correct now ([e34aad6](https://github.com/pmoscode/helm-chart-update-check/commit/e34aad672fa874bcf03445058812022a1d1df579) by Peter Motzko).
2232

23-
<!-- insertion marker -->
2433
## [v0.1.1](https://github.com/pmoscode/helm-chart-update-check/releases/tag/v0.1.1) - 2023-11-28
2534

2635
<small>[Compare with v0.1.0](https://github.com/pmoscode/helm-chart-update-check/compare/v0.1.0...v0.1.1)</small>

main.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,19 @@ func getChartVersion(cliOptions *CliOptions) *semver.Version {
8282
}
8383

8484
func checkVersion(chartVersion *semver.Version, dockerVersions []*semver.Version, cliOptions *CliOptions) (int, error) {
85-
constraintStr := fmt.Sprintf("<= %s-0", chartVersion.String())
85+
constraintStr := fmt.Sprintf("<= %s-0", chartVersion.IncPatch().String())
8686
// See: https://github.com/Masterminds/semver?tab=readme-ov-file#working-with-prerelease-versions
87-
constraint, _ := semver.NewConstraint(constraintStr)
87+
constraint, err := semver.NewConstraint(constraintStr)
88+
if err != nil {
89+
log.Fatalln(err)
90+
}
8891

8992
newerVersions := make([]*semver.Version, 0)
9093

9194
fmt.Printf("Checking, if some version is > %s\n", chartVersion.String())
9295
for _, item := range dockerVersions {
9396
if *cliOptions.debug {
94-
fmt.Printf("Checking if Helm chart version %v is > DockerHub version %v: ", chartVersion.String(), item.String())
97+
fmt.Printf("Checking if Helm chart version %v is > DockerHub version %v: ", chartVersion.Original(), item.Original())
9598
}
9699
if !constraint.Check(item) {
97100
newerVersions = append(newerVersions, item)

main_test.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func TestGetDockerVersions(t *testing.T) {
2525
w.WriteHeader(http.StatusOK)
2626
w.Write(getTestData())
2727
})),
28-
expectedResult: []string{"1.2.3", "1.2.3", "1.2.3-pre.1", "1.2.3-dev", "1.5.0-rc", "1.5.0-rc1"},
28+
expectedResult: []string{"1.2.3", "1.2.3", "1.2.3-pre.1", "1.2.3-dev", "1.5.0-rc", "1.5.0-rc1", "1.5.0", "1.5.0-nightly.1"},
2929
},
3030
}
3131

@@ -52,7 +52,7 @@ func TestCheckVersion(t *testing.T) {
5252
}
5353

5454
test := Tests{
55-
name: "one",
55+
name: "complete",
5656
server: httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
5757
w.WriteHeader(http.StatusOK)
5858
w.Write(getTestData())
@@ -64,7 +64,7 @@ func TestCheckVersion(t *testing.T) {
6464
hub := dockerhub.CreateDockerHubWithUri(test.server.URL, *cliOptions.debug)
6565
dockerVersions := hub.GetVersions()
6666

67-
chartVersion, _ := semver.NewVersion("v1.5.0-rc")
67+
chartVersion, _ := semver.NewVersion("v1.5.0")
6868

6969
_, err := checkVersion(chartVersion, dockerVersions, cliOptions)
7070
if err != nil {
@@ -103,6 +103,12 @@ func getTestData() []byte {
103103
{
104104
Name: "v1.5.0-rc1",
105105
},
106+
{
107+
Name: "v1.5.0",
108+
},
109+
{
110+
Name: "v1.5.0-nightly.1",
111+
},
106112
},
107113
}
108114

0 commit comments

Comments
 (0)