Skip to content

Commit 4dea465

Browse files
authored
Merge pull request #1 from bub3n/cherry-pick-my-changes
Cherry pick my changes
2 parents 16a9f10 + e4cda94 commit 4dea465

18 files changed

+116
-16
lines changed

cmd/server.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ const (
5454
ADTokenFlag = "azuredevops-token" // nolint: gosec
5555
ADUserFlag = "azuredevops-user"
5656
ADHostnameFlag = "azuredevops-hostname"
57+
ADDiffTop = "azuredevops-diff-top"
58+
ADDiffSkip = "azuredevops-diff-skip"
5759
AllowCommandsFlag = "allow-commands"
5860
AllowForkPRsFlag = "allow-fork-prs"
5961
AtlantisURLFlag = "atlantis-url"
@@ -164,6 +166,8 @@ const (
164166
DefaultADBasicUser = ""
165167
DefaultADBasicPassword = ""
166168
DefaultADHostname = "dev.azure.com"
169+
DefaultADDiffTop = 100
170+
DefaultADDiffSkip = 0
167171
DefaultAutoDiscoverMode = "auto"
168172
DefaultAutoplanFileList = "**/*.tf,**/*.tfvars,**/*.tfvars.json,**/terragrunt.hcl,**/.terraform.lock.hcl"
169173
DefaultAllowCommands = "version,plan,apply,unlock,approve_policies"
@@ -637,6 +641,14 @@ var boolFlags = map[string]boolFlag{
637641
},
638642
}
639643
var intFlags = map[string]intFlag{
644+
ADDiffTop: {
645+
description: "Azure DevOps maximum number of changes to return in diff",
646+
defaultValue: 100,
647+
},
648+
ADDiffSkip: {
649+
description: "Azure DevOps number of changes to skip in diff.",
650+
defaultValue: 0,
651+
},
640652
CheckoutDepthFlag: {
641653
description: fmt.Sprintf("Used only if --%s=%s.", CheckoutStrategyFlag, CheckoutStrategyMerge) +
642654
" How many commits to include in each of base and feature branches when cloning repository." +
@@ -883,6 +895,12 @@ func (s *ServerCmd) setDefaults(c *server.UserConfig, v *viper.Viper) {
883895
if c.AzureDevOpsHostname == "" {
884896
c.AzureDevOpsHostname = DefaultADHostname
885897
}
898+
if c.AzureDevOpsDiffTop == 0 {
899+
c.AzureDevOpsDiffTop = DefaultADDiffTop
900+
}
901+
if c.AzureDevOpsDiffSkip == 0 {
902+
c.AzureDevOpsDiffSkip = DefaultADDiffSkip
903+
}
886904
if c.AutoplanFileList == "" {
887905
c.AutoplanFileList = DefaultAutoplanFileList
888906
}

cmd/server_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ var testFlags = map[string]interface{}{
5858
ADHostnameFlag: "dev.azure.com",
5959
ADTokenFlag: "ad-token",
6060
ADUserFlag: "ad-user",
61+
ADDiffTop: 100,
62+
ADDiffSkip: 0,
6163
ADWebhookPasswordFlag: "ad-wh-pass",
6264
ADWebhookUserFlag: "ad-wh-user",
6365
AtlantisURLFlag: "url",

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ require (
1010
github.com/bradleyfalzon/ghinstallation/v2 v2.13.0
1111
github.com/briandowns/spinner v1.23.1
1212
github.com/cactus/go-statsd-client/v5 v5.1.0
13+
github.com/drmaxgit/go-azuredevops v0.13.1
1314
github.com/go-ozzo/ozzo-validation v3.6.0+incompatible
1415
github.com/go-playground/validator/v10 v10.23.0
1516
github.com/go-test/deep v1.1.1
@@ -27,7 +28,6 @@ require (
2728
github.com/hashicorp/terraform-config-inspect v0.0.0-20241129133400-c404f8227ea6
2829
github.com/jpillora/backoff v1.0.0
2930
github.com/kr/pretty v0.3.1
30-
github.com/mcdafydd/go-azuredevops v0.12.1
3131
github.com/microcosm-cc/bluemonday v1.0.27
3232
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db
3333
github.com/mitchellh/go-homedir v1.1.0
@@ -108,6 +108,7 @@ require (
108108
github.com/mattn/go-colorable v0.1.13 // indirect
109109
github.com/mattn/go-isatty v0.0.20 // indirect
110110
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
111+
github.com/mcdafydd/go-azuredevops v0.12.1 // indirect
111112
github.com/mitchellh/copystructure v1.2.0 // indirect
112113
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
113114
github.com/mitchellh/go-wordwrap v1.0.1 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ github.com/davidmz/go-pageant v1.0.2 h1:bPblRCh5jGU+Uptpz6LgMZGD5hJoOt7otgT454Wv
114114
github.com/davidmz/go-pageant v1.0.2/go.mod h1:P2EDDnMqIwG5Rrp05dTRITj9z2zpGcD9efWSkTNKLIE=
115115
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
116116
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
117+
github.com/drmaxgit/go-azuredevops v0.13.1 h1:mqRxiwnbKraHAtqfTFa+xD75Atf84MgpjKJdA8hJeS4=
118+
github.com/drmaxgit/go-azuredevops v0.13.1/go.mod h1:m1pO2fW60I9FahzLHMmHYq3bM446ZMZKDpd8+AEKzxc=
117119
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
118120
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
119121
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=

runatlantis.io/docs/server-configuration.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,26 @@ This flag overrides `--autoplan-modules`. If you wish to disable auto-planning o
231231
and set `--autoplan-modules` to `false`.
232232
:::
233233

234+
### `--azuredevops-diff-skip`
235+
236+
```bash
237+
atlantis server --azuredevops-diff-skip=50
238+
# or
239+
ATLANTIS_AZUREDEVOPS_DIFF_SKIP="50"
240+
```
241+
242+
Number of items on a single page in Azure DevOps paged responses. Defaults to `0`.
243+
244+
### `--azuredevops-diff-top`
245+
246+
```bash
247+
atlantis server --azuredevops-diff-top=1000
248+
# or
249+
ATLANTIS_AZUREDEVOPS_DIFF_TOP="1000"
250+
```
251+
252+
Number of items on a single page in Azure DevOps paged responses. Defaults to `100`.
253+
234254
### `--azuredevops-hostname`
235255

236256
```bash

server/controllers/events/azuredevops_request_validator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"io"
66
"net/http"
77

8-
"github.com/mcdafydd/go-azuredevops/azuredevops"
8+
"github.com/drmaxgit/go-azuredevops/azuredevops"
99
)
1010

1111
//go:generate pegomock generate --package mocks -o mocks/mock_azuredevops_request_validator.go AzureDevopsRequestValidator

server/controllers/events/events_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
"strings"
2424

2525
"github.com/google/go-github/v68/github"
26-
"github.com/mcdafydd/go-azuredevops/azuredevops"
26+
"github.com/drmaxgit/go-azuredevops/azuredevops"
2727
"github.com/microcosm-cc/bluemonday"
2828
"github.com/pkg/errors"
2929
"github.com/runatlantis/atlantis/server/events"

server/controllers/events/events_controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
"testing"
2727

2828
"github.com/google/go-github/v68/github"
29-
"github.com/mcdafydd/go-azuredevops/azuredevops"
29+
"github.com/drmaxgit/go-azuredevops/azuredevops"
3030
. "github.com/petergtz/pegomock/v4"
3131
events_controllers "github.com/runatlantis/atlantis/server/controllers/events"
3232
"github.com/runatlantis/atlantis/server/controllers/events/mocks"

server/events/command_runner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import (
1717
"fmt"
1818
"strconv"
1919

20+
"github.com/drmaxgit/go-azuredevops/azuredevops"
2021
"github.com/google/go-github/v68/github"
21-
"github.com/mcdafydd/go-azuredevops/azuredevops"
2222
"github.com/pkg/errors"
2323
"github.com/runatlantis/atlantis/server/core/config/valid"
2424
"github.com/runatlantis/atlantis/server/events/command"

server/events/event_parser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
"github.com/go-playground/validator/v10"
2727
"github.com/google/go-github/v68/github"
2828
lru "github.com/hashicorp/golang-lru/v2"
29-
"github.com/mcdafydd/go-azuredevops/azuredevops"
29+
"github.com/drmaxgit/go-azuredevops/azuredevops"
3030
"github.com/pkg/errors"
3131
"github.com/runatlantis/atlantis/server/events/command"
3232
"github.com/runatlantis/atlantis/server/events/models"

0 commit comments

Comments
 (0)