Skip to content

Commit

Permalink
chore: upgrade gitlab dep
Browse files Browse the repository at this point in the history
  • Loading branch information
fritterhoff committed Dec 15, 2023
1 parent fa57ccd commit eee1082
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1

FROM golang:1.21
FROM golang:1.21.4
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ module github.com/hm-edu/dnscontrol-extended

go 1.21

toolchain go1.21.1
toolchain go1.21.4

require (
github.com/StackExchange/dnscontrol/v4 v4.8.0
github.com/spf13/cobra v1.8.0
github.com/xanzy/go-gitlab v0.94.0
github.com/xanzy/go-gitlab v0.95.2
go.uber.org/zap v1.26.0
golang.org/x/time v0.5.0
)
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/xanzy/go-gitlab v0.94.0 h1:GmBl2T5zqUHqyjkxFSvsT7CbelGdAH/dmBqUBqS+4BE=
github.com/xanzy/go-gitlab v0.94.0/go.mod h1:ETg8tcj4OhrB84UEgeE8dSuV/0h4BBL1uOV/qK0vlyI=
github.com/xanzy/go-gitlab v0.95.2 h1:4p0IirHqEp5f0baK/aQqr4TR57IsD+8e4fuyAA1yi88=
github.com/xanzy/go-gitlab v0.95.2/go.mod h1:ETg8tcj4OhrB84UEgeE8dSuV/0h4BBL1uOV/qK0vlyI=
github.com/xddxdd/ottoext v0.0.0-20221109171055-210517fa4419 h1:PT5KYEimicg1GRkBtBxCLcHWvMcBRGljOLwG/y4+T5c=
github.com/xddxdd/ottoext v0.0.0-20221109171055-210517fa4419/go.mod h1:BxZUa1xZ189Ww28wRT0LjHcmHgQmPh27hqfHIwET0ok=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
Expand Down
20 changes: 10 additions & 10 deletions helper/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ func GenerateGitlabIssue(zones []SubnetResponse, pat, api, projectID, zone strin
}

issue, _, err = client.Issues.CreateIssue(project.ID, &gitlab.CreateIssueOptions{
Title: gitlab.String("IP usage in " + zone),
Description: gitlab.String(""),
Labels: &gitlab.Labels{strings.Join(matchingLabels, ",")},
Title: gitlab.Ptr("IP usage in " + zone),
Description: gitlab.Ptr(""),
Labels: &gitlab.LabelOptions{strings.Join(matchingLabels, ",")},
})
if err != nil {
panic(err)
Expand All @@ -104,7 +104,7 @@ func GenerateGitlabIssue(zones []SubnetResponse, pat, api, projectID, zone strin
_, err := client.Issues.DeleteIssue(project.ID, issue.IID)
if err != nil {
logger.Sugar().Warnf("Deleting issue %s failed.", issue.Title)
_, _, err := client.Issues.UpdateIssue(project.ID, issue.IID, &gitlab.UpdateIssueOptions{StateEvent: gitlab.String("close")})
_, _, err := client.Issues.UpdateIssue(project.ID, issue.IID, &gitlab.UpdateIssueOptions{StateEvent: gitlab.Ptr("close")})
if err != nil {
logger.Sugar().Errorf("Closing issue %s failed.", issue.Title)
}
Expand Down Expand Up @@ -151,13 +151,13 @@ func GenerateGitlabIssue(zones []SubnetResponse, pat, api, projectID, zone strin
}
}
update := &gitlab.UpdateIssueOptions{
Title: gitlab.String("IP usage in " + zone),
Description: gitlab.String(description),
Labels: &gitlab.Labels{strings.Join(matchingLabels, ",")},
Title: gitlab.Ptr("IP usage in " + zone),
Description: gitlab.Ptr(description),
Labels: &gitlab.LabelOptions{strings.Join(matchingLabels, ",")},
}
if issue.State == "closed" {
logger.Sugar().Warnf("Reopening issue for %s", zone)
update.StateEvent = gitlab.String("reopen")
update.StateEvent = gitlab.Ptr("reopen")
}
_, _, err = client.Issues.UpdateIssue(project.ID, issue.IID, update)
if err != nil {
Expand Down Expand Up @@ -187,7 +187,7 @@ func GenerateGitlabIssue(zones []SubnetResponse, pat, api, projectID, zone strin
for _, item := range zones[i:] {
if len([]byte(description)) > (1024 * 512) {
description += "\n\nPlease check comments"
_, _, err := client.Notes.CreateIssueNote(project.ID, issue.IID, &gitlab.CreateIssueNoteOptions{Body: gitlab.String(description)})
_, _, err := client.Notes.CreateIssueNote(project.ID, issue.IID, &gitlab.CreateIssueNoteOptions{Body: gitlab.Ptr(description)})
if err != nil {
logger.Sugar().Fatal(zap.Error(err))
}
Expand All @@ -199,7 +199,7 @@ func GenerateGitlabIssue(zones []SubnetResponse, pat, api, projectID, zone strin
}
if i == len(zones) {
if !inserted {
_, _, err := client.Notes.CreateIssueNote(project.ID, issue.IID, &gitlab.CreateIssueNoteOptions{Body: gitlab.String(description)})
_, _, err := client.Notes.CreateIssueNote(project.ID, issue.IID, &gitlab.CreateIssueNoteOptions{Body: gitlab.Ptr(description)})
if err != nil {
logger.Sugar().Fatal(zap.Error(err))
}
Expand Down

0 comments on commit eee1082

Please sign in to comment.