44 go-lint :
55 runs-on : ubuntu-latest
66 steps :
7+ - name : Checkout code
8+ uses : actions/checkout@v4
79 - name : Install Go
810 uses : actions/setup-go@v5
911 with :
10- go-version : 1.23.x
11- - name : Checkout code
12- uses : actions/checkout@v4
12+ go-version-file : go.mod
1313 - name : Run linters
1414 uses : golangci/golangci-lint-action@v8
1515 with :
@@ -18,22 +18,21 @@ jobs:
1818 go-test :
1919 strategy :
2020 matrix :
21- go-version : [ 1.23.x ]
22- platform : [ ubuntu-latest ]
21+ platform : [ubuntu-latest]
2322 runs-on : ${{ matrix.platform }}
2423 steps :
24+ - name : Checkout code
25+ uses : actions/checkout@v4
2526 - name : Install Go
2627 if : success()
2728 uses : actions/setup-go@v5
2829 with :
29- go-version : ${{ matrix.go-version }}
30- - name : Checkout code
31- uses : actions/checkout@v4
30+ go-version-file : go.mod
3231 - name : go tests
3332 run : (set -o pipefail && go test -v -covermode=count -json ./... | tee 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.8.0
3736 with :
3837 test-results : test.json
3938
@@ -42,63 +41,25 @@ jobs:
4241 env :
4342 BATON_LOG_LEVEL : debug
4443
45- CONNECTOR_GRANT : ' workspaceRole:T08101AQL31:member:assigned:user:U083SJ36LCD'
46- CONNECTOR_ENTITLEMENT : ' workspaceRole:T08101AQL31:member:assigned'
47- CONNECTOR_PRINCIPAL : ' U083SJ36LCD'
48- CONNECTOR_PRINCIPAL_TYPE : ' user'
49-
5044 BATON_TOKEN : " ${{ secrets.BATON_TOKEN }}"
5145 BATON_ENTERPRISE_TOKEN : " ${{ secrets.BATON_ENTERPRISE_TOKEN }}"
5246
5347 steps :
48+ - name : Checkout code
49+ uses : actions/checkout@v4
5450 - name : Install Go
5551 uses : actions/setup-go@v5
5652 with :
57- go-version : 1.23.x
58- - name : Checkout code
59- uses : actions/checkout@v4
53+ go-version-file : go.mod
6054 - name : Build baton-slack
6155 run : go build ./cmd/baton-slack
62- - name : Run baton-slack
63- run : ./baton-slack
64- - name : Install baton
65- run : ./scripts/get-baton.sh && mv baton /usr/local/bin
66-
67- - name : Grant entitlement first time
68- run : |
69- ./baton-slack --grant-entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" \
70- --grant-principal="${{ env.CONNECTOR_PRINCIPAL }}" \
71- --grant-principal-type="${{ env.CONNECTOR_PRINCIPAL_TYPE }}"
72-
73- - name : Check for grant before revoking
74- run : |
75- ./baton-slack && \
76- baton grants --entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --output-format=json | \
77- jq --exit-status ".grants[].principal.id.resource == \"${{ env.CONNECTOR_PRINCIPAL }}\"" | grep true
78-
79- - name : Revoke grants
80- run : ./baton-slack --revoke-grant="${{ env.CONNECTOR_GRANT }}"
81-
82- - name : Check grant was revoked
83- run : |
84- ./baton-slack && \
85- baton grants --entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --output-format=json | \
86- jq --exit-status "if .grants then .grants[]?.principal.id.resource != \"${{ env.CONNECTOR_PRINCIPAL }}\" else . end"
87-
88- - name : Grant entitlement second time
89- run : |
90- ./baton-slack --grant-entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" \
91- --grant-principal="${{ env.CONNECTOR_PRINCIPAL }}" \
92- --grant-principal-type="${{ env.CONNECTOR_PRINCIPAL_TYPE }}"
93-
94- - name : Wait 10 seconds
95- run : sleep 10
96-
97- - name : Check grant was re-granted
98- run : |
99- ./baton-slack && \
100- baton grants --entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --output-format=json | \
101- jq --exit-status ".grants[].principal.id.resource == \"${{ env.CONNECTOR_PRINCIPAL }}\"" | grep true
56+ - name : Grant/revoke entitlement
57+ uses : ConductorOne/github-workflows/actions/sync-test@v2
58+ with :
59+ connector : ./baton-slack
60+ baton-entitlement : " workspaceRole:T08101AQL31:member:assigned"
61+ baton-principal : " U083SJ36LCD"
62+ baton-principal-type : " user"
10263
10364 test-admin :
10465 needs : [test-member]
@@ -107,186 +68,74 @@ jobs:
10768 # Logging level for Baton
10869 BATON_LOG_LEVEL : debug
10970
110- # Connector-specific details
111- CONNECTOR_GRANT : ' workspaceRole:T08101AQL31:admin:assigned:user:U083SJ36LCD'
112- CONNECTOR_ENTITLEMENT : ' workspaceRole:T08101AQL31:admin:assigned'
113- CONNECTOR_PRINCIPAL : ' U083SJ36LCD'
114- CONNECTOR_PRINCIPAL_TYPE : ' user'
115-
11671 # Secrets for Baton authentication
11772 BATON_TOKEN : " ${{ secrets.BATON_TOKEN }}"
11873 BATON_ENTERPRISE_TOKEN : " ${{ secrets.BATON_ENTERPRISE_TOKEN }}"
11974
12075 steps :
76+ - name : Checkout code
77+ uses : actions/checkout@v4
12178 - name : Install Go
12279 uses : actions/setup-go@v5
12380 with :
124- go-version : 1.23.x
125- - name : Checkout code
126- uses : actions/checkout@v4
81+ go-version-file : go.mod
12782 - name : Build baton-slack
12883 run : go build ./cmd/baton-slack
129-
130- - name : Run baton-slack
131- run : ./baton-slack
132- - name : Install baton
133- run : ./scripts/get-baton.sh && mv baton /usr/local/bin
134-
135- - name : Grant entitlement first time
136- run : |
137- ./baton-slack --grant-entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" \
138- --grant-principal="${{ env.CONNECTOR_PRINCIPAL }}" \
139- --grant-principal-type="${{ env.CONNECTOR_PRINCIPAL_TYPE }}"
140-
141- - name : Check for grant before revoking
142- run : |
143- ./baton-slack && \
144- baton grants --entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --output-format=json | \
145- jq --exit-status ".grants[].principal.id.resource == \"${{ env.CONNECTOR_PRINCIPAL }}\"" | grep true
146-
147- - name : Revoke grants
148- run : ./baton-slack --revoke-grant="${{ env.CONNECTOR_GRANT }}"
149-
150- - name : Check grant was revoked
151- run : |
152- ./baton-slack && \
153- baton grants --entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --output-format=json | \
154- jq --exit-status "if .grants then .grants[]?.principal.id.resource != \"${{ env.CONNECTOR_PRINCIPAL }}\" else . end"
155- #
156- - name : Grant entitlement second time
157- run : |
158- ./baton-slack --grant-entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" \
159- --grant-principal="${{ env.CONNECTOR_PRINCIPAL }}" \
160- --grant-principal-type="${{ env.CONNECTOR_PRINCIPAL_TYPE }}"
161-
162- - name : Check grant was re-granted
163- run : |
164- ./baton-slack && \
165- baton grants --entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --output-format=json | \
166- jq --exit-status ".grants[].principal.id.resource == \"${{ env.CONNECTOR_PRINCIPAL }}\""
167-
84+ - name : Grant/revoke entitlement
85+ uses : ConductorOne/github-workflows/actions/sync-test@v2
86+ with :
87+ connector : ./baton-slack
88+ baton-entitlement : " workspaceRole:T08101AQL31:admin:assigned"
89+ baton-principal : " U083SJ36LCD"
90+ baton-principal-type : " user"
16891
16992 test-owner :
17093 needs : [test-member, test-admin]
17194 runs-on : ubuntu-latest
17295 env :
17396 BATON_LOG_LEVEL : debug
17497
175- CONNECTOR_GRANT : ' workspaceRole:T08101AQL31:owner:assigned:user:U083SJ36LCD'
176- CONNECTOR_ENTITLEMENT : ' workspaceRole:T08101AQL31:owner:assigned'
177- CONNECTOR_PRINCIPAL : ' U083SJ36LCD'
178- CONNECTOR_PRINCIPAL_TYPE : ' user'
179-
18098 BATON_TOKEN : " ${{ secrets.BATON_TOKEN }}"
18199 BATON_ENTERPRISE_TOKEN : " ${{ secrets.BATON_ENTERPRISE_TOKEN }}"
182100
183101 steps :
102+ - name : Checkout code
103+ uses : actions/checkout@v4
184104 - name : Install Go
185105 uses : actions/setup-go@v5
186106 with :
187- go-version : 1.23.x
188- - name : Checkout code
189- uses : actions/checkout@v4
107+ go-version-file : go.mod
190108 - name : Build baton-slack
191109 run : go build ./cmd/baton-slack
192-
193- - name : Run baton-slack
194- run : ./baton-slack
195- - name : Install baton
196- run : ./scripts/get-baton.sh && mv baton /usr/local/bin
197-
198- - name : Grant entitlement first time
199- run : |
200- ./baton-slack --grant-entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" \
201- --grant-principal="${{ env.CONNECTOR_PRINCIPAL }}" \
202- --grant-principal-type="${{ env.CONNECTOR_PRINCIPAL_TYPE }}"
203-
204- - name : Check for grant before revoking
205- run : |
206- ./baton-slack && \
207- baton grants --entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --output-format=json | \
208- jq --exit-status ".grants[].principal.id.resource == \"${{ env.CONNECTOR_PRINCIPAL }}\"" | grep true
209-
210- - name : Revoke grants
211- run : ./baton-slack --revoke-grant="${{ env.CONNECTOR_GRANT }}"
212-
213- - name : Check grant was revoked
214- run : |
215- ./baton-slack && \
216- baton grants --entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --output-format=json | \
217- jq --exit-status "if .grants then .grants[]?.principal.id.resource != \"${{ env.CONNECTOR_PRINCIPAL }}\" else . end"
218-
219- - name : Grant entitlement second time
220- run : |
221- ./baton-slack --grant-entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" \
222- --grant-principal="${{ env.CONNECTOR_PRINCIPAL }}" \
223- --grant-principal-type="${{ env.CONNECTOR_PRINCIPAL_TYPE }}"
224-
225- - name : Check grant was re-granted
226- run : |
227- ./baton-slack && \
228- baton grants --entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --output-format=json | \
229- jq --exit-status ".grants[].principal.id.resource == \"${{ env.CONNECTOR_PRINCIPAL }}\""
110+ - name : Grant/revoke entitlement
111+ uses : ConductorOne/github-workflows/actions/sync-test@v2
112+ with :
113+ connector : ./baton-slack
114+ baton-entitlement : " workspaceRole:T08101AQL31:owner:assigned"
115+ baton-principal : " U083SJ36LCD"
116+ baton-principal-type : " user"
230117
231118 test-enterprise-roles :
232119 runs-on : ubuntu-latest
233120 env :
234121 BATON_LOG_LEVEL : debug
235122
236- CONNECTOR_GRANT : ' enterpriseRole:Rl0K:assigned:user:U083SJ36LCD'
237- CONNECTOR_ENTITLEMENT : ' enterpriseRole:Rl0K:assigned'
238- CONNECTOR_PRINCIPAL : ' U083SJ36LCD'
239- CONNECTOR_PRINCIPAL_TYPE : ' user'
240-
241123 BATON_TOKEN : " ${{ secrets.BATON_TOKEN }}"
242124 BATON_ENTERPRISE_TOKEN : " ${{ secrets.BATON_ENTERPRISE_TOKEN }}"
243125
244126 steps :
127+ - name : Checkout code
128+ uses : actions/checkout@v4
245129 - name : Install Go
246130 uses : actions/setup-go@v5
247131 with :
248- go-version : 1.23.x
249- - name : Checkout code
250- uses : actions/checkout@v4
132+ go-version-file : go.mod
251133 - name : Build baton-slack
252134 run : go build ./cmd/baton-slack
253-
254- - name : Run baton-slack
255- run : ./baton-slack
256- - name : Install baton
257- run : ./scripts/get-baton.sh && mv baton /usr/local/bin
258-
259- - name : Grant enterprise role first time
260- run : |
261- ./baton-slack --grant-entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" \
262- --grant-principal="${{ env.CONNECTOR_PRINCIPAL }}" \
263- --grant-principal-type="${{ env.CONNECTOR_PRINCIPAL_TYPE }}"
264-
265- - name : Check for enterprise role grant before revoking
266- run : |
267- ./baton-slack && \
268- baton grants --entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --output-format=json | \
269- jq --exit-status ".grants[].principal.id.resource == \"${{ env.CONNECTOR_PRINCIPAL }}\"" | grep -q "true"
270-
271- - name : Revoke enterprise role grant
272- run : ./baton-slack --revoke-grant="${{ env.CONNECTOR_GRANT }}"
273-
274- - name : Check enterprise role grant was revoked
275- run : |
276- ./baton-slack && \
277- baton grants --entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --output-format=json | \
278- jq --exit-status "if .grants then .grants[]?.principal.id.resource != \"${{ env.CONNECTOR_PRINCIPAL }}\" else . end"
279-
280- - name : Grant enterprise role second time
281- run : |
282- ./baton-slack --grant-entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" \
283- --grant-principal="${{ env.CONNECTOR_PRINCIPAL }}" \
284- --grant-principal-type="${{ env.CONNECTOR_PRINCIPAL_TYPE }}"
285-
286- - name : Check enterprise role was re-granted
287- run : |
288- ./baton-slack && \
289- baton grants --entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --output-format=json | \
290- jq --exit-status ".grants[].principal.id.resource == \"${{ env.CONNECTOR_PRINCIPAL }}\"" | grep -q "true"
291-
292-
135+ - name : Grant/revoke entitlement
136+ uses : ConductorOne/github-workflows/actions/sync-test@v2
137+ with :
138+ connector : ./baton-slack
139+ baton-entitlement : " enterpriseRole:Rl0K:assigned"
140+ baton-principal : " U083SJ36LCD"
141+ baton-principal-type : " user"
0 commit comments