Skip to content

Commit 83581fd

Browse files
feat: incremental scanning support [IDE-275] (#52)
2 parents 5370be8 + 506514f commit 83581fd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1597
-923
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
name: Install tools
5656
command: make tools
5757
- run:
58-
name: Run smoke tests
58+
name: Run contract tests
5959
command: make contract-test
6060
build:
6161
executor: default

CONTRIBUTING.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@ python3 -m pip install yq --break-system-packages
5151
python3 -m pip install pycurl --break-system-packages
5252
```
5353

54-
Then run `make download-apis` to download the latest code. If you want to download a new version, you can also do that.
54+
Then update `scripts/download-orchestration-api.py` with the latest commit & api version timestamp as found at https://github.com/snyk/orchestration-service/tree/main/src/rest/resources/scans
55+
56+
Then update `scripts/download-workspace-api.py` with the latest commit & api version timestamp as found at https://github.com/snyk/workspace-service/tree/main/src/rest/api/hidden/resources/workspaces
57+
58+
Do a search/replace across files, if the version timestamp has changed to replace all old versions with the new version.
59+
60+
Then run `make tools download-apis` to download the latest code. If you want to download a new version, you can also do that.
5561

5662
Then generate the client by running `make generate`.
5763

Makefile

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,18 @@ GOARCH = $(shell go env GOARCH)
55
TOOLS_BIN := $(shell pwd)/.bin
66

77
OVERRIDE_GOCI_LINT_V := v1.55.2
8-
PACT_V := 2.4.2
9-
10-
SHELL:=env PATH=$(TOOLS_BIN)/go:$(TOOLS_BIN)/pact/bin:$(PATH) $(SHELL)
8+
SHELL:=env PATH=$(TOOLS_BIN)/go:$(PATH) $(SHELL)
119

1210
## tools: Install required tooling.
1311
.PHONY: tools
14-
tools: $(TOOLS_BIN)/golangci-lint $(TOOLS_BIN)/go $(TOOLS_BIN)/pact/bin/pact
12+
tools: $(TOOLS_BIN)/golangci-lint $(TOOLS_BIN)/go
1513
$(TOOLS_BIN)/golangci-lint:
1614
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/$(OVERRIDE_GOCI_LINT_V)/install.sh | sh -s -- -b $(TOOLS_BIN)/ $(OVERRIDE_GOCI_LINT_V)
1715

1816
$(TOOLS_BIN)/go:
1917
mkdir -p ${TOOLS_BIN}/go
2018
@cat tools.go | grep _ | awk -F'"' '{print $$2}' | xargs -tI % sh -c 'GOBIN=${TOOLS_BIN}/go go install %'
21-
22-
$(TOOLS_BIN)/pact/bin/pact:
23-
cd $(TOOLS_BIN); curl -fsSL https://raw.githubusercontent.com/pact-foundation/pact-ruby-standalone/v$(PACT_V)/install.sh | PACT_CLI_VERSION=v$(PACT_V) bash
19+
@GOBIN=${TOOLS_BIN}/go ${TOOLS_BIN}/go/pact-go -l DEBUG install -d /tmp
2420

2521
.PHONY: format
2622
format:
@@ -45,6 +41,7 @@ build:
4541
clean:
4642
@echo "Cleaning up..."
4743
@GOOS=$(GOOS) GOARCH=$(GOARCH) go clean -testcache
44+
@rm -rf $(TOOLS_BIN)
4845

4946
.PHONY: test
5047
test:
@@ -57,7 +54,7 @@ testv:
5754
@go test -v
5855

5956
.PHONY: contract-test
60-
contract-test: $(TOOLS_BIN)/pact
57+
contract-test: $(TOOLS_BIN)
6158
@echo "Contract testing..."
6259
@go test -tags=CONTRACT ./...
6360

go.mod

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ module github.com/snyk/code-client-go
33
go 1.21
44

55
require (
6-
github.com/deepmap/oapi-codegen v1.14.0
6+
github.com/deepmap/oapi-codegen v1.16.3
77
github.com/go-git/go-git/v5 v5.11.0
88
github.com/golang/mock v1.6.0
99
github.com/google/uuid v1.6.0
1010
github.com/oapi-codegen/runtime v1.0.0
11-
github.com/pact-foundation/pact-go v1.7.0
11+
github.com/pact-foundation/pact-go/v2 v2.0.5
1212
github.com/pkg/errors v0.9.1
1313
github.com/puzpuzpuz/xsync v1.5.2
1414
github.com/rs/zerolog v1.32.0
1515
github.com/stretchr/testify v1.9.0
16-
golang.org/x/net v0.22.0
16+
golang.org/x/net v0.23.0
1717
)
1818

1919
require (
@@ -33,6 +33,7 @@ require (
3333
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
3434
github.com/hashicorp/go-version v1.6.0 // indirect
3535
github.com/hashicorp/logutils v1.0.0 // indirect
36+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
3637
github.com/invopop/yaml v0.2.0 // indirect
3738
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
3839
github.com/josharian/intern v1.0.0 // indirect
@@ -46,13 +47,19 @@ require (
4647
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
4748
github.com/sergi/go-diff v1.3.1 // indirect
4849
github.com/skeema/knownhosts v1.2.1 // indirect
50+
github.com/spf13/afero v1.11.0 // indirect
51+
github.com/spf13/cobra v1.8.0 // indirect
52+
github.com/spf13/pflag v1.0.5 // indirect
4953
github.com/stretchr/objx v0.5.2 // indirect
5054
github.com/xanzy/ssh-agent v0.3.3 // indirect
5155
golang.org/x/crypto v0.21.0 // indirect
5256
golang.org/x/mod v0.16.0 // indirect
5357
golang.org/x/sys v0.18.0 // indirect
5458
golang.org/x/text v0.14.0 // indirect
5559
golang.org/x/tools v0.19.0 // indirect
60+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
61+
google.golang.org/grpc v1.63.2 // indirect
62+
google.golang.org/protobuf v1.33.0 // indirect
5663
gopkg.in/warnings.v0 v0.1.2 // indirect
5764
gopkg.in/yaml.v2 v2.4.0 // indirect
5865
gopkg.in/yaml.v3 v3.0.1 // indirect

0 commit comments

Comments
 (0)