Skip to content

Commit fc0703e

Browse files
committed
chore: upgrade baton-sdk to v0.7.3 and Go to 1.25.2
- Update Go version from 1.23.4 to 1.25.2 - Upgrade baton-sdk from v0.2.96 to v0.7.3 - Update config.go for new SDK API (field.WithConstraints) - Delete main.yaml (replaced by verify.yaml from baton-admin)
1 parent afddda7 commit fc0703e

File tree

772 files changed

+126808
-24390
lines changed

Some content is hidden

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

772 files changed

+126808
-24390
lines changed

.github/workflows/ci.yaml

Lines changed: 7 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -7,95 +7,51 @@ jobs:
77
- name: Install Go
88
uses: actions/setup-go@v5
99
with:
10-
go-version: 1.23.x
10+
go-version-file: 'go.mod'
1111
- name: Checkout code
1212
uses: actions/checkout@v4
1313
- name: Run linters
14-
uses: golangci/golangci-lint-action@v4
14+
uses: golangci/golangci-lint-action@v8
1515
with:
1616
version: latest
1717
args: --timeout=3m
1818
go-test:
1919
strategy:
2020
matrix:
21-
go-version: [1.23.x]
2221
platform: [ubuntu-latest]
2322
runs-on: ${{ matrix.platform }}
2423
steps:
2524
- name: Install Go
2625
if: success()
2726
uses: actions/setup-go@v5
2827
with:
29-
go-version: ${{ matrix.go-version }}
28+
go-version-file: 'go.mod'
3029
- name: Checkout code
3130
uses: actions/checkout@v4
3231
- name: go tests
3332
run: go test -v -covermode=count -json ./... > test.json
3433
- name: annotate go tests
3534
if: always()
36-
uses: guyarb/golang-test-annotations@v0.5.1
35+
uses: guyarb/golang-test-annotations@v0.6.0
3736
with:
3837
test-results: test.json
3938

4039
test:
4140
runs-on: ubuntu-latest
42-
# Define any services needed for the test suite (or delete this section)
43-
# services:
44-
# postgres:
45-
# image: postgres:16
46-
# ports:
47-
# - "5432:5432"
48-
# env:
49-
# POSTGRES_PASSWORD: secretpassword
5041
env:
5142
BATON_LOG_LEVEL: debug
52-
# Add any environment variables needed to run baton-snowflake
53-
# BATON_BASE_URL: 'http://localhost:8080'
54-
# BATON_ACCESS_TOKEN: 'secret_token'
55-
# The following parameters are passed to grant/revoke commands
56-
# Change these to the correct IDs for your test data
5743
CONNECTOR_GRANT: 'grant:entitlement:group:1234:member:user:9876'
5844
CONNECTOR_ENTITLEMENT: 'entitlement:group:1234:member'
5945
CONNECTOR_PRINCIPAL: 'user:9876'
6046
CONNECTOR_PRINCIPAL_TYPE: 'user'
6147
steps:
6248
- name: Install Go
63-
uses: actions/setup-go@v4
49+
uses: actions/setup-go@v5
6450
with:
65-
go-version: 1.23.x
51+
go-version-file: 'go.mod'
6652
- name: Checkout code
67-
uses: actions/checkout@v3
68-
# Install any dependencies here (or delete this)
69-
# - name: Install postgres client
70-
# run: sudo apt install postgresql-client
71-
# Run any fixture setup here (or delete this)
72-
# - name: Import sql into postgres
73-
# run: psql -h localhost --user postgres -f environment.sql
74-
# env:
75-
# PGPASSWORD: secretpassword
53+
uses: actions/checkout@v4
7654
- name: Build baton-snowflake
7755
run: go build ./cmd/baton-snowflake
78-
# - name: Run baton-snowflake
79-
# run: ./baton-snowflake
80-
8156
- name: Install baton
8257
run: ./scripts/get-baton.sh && mv baton /usr/local/bin
83-
84-
# - name: Check for grant before revoking
85-
# run:
86-
# baton grants --entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --output-format=json | jq --exit-status ".grants[].principal.id.resource == \"${{ env.CONNECTOR_PRINCIPAL }}\""
87-
88-
# - name: Revoke grants
89-
# run: ./baton-snowflake --revoke-grant="${{ env.CONNECTOR_GRANT }}"
90-
91-
# - name: Check grant was revoked
92-
# run: ./baton-snowflake && baton grants --entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --output-format=json | jq --exit-status "if .grants then .grants[]?.principal.id.resource != \"${{ env.CONNECTOR_PRINCIPAL }}\" else . end"
93-
94-
# - name: Grant entitlement
95-
# # Change the grant arguments to the correct IDs for your test data
96-
# run: ./baton-snowflake --grant-entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --grant-principal="${{ env.CONNECTOR_PRINCIPAL }}" --grant-principal-type="${{ env.CONNECTOR_PRINCIPAL_TYPE }}"
97-
98-
# - name: Check grant was re-granted
99-
# run:
100-
# baton grants --entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --output-format=json | jq --exit-status ".grants[].principal.id.resource == \"${{ env.CONNECTOR_PRINCIPAL }}\""
101-

.github/workflows/main.yaml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.golangci.yml

Lines changed: 118 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,122 @@
1-
#AUTO GENERATED CODE. UPDATE THE CONFIG IN BATON-TEMPLATE FIRST
2-
linters-settings:
3-
exhaustive:
4-
default-signifies-exhaustive: true
5-
gocritic:
6-
enabled-checks:
7-
- ruleguard
8-
# The list of supported checkers can be find in https://go-critic.github.io/overview.
9-
settings:
10-
underef:
11-
# Whether to skip (*x).method() calls where x is a pointer receiver.
12-
skipRecvDeref: false
13-
ruleguard:
14-
rules: "${configDir}/tools/rules.go"
15-
govet:
16-
enable-all: true
17-
disable:
18-
- fieldalignment # too strict
19-
- shadow # complains too much about shadowing errors. All research points to this being fine.
20-
nakedret:
21-
max-func-lines: 0
22-
nolintlint:
23-
allow-no-explanation: [forbidigo, tracecheck, gomnd, gochecknoinits, makezero]
24-
require-explanation: true
25-
require-specific: true
26-
revive:
27-
ignore-generated-header: true
28-
severity: error
29-
rules:
30-
- name: atomic
31-
- name: line-length-limit
32-
arguments: [200]
33-
# These are functions that we use without checking the errors often. Most of these can't return an error even
34-
# though they implement an interface that can.
35-
- name: unhandled-error
36-
arguments:
37-
- fmt.Printf
38-
- fmt.Println
39-
- fmt.Fprint
40-
- fmt.Fprintf
41-
- fmt.Fprintln
42-
- os.Stderr.Sync
43-
- sb.WriteString
44-
- buf.WriteString
45-
- hasher.Write
46-
- os.Setenv
47-
- os.RemoveAll
48-
- name: var-naming
49-
arguments: [["ID", "URL", "HTTP", "API"], []]
50-
tenv:
51-
all: true
1+
version: "2"
2+
run:
3+
modules-download-mode: readonly
524
linters:
53-
disable-all: true
5+
default: none
546
enable:
55-
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases
56-
- gosimple # Linter for Go source code that specializes in simplifying a code
57-
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
58-
- ineffassign # Detects when assignments to existing variables are not used
59-
- staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks
60-
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
61-
- unused # Checks Go code for unused constants, variables, functions and types
62-
- asasalint # Check for pass []any as any in variadic func(...any)
63-
- asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers
64-
- bidichk # Checks for dangerous unicode character sequences
65-
- bodyclose # checks whether HTTP response body is closed successfully
66-
- durationcheck # check for two durations multiplied together
67-
- errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13.
68-
- exhaustive # check exhaustiveness of enum switch statements
69-
- forbidigo # Forbids identifiers
70-
- gochecknoinits # Checks that no init functions are present in Go code
71-
- goconst # Finds repeated strings that could be replaced by a constant
72-
- gocritic # Provides diagnostics that check for bugs, performance and style issues.
73-
- godot # Check if comments end in a period
74-
- goimports # In addition to fixing imports, goimports also formats your code in the same style as gofmt.
75-
- gomoddirectives # Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod.
76-
- goprintffuncname # Checks that printf-like functions are named with f at the end
77-
- gosec # Inspects source code for security problems
78-
- nakedret # Finds naked returns in functions greater than a specified function length
79-
- nilerr # Finds the code that returns nil even if it checks that the error is not nil.
80-
- noctx # noctx finds sending http request without context.Context
81-
- nolintlint # Reports ill-formed or insufficient nolint directives
82-
- nonamedreturns # Reports all named returns
83-
- nosprintfhostport # Checks for misuse of Sprintf to construct a host with port in a URL.
84-
- predeclared # find code that shadows one of Go's predeclared identifiers
85-
- revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint.
86-
- tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17
87-
- tparallel # tparallel detects inappropriate usage of t.Parallel() method in your Go test codes
88-
- unconvert # Remove unnecessary type conversions
89-
- usestdlibvars # detect the possibility to use variables/constants from the Go standard library
90-
- whitespace # Tool for detection of leading and trailing whitespace
7+
- asasalint
8+
- asciicheck
9+
- bidichk
10+
- bodyclose
11+
- durationcheck
12+
- errcheck
13+
- errorlint
14+
- exhaustive
15+
- forbidigo
16+
- gochecknoinits
17+
- goconst
18+
- gocritic
19+
- godot
20+
- gomoddirectives
21+
- goprintffuncname
22+
- gosec
23+
- govet
24+
- ineffassign
25+
- nakedret
26+
- nilerr
27+
- noctx
28+
- nolintlint
29+
- nonamedreturns
30+
- nosprintfhostport
31+
- predeclared
32+
- revive
33+
- staticcheck
34+
- tparallel
35+
- unconvert
36+
- unused
37+
- usestdlibvars
38+
- whitespace
39+
settings:
40+
exhaustive:
41+
default-signifies-exhaustive: true
42+
gocritic:
43+
enabled-checks:
44+
- ruleguard
45+
settings:
46+
ruleguard:
47+
rules: ${base-path}/tools/rules.go
48+
underef:
49+
skipRecvDeref: false
50+
govet:
51+
disable:
52+
- fieldalignment
53+
- shadow
54+
enable-all: true
55+
nakedret:
56+
max-func-lines: 0
57+
nolintlint:
58+
require-explanation: true
59+
require-specific: true
60+
allow-no-explanation:
61+
- forbidigo
62+
- tracecheck
63+
- gomnd
64+
- gochecknoinits
65+
- makezero
66+
revive:
67+
severity: error
68+
rules:
69+
- name: atomic
70+
- name: line-length-limit
71+
arguments:
72+
- 200
73+
- name: unhandled-error
74+
arguments:
75+
- fmt.Printf
76+
- fmt.Println
77+
- fmt.Fprint
78+
- fmt.Fprintf
79+
- fmt.Fprintln
80+
- os.Stderr.Sync
81+
- sb.WriteString
82+
- buf.WriteString
83+
- hasher.Write
84+
- os.Setenv
85+
- os.RemoveAll
86+
- name: var-naming
87+
arguments:
88+
- - ID
89+
- URL
90+
- HTTP
91+
- API
92+
- []
93+
exclusions:
94+
generated: lax
95+
presets:
96+
- comments
97+
- common-false-positives
98+
- legacy
99+
- std-error-handling
100+
rules:
101+
- linters:
102+
- godot
103+
source: (TODO)
104+
- path: (.+)\.go$
105+
text: third_party$
106+
- path: (.+)\.go$
107+
text: builtin$
108+
- path: (.+)\.go$
109+
text: examples$
110+
paths:
111+
- third_party$
112+
- builtin$
113+
- examples$
91114
issues:
92115
max-same-issues: 50
93-
exclude-rules:
94-
# Don't require TODO comments to end in a period
95-
- source: "(TODO)"
96-
linters: [godot]
116+
formatters:
117+
exclusions:
118+
generated: lax
119+
paths:
120+
- third_party$
121+
- builtin$
122+
- examples$

cmd/baton-snowflake/config.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,15 @@ var (
4343
UserIdentifierField,
4444
SyncSecrets,
4545
},
46-
field.FieldsMutuallyExclusive(
47-
PrivateKeyPathField,
48-
PrivateKeyField,
49-
),
50-
field.FieldsAtLeastOneUsed(
51-
PrivateKeyPathField,
52-
PrivateKeyField,
46+
field.WithConstraints(
47+
field.FieldsMutuallyExclusive(
48+
PrivateKeyPathField,
49+
PrivateKeyField,
50+
),
51+
field.FieldsAtLeastOneUsed(
52+
PrivateKeyPathField,
53+
PrivateKeyField,
54+
),
5355
),
5456
)
5557
)

cmd/baton-snowflake/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"os"
77

88
"github.com/conductorone/baton-sdk/pkg/connectorbuilder"
9+
"github.com/conductorone/baton-sdk/pkg/connectorrunner"
910
"github.com/conductorone/baton-sdk/pkg/types"
1011
"github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap"
1112
"github.com/spf13/viper"
@@ -26,6 +27,7 @@ func main() {
2627
connectorName,
2728
getConnector,
2829
configurationSchema,
30+
connectorrunner.WithDefaultCapabilitiesConnectorBuilder(&connector.Connector{}),
2931
)
3032
if err != nil {
3133
fmt.Fprintln(os.Stderr, err.Error())

0 commit comments

Comments
 (0)