Compare commits
40 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 481951de0e | |||
| 7ee2317140 | |||
| 94fcb060d3 | |||
| 1161820b94 | |||
| e4d3d8841a | |||
| fb20a6a806 | |||
| 328fabe3b5 | |||
| 11d51f6fdf | |||
| ec59963e86 | |||
| 6b8a91184d | |||
| d0e61803c7 | |||
| a9b4316b9e | |||
| 4a6dfee862 | |||
| 878b7183f7 | |||
| 2beecabd67 | |||
| b2e5cb0136 | |||
| ce6b366df2 | |||
| 0305a116a7 | |||
| fce6d63e6d | |||
|
44c05fece4
|
|||
| a6450faf0b | |||
| a8c79c3337 | |||
| 58c406980b | |||
| 30ce3662a2 | |||
|
c409daacf7
|
|||
| 441f70247e | |||
| 8572bff4b2 | |||
| 48e47e7348 | |||
| 616ee972d2 | |||
| 944ab85df1 | |||
| ea622f2649 | |||
| 4afe2fcdd6 | |||
| 35521ccc16 | |||
| 6a9b07be80 | |||
| b8ec89b9b8 | |||
| b0ee6645ed | |||
| 5fe751ebdd | |||
| 48d554cc23 | |||
| 617eebef2e | |||
| 883b5e099d |
@@ -1,5 +1,7 @@
|
||||
include:
|
||||
- template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'
|
||||
- project: unboundsoftware/ci-templates
|
||||
file: Defaults.gitlab-ci.yml
|
||||
- project: unboundsoftware/ci-templates
|
||||
file: Release.gitlab-ci.yml
|
||||
- project: unboundsoftware/ci-templates
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v5.0.0
|
||||
rev: v6.0.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
@@ -36,6 +36,6 @@ repos:
|
||||
- id: go-vet
|
||||
- id: gofumpt
|
||||
- repo: https://github.com/golangci/golangci-lint
|
||||
rev: v2.1.2
|
||||
rev: v2.4.0
|
||||
hooks:
|
||||
- id: golangci-lint
|
||||
|
||||
+30
-15
@@ -1,27 +1,52 @@
|
||||
# Changelog
|
||||
## [0.0.17] - 2025-08-14
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- *(deps)* Update module github.com/alecthomas/kong to v1.12.1
|
||||
- *(deps)* Update kubernetes packages to v0.33.4
|
||||
## [0.0.16] - 2025-07-16
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- *(deps)* Update kubernetes packages to v0.33.3
|
||||
## [0.0.15] - 2025-07-01
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- *(deps)* Update module github.com/alecthomas/kong to v1.12.0
|
||||
- *(client)* Handle error responses with detailed messages
|
||||
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- *(ci)* Update CI configuration for pipeline templates
|
||||
## [0.0.14] - 2025-06-20
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- *(deps)* Update kubernetes packages to v0.33.2
|
||||
## [0.0.13] - 2025-05-16
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- *(deps)* Update module github.com/alecthomas/kong to v1.11.0
|
||||
- *(deps)* Update kubernetes packages to v0.33.1
|
||||
## [0.0.12] - 2025-04-24
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- *(deps)* Update kubernetes packages to v0.33.0
|
||||
|
||||
## [0.0.11] - 2025-04-23
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- *(deps)* Update module github.com/alecthomas/kong to v1.10.0
|
||||
- *(deps)* Update kubernetes packages to v0.32.4
|
||||
|
||||
## [0.0.10] - 2025-03-12
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- *(deps)* Update module github.com/alecthomas/kong to v1.9.0
|
||||
- *(deps)* Update kubernetes packages to v0.32.3
|
||||
|
||||
## [0.0.9] - 2025-03-03
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
@@ -32,14 +57,12 @@ All notable changes to this project will be documented in this file.
|
||||
- *(deps)* Update kubernetes packages to v0.32.2
|
||||
- *(deps)* Update module github.com/alecthomas/kong to v1.8.1
|
||||
- *(docker)* Use amd64 golang base image for build
|
||||
|
||||
## [0.0.8] - 2025-01-17
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- *(deps)* Update module github.com/alecthomas/kong to v1.6.1
|
||||
- *(deps)* Update kubernetes packages to v0.32.1
|
||||
|
||||
## [0.0.7] - 2024-12-28
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
@@ -55,7 +78,6 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
- Simplify CI configuration by removing unused variables
|
||||
- *(golangci)* Increase timeout to 5 minutes
|
||||
|
||||
## [0.0.6] - 2024-11-21
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
@@ -67,13 +89,11 @@ All notable changes to this project will be documented in this file.
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- Remove pre-commit stage and include Go pre-commit template
|
||||
|
||||
## [0.0.5] - 2024-10-24
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- *(deps)* Update kubernetes packages to v0.31.2
|
||||
|
||||
## [0.0.4] - 2024-10-06
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
@@ -164,7 +184,6 @@ All notable changes to this project will be documented in this file.
|
||||
### 🛡️ Security
|
||||
|
||||
- *(deps)* [security] bump golang.org/x/net from 0.13.0 to 0.17.0
|
||||
|
||||
## [0.0.3] - 2022-09-27
|
||||
|
||||
### 🚀 Features
|
||||
@@ -175,17 +194,13 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
- *(deps)* Bump k8s.io/client-go from 0.25.0 to 0.25.1
|
||||
- *(deps)* Bump k8s.io/client-go from 0.25.1 to 0.25.2
|
||||
|
||||
## [0.0.2] - 2022-09-09
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- Add CA certificates
|
||||
|
||||
## [0.0.1] - 2022-09-09
|
||||
|
||||
### 🚀 Features
|
||||
|
||||
- Initial commit
|
||||
|
||||
<!-- generated by git-cliff -->
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
FROM amd64/golang:1.24.2@sha256:aebb7dfe0e8da97fd4e22f95d2162cc6948f772fa947a00659634ece26cadb5a as build
|
||||
FROM amd64/golang:1.25.0@sha256:36e95221032d4c929d001ae5c1059ba1fbe1dec3b1f5c74d2708583d3141e151 as build
|
||||
WORKDIR /build
|
||||
ENV CGO_ENABLED=0
|
||||
ADD . /build
|
||||
|
||||
@@ -69,6 +69,12 @@ func (r *RestClient) projectApiCall(method, project string, api string, body io.
|
||||
if resp.StatusCode == http.StatusOK && response != nil {
|
||||
decoder := json.NewDecoder(resp.Body)
|
||||
err = decoder.Decode(response)
|
||||
} else if resp.StatusCode != http.StatusOK {
|
||||
buff, err2 := io.ReadAll(resp.Body)
|
||||
if err2 != nil {
|
||||
return fmt.Errorf("error reading body: %w", err2)
|
||||
}
|
||||
return fmt.Errorf("status %d: %s", resp.StatusCode, string(buff))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -80,6 +80,39 @@ func TestRestClient_GetTags(t *testing.T) {
|
||||
return assert.EqualError(t, err, "invalid character 'a' looking for beginning of value")
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "unauthorized",
|
||||
args: args{
|
||||
project: "unboundsoftware/dummy",
|
||||
},
|
||||
handler: func(t *testing.T) http.HandlerFunc {
|
||||
return func(writer http.ResponseWriter, request *http.Request) {
|
||||
writer.WriteHeader(http.StatusUnauthorized)
|
||||
_, _ = writer.Write([]byte("token expired"))
|
||||
}
|
||||
},
|
||||
want: nil,
|
||||
wantErr: func(t assert.TestingT, err error, i ...interface{}) bool {
|
||||
return assert.EqualError(t, err, "status 401: token expired")
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "error body length incorrect",
|
||||
args: args{
|
||||
project: "unboundsoftware/dummy",
|
||||
},
|
||||
handler: func(t *testing.T) http.HandlerFunc {
|
||||
return func(writer http.ResponseWriter, request *http.Request) {
|
||||
writer.Header().Set("Content-Length", "230")
|
||||
writer.WriteHeader(http.StatusUnauthorized)
|
||||
_, _ = writer.Write([]byte("token expired"))
|
||||
}
|
||||
},
|
||||
want: nil,
|
||||
wantErr: func(t assert.TestingT, err error, i ...interface{}) bool {
|
||||
return assert.EqualError(t, err, "error reading body: unexpected EOF")
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "success",
|
||||
args: args{
|
||||
|
||||
@@ -2,16 +2,16 @@ module gitlab.com/unboundsoftware/gitlab-cleanup-handler
|
||||
|
||||
go 1.24.0
|
||||
|
||||
toolchain go1.24.2
|
||||
toolchain go1.25.0
|
||||
|
||||
require (
|
||||
github.com/alecthomas/kong v1.10.0
|
||||
github.com/alecthomas/kong v1.12.1
|
||||
github.com/apex/log v1.9.0
|
||||
github.com/stretchr/testify v1.10.0
|
||||
gitlab.com/unboundsoftware/apex-mocks v0.2.0
|
||||
k8s.io/api v0.33.0
|
||||
k8s.io/apimachinery v0.33.0
|
||||
k8s.io/client-go v0.33.0
|
||||
k8s.io/api v0.33.4
|
||||
k8s.io/apimachinery v0.33.4
|
||||
k8s.io/client-go v0.33.4
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0=
|
||||
github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
|
||||
github.com/alecthomas/kong v1.10.0 h1:8K4rGDpT7Iu+jEXCIJUeKqvpwZHbsFRoebLbnzlmrpw=
|
||||
github.com/alecthomas/kong v1.10.0/go.mod h1:p2vqieVMeTAnaC83txKtXe8FLke2X07aruPWXyMPQrU=
|
||||
github.com/alecthomas/kong v1.12.1 h1:iq6aMJDcFYP9uFrLdsiZQ2ZMmcshduyGv4Pek0MQPW0=
|
||||
github.com/alecthomas/kong v1.12.1/go.mod h1:p2vqieVMeTAnaC83txKtXe8FLke2X07aruPWXyMPQrU=
|
||||
github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc=
|
||||
github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
|
||||
github.com/apex/log v1.9.0 h1:FHtw/xuaM8AgmvDDTI9fiwoAL25Sq2cxojnZICUU8l0=
|
||||
@@ -195,12 +195,12 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C
|
||||
gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
k8s.io/api v0.33.0 h1:yTgZVn1XEe6opVpP1FylmNrIFWuDqe2H0V8CT5gxfIU=
|
||||
k8s.io/api v0.33.0/go.mod h1:CTO61ECK/KU7haa3qq8sarQ0biLq2ju405IZAd9zsiM=
|
||||
k8s.io/apimachinery v0.33.0 h1:1a6kHrJxb2hs4t8EE5wuR/WxKDwGN1FKH3JvDtA0CIQ=
|
||||
k8s.io/apimachinery v0.33.0/go.mod h1:BHW0YOu7n22fFv/JkYOEfkUYNRN0fj0BlvMFWA7b+SM=
|
||||
k8s.io/client-go v0.33.0 h1:UASR0sAYVUzs2kYuKn/ZakZlcs2bEHaizrrHUZg0G98=
|
||||
k8s.io/client-go v0.33.0/go.mod h1:kGkd+l/gNGg8GYWAPr0xF1rRKvVWvzh9vmZAMXtaKOg=
|
||||
k8s.io/api v0.33.4 h1:oTzrFVNPXBjMu0IlpA2eDDIU49jsuEorGHB4cvKupkk=
|
||||
k8s.io/api v0.33.4/go.mod h1:VHQZ4cuxQ9sCUMESJV5+Fe8bGnqAARZ08tSTdHWfeAc=
|
||||
k8s.io/apimachinery v0.33.4 h1:SOf/JW33TP0eppJMkIgQ+L6atlDiP/090oaX0y9pd9s=
|
||||
k8s.io/apimachinery v0.33.4/go.mod h1:BHW0YOu7n22fFv/JkYOEfkUYNRN0fj0BlvMFWA7b+SM=
|
||||
k8s.io/client-go v0.33.4 h1:TNH+CSu8EmXfitntjUPwaKVPN0AYMbc9F1bBS8/ABpw=
|
||||
k8s.io/client-go v0.33.4/go.mod h1:LsA0+hBG2DPwovjd931L/AoaezMPX9CmBgyVyBZmbCY=
|
||||
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
|
||||
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
|
||||
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff h1:/usPimJzUKKu+m+TE36gUyGcf03XZEP0ZIKgKj35LS4=
|
||||
|
||||
Reference in New Issue
Block a user