Skip to content

Commit e2da9e3

Browse files
authored
Merge pull request #77 from ConductorOne/ggreer/password
Add support for setting passwords
2 parents 1c09901 + c187ca3 commit e2da9e3

File tree

102 files changed

+12592
-2611
lines changed

Some content is hidden

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

102 files changed

+12592
-2611
lines changed

.github/workflows/ci.yaml

Lines changed: 55 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ jobs:
99
go-lint:
1010
runs-on: ubuntu-latest
1111
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
1214
- name: Install Go
1315
uses: actions/setup-go@v5
1416
with:
15-
go-version: 1.23.x
16-
- name: Checkout code
17-
uses: actions/checkout@v4
17+
go-version-file: go.mod
1818
- name: Run linters
1919
uses: golangci/golangci-lint-action@v8
2020
with:
@@ -23,86 +23,68 @@ jobs:
2323
go-test:
2424
strategy:
2525
matrix:
26-
go-version: [1.23.x]
2726
platform: [ubuntu-latest]
2827
runs-on: ${{ matrix.platform }}
2928
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v4
3031
- name: Install Go
3132
if: success()
3233
uses: actions/setup-go@v5
3334
with:
34-
go-version: ${{ matrix.go-version }}
35-
- name: Checkout code
36-
uses: actions/checkout@v4
35+
go-version-file: go.mod
3736
- name: go tests
3837
run: (set -o pipefail && go test -v -covermode=atomic -json -race ./... | tee test.json)
3938
- name: annotate go tests
4039
if: always()
41-
uses: guyarb/golang-test-annotations@v0.6.0
40+
uses: guyarb/golang-test-annotations@v0.8.0
4241
with:
4342
test-results: test.json
44-
# test:
45-
# runs-on: ubuntu-latest
46-
# # Define any services needed for the test suite (or delete this section)
47-
# # services:
48-
# # postgres:
49-
# # image: postgres:16
50-
# # ports:
51-
# # - "5432:5432"
52-
# # env:
53-
# # POSTGRES_PASSWORD: secretpassword
54-
# env:
55-
# BATON_LOG_LEVEL: debug
56-
# # Add any environment variables needed to run baton-sql
57-
# # BATON_BASE_URL: 'http://localhost:8080'
58-
# # BATON_ACCESS_TOKEN: 'secret_token'
59-
# # The following parameters are passed to grant/revoke commands
60-
# # Change these to the correct IDs for your test data
61-
# CONNECTOR_GRANT: 'grant:entitlement:group:1234:member:user:9876'
62-
# CONNECTOR_ENTITLEMENT: 'entitlement:group:1234:member'
63-
# CONNECTOR_PRINCIPAL: 'user:9876'
64-
# CONNECTOR_PRINCIPAL_TYPE: 'user'
65-
# steps:
66-
# - name: Install Go
67-
# uses: actions/setup-go@v5
68-
# with:
69-
# go-version: 1.23.x
70-
# - name: Checkout code
71-
# uses: actions/checkout@v4
72-
# # Install any dependencies here (or delete this)
73-
# # - name: Install postgres client
74-
# # run: sudo apt install postgresql-client
75-
# # Run any fixture setup here (or delete this)
76-
# # - name: Import sql into postgres
77-
# # run: psql -h localhost --user postgres -f environment.sql
78-
# # env:
79-
# # PGPASSWORD: secretpassword
80-
# - name: Build baton-sql
81-
# run: go build ./cmd/baton-sql
82-
# - name: Run baton-sql
83-
# run: ./baton-sql
84-
#
85-
# - name: Install baton
86-
# run: ./scripts/get-baton.sh && mv baton /usr/local/bin
87-
#
88-
# - name: Check for grant before revoking
89-
#
90-
# run:
91-
# baton grants --entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --output-format=json | jq --exit-status ".grants[].principal.id.resource == \"${{ env.CONNECTOR_PRINCIPAL }}\""
92-
#
93-
#
94-
# - name: Revoke grants
95-
# run: ./baton-sql --revoke-grant="${{ env.CONNECTOR_GRANT }}"
96-
#
97-
# - name: Check grant was revoked
98-
# run: ./baton-sql && baton grants --entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --output-format=json | jq --exit-status "if .grants then .grants[]?.principal.id.resource != \"${{ env.CONNECTOR_PRINCIPAL }}\" else . end"
99-
#
100-
# - name: Grant entitlement
101-
# # Change the grant arguments to the correct IDs for your test data
102-
# run: ./baton-sql --grant-entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --grant-principal="${{ env.CONNECTOR_PRINCIPAL }}" --grant-principal-type="${{ env.CONNECTOR_PRINCIPAL_TYPE }}"
103-
#
104-
# - name: Check grant was re-granted
105-
#
106-
# run:
107-
# baton grants --entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --output-format=json | jq --exit-status ".grants[].principal.id.resource == \"${{ env.CONNECTOR_PRINCIPAL }}\""
108-
#
43+
test:
44+
runs-on: ubuntu-latest
45+
services:
46+
postgres:
47+
image: postgres:16
48+
ports:
49+
- "5432:5432"
50+
env:
51+
POSTGRES_PASSWORD: secretpassword
52+
POSTGRES_DB: batondb
53+
54+
env:
55+
BATON_LOG_LEVEL: debug
56+
BATON_CONFIG_PATH: ./examples/postgres-test.yml
57+
DB_USER: postgres
58+
DB_PASSWORD: secretpassword
59+
DB_HOST: localhost
60+
DB_PORT: 5432
61+
DB_DATABASE: batondb
62+
BATON_PROVISIONING: true
63+
steps:
64+
- name: Checkout code
65+
uses: actions/checkout@v4
66+
- name: Install Go
67+
uses: actions/setup-go@v5
68+
with:
69+
go-version-file: go.mod
70+
- name: Install postgres client
71+
run: sudo apt install postgresql-client
72+
- name: Import sql into postgres
73+
run: psql -h localhost --user postgres -d batondb -f ./test/postgres-init.sql
74+
env:
75+
PGPASSWORD: secretpassword
76+
- name: Build baton-sql
77+
run: go build ./cmd/baton-sql
78+
- name: Run sync tests
79+
uses: ConductorOne/github-workflows/actions/sync-test@v2
80+
with:
81+
connector: ./baton-sql
82+
baton-entitlement: 'role:admin:member'
83+
baton-principal: john.smith
84+
baton-principal-type: user
85+
- name: Run account provisioning tests
86+
uses: ConductorOne/github-workflows/actions/account-provisioning@v3
87+
with:
88+
connector: ./baton-sql
89+
account-email: [email protected]
90+
account-login: john.smith

.gon-amd64.json

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

.gon-arm64.json

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

.goreleaser.docker.yaml

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

.goreleaser.yaml

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

Dockerfile.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.24-alpine as builder
1+
FROM golang:1.25-alpine as builder
22

33
WORKDIR /app
44

@@ -13,7 +13,7 @@ COPY . .
1313
RUN go build -o baton-sql ./cmd/baton-sql
1414

1515
# Create final container
16-
FROM alpine:3.18
16+
FROM alpine:3.22
1717

1818
RUN apk add --no-cache ca-certificates bash curl
1919

docker-compose-postgres-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
services:
22
# PostgreSQL Database for testing employee_id and last_login features
33
postgres:
4-
image: postgres:14
4+
image: postgres:16
55
container_name: baton-postgres-test
66
environment:
77
POSTGRES_USER: baton

0 commit comments

Comments
 (0)