-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.drone.yml
206 lines (188 loc) · 7.28 KB
/
.drone.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
---
kind: pipeline
name: default
type: docker
steps:
- name: postgres
image: postgres:10.1-alpine
detach: true
environment:
POSTGRES_DB: kong
POSTGRES_USER: kong
- name: cassandra
image: cassandra:3.11
detach: true
environment:
CASSANDRA_CLUSTER_NAME: kong
CASSANDRA_DC: DC1
CASSANDRA_RACK: RACK1
CASSANDRA_ENDPOINT_SNITCH: GossipingPropertyFileSnitch
- name: wait postgres
image: postgres:10.1-alpine
commands:
- until
psql -h postgres -U kong -d kong -c "select 1";
do
sleep 1;
done
- name: wait cassandra
image: cassandra:3.11
commands:
- until cqlsh cassandra; do sleep 1; done
- name: migrate
image: kong:2.0.1-alpine
environment:
KONG_PG_HOST: postgres
KONG_PG_DATABASE: kong
KONG_CASSANDRA_CONTACT_POINTS: cassandra
KONG_CASSANDRA_DATA_CENTERS: DC1:1
KONG_CASSANDRA_REPL_STRATEGY: NetworkTopologyStrategy
KONG_CASSANDRA_LOCAL_DATACENTER: DC1
commands:
- KONG_DATABASE=postgres kong migrations bootstrap
- KONG_DATABASE=cassandra kong migrations bootstrap
- name: hydra
image: oryd/hydra:v1.3.2-alpine
detach: true
environment:
URLS_SELF_ISSUER: https://hydra.tld/
URLS_CONSENT: http://notexist.tld/consent
URLS_LOGIN: http://notexist.tld/login
URLS_LOGOUT: http://notexist.tld/logout
DSN: memory
SECRETS_SYSTEM: youReallyNeedToChangeThis
commands:
- hydra serve all --dangerous-force-http
- name: hydra_jwt
image: oryd/hydra:v1.3.2-alpine
detach: true
environment:
URLS_SELF_ISSUER: https://hydra-jwt.tld/
URLS_CONSENT: http://notexist.tld/consent
URLS_LOGIN: http://notexist.tld/login
URLS_LOGOUT: http://notexist.tld/logout
DSN: memory
SECRETS_SYSTEM: youReallyNeedToChangeThis
STRATEGIES_ACCESS_TOKEN: jwt
commands:
- hydra serve all --dangerous-force-http
- name: hydra.tld
image: abiosoft/caddy:0.11.1
detach: true
commands:
- caddy -port 443 'tls self_signed' 'proxy / hydra:4444'
- name: alias.hydra.tld
image: abiosoft/caddy:0.11.1
detach: true
commands:
- caddy -port 443 'tls self_signed' 'proxy / hydra:4444'
- name: admin.hydra.tld
image: abiosoft/caddy:0.11.1
detach: true
commands:
- caddy -port 443 'tls self_signed' 'proxy / hydra:4445'
- name: hydra-jwt.tld
image: abiosoft/caddy:0.11.1
detach: true
commands:
- caddy -port 443 'tls self_signed' 'proxy / hydra_jwt:4444'
- name: alias.hydra-jwt.tld
image: abiosoft/caddy:0.11.1
detach: true
commands:
- caddy -port 443 'tls self_signed' 'proxy / hydra_jwt:4444'
- name: admin.hydra-jwt.tld
image: abiosoft/caddy:0.11.1
detach: true
commands:
- caddy -port 443 'tls self_signed' 'proxy / hydra_jwt:4445'
- name: create oauth2 client
image: appropriate/curl
environment:
CONTENT_TYPE: "content-type: application/json"
CLIENT:
'{
"client_name": "client",
"client_id": "client",
"client_secret": "client",
"scope": "openid profile admin phone email address unrequired",
"grant_types": [ "authorization_code", "refresh_token", "client_credentials", "implicit" ],
"response_types": [ "token", "code", "id_token" ],
"redirect_uris": ["https://notexist.tld/callback"],
"audience": ["client", "apim:client", "https://some-api.tld/some-resource", "unregistered", "registered-for-another-issuer", "registered-by-another-client"]
}'
CLIENT_JWT:
'{
"client_name": "client",
"client_id": "client",
"client_secret": "client",
"scope": "openid profile admin phone email address unrequired",
"grant_types": [ "authorization_code", "refresh_token", "client_credentials", "implicit" ],
"response_types": [ "token", "code", "id_token" ],
"redirect_uris": ["https://notexist.tld/callback"],
"audience": ["client-jwt", "apim:client-jwt", "https://some-api.tld/some-resource", "unregistered", "registered-for-another-issuer", "registered-by-another-client"]
}'
commands:
- export url="https://admin.hydra.tld"
- until curl -sfk $$url/clients > /dev/zero; do sleep 1; done
- curl -sfk -X POST -H "$$CONTENT_TYPE" "$$url/clients" -d "$$CLIENT" ||
curl -sfk -X PUT -H "$$CONTENT_TYPE" "$$url/clients/client" -d "$$CLIENT"
- export url="https://admin.hydra-jwt.tld"
- until curl -sfk $$url/clients > /dev/zero; do sleep 1; done
- curl -sfk -X POST -H "$$CONTENT_TYPE" "$$url/clients" -d "$$CLIENT_JWT" ||
curl -sfk -X PUT -H "$$CONTENT_TYPE" "$$url/clients/client" -d "$$CLIENT_JWT"
- name: test
image: rucciva/kong-dev-onbuild:2.0.1
pull: "always"
environment:
SPEC_KONG_PG_HOST: postgres
SPEC_KONG_PG_DATABASE: kong
SPEC_KONG_CASSANDRA_CONTACT_POINTS: cassandra
SPEC_KONG_CASSANDRA_DATA_CENTERS: DC1:1
SPEC_KONG_CASSANDRA_REPL_STRATEGY: NetworkTopologyStrategy
SPEC_KONG_CASSANDRA_LOCAL_DATACENTER: DC1
SPEC_KONG_LOG_LEVEL: info
SPEC_KONG_DNS_RESOLVER: " "
SPEC_KONG_PROXY_ACCESS_LOG: /proc/1/fd/1
SPEC_KONG_PROXY_ERROR_LOG: /proc/1/fd/2
SPEC_KONG_ADMIN_ACCESS_LOG: /proc/1/fd/1
SPEC_KONG_ADMIN_ERROR_LOG: /proc/1/fd/2
IDP_OPAQUE_ISSUER: https://hydra.tld/
IDP_OPAQUE_ISSUER_ALIAS: https://alias.hydra.tld/
IDP_OPAQUE_INTROSPECTION_ENDPOINT: https://admin.hydra.tld/oauth2/introspect
IDP_OPAQUE_TOKEN_ENDPOINT: https://hydra.tld/oauth2/token
IDP_OPAQUE_REVOKE_ENDPOINT: https://hydra.tld/oauth2/revoke
IDP_JWT_ISSUER: https://hydra-jwt.tld/
IDP_JWT_ISSUER_ALIAS: https://alias.hydra-jwt.tld/
IDP_JWT_INTROSPECTION_ENDPOINT: https://admin.hydra-jwt.tld/oauth2/introspect
IDP_JWT_TOKEN_ENDPOINT: https://hydra-jwt.tld/oauth2/token
IDP_JWT_REVOKE_ENDPOINT: https://hydra-jwt.tld/oauth2/revoke
IDP_KONG_AUDIENCE_PREFIX: 'apim:'
OAUTH2_CLIENT_ID: client
OAUTH2_CLIENT_SECRET: client
OAUTH2_CLIENT_AUDIENCE: client
OAUTH2_JWT_CLIENT_AUDIENCE: client-jwt
OAUTH2_CLIENT_SCOPE: openid profile admin phone email address
OAUTH2_CLIENT_AUDIENCE_EXISTING: https://some-api.tld/some-resource
OAUTH2_CLIENT_AUDIENCE_UNREGISTED: unregistered
OAUTH2_CLIENT_AUDIENCE_INVALID_ISS: registered-for-another-issuer
OAUTH2_CLIENT_AUDIENCE_INVALID_CLIENT_ID: registered-by-another-client
OAUTH2_CLIENT_SCOPE_UNREQUIRED: unrequired
commands:
- /entrypoint.sh echo
- cat /usr/local/src/kong/spec/kong_tests.conf
- ln -s $$DRONE_WORKSPACE/kong/plugins/oauth2-audience /usr/local/src/kong/kong/plugins/oauth2-audience
- ln -s $$DRONE_WORKSPACE/spec/oauth2-audience /usr/local/src/kong/spec/oauth2-audience
- luarocks make
- cd /usr/local/src/kong/ && bin/busted -v spec/oauth2-audience
- name: publish rock
image: rucciva/kong:2.0.1-alpine
environment:
LUAROCKS_API_KEY:
from_secret: LUAROCKS_API_KEY
commands:
- luarocks upload *.rockspec --api-key="$LUAROCKS_API_KEY"
when:
event:
- tag
...