Skip to content

Commit 6e820a3

Browse files
committed
CI stack for Authentik with ldap
1 parent a277a5d commit 6e820a3

35 files changed

+116
-172
lines changed

Jenkinsfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ pipeline {
188188
sh 'docker logs $(docker-compose ps --all -q pdns) > debug/postgres/docker_pdns.log 2>&1'
189189
sh 'docker logs $(docker-compose ps --all -q pdns-db) > debug/postgres/docker_pdns-db.log 2>&1'
190190
sh 'docker logs $(docker-compose ps --all -q dnsrouter) > debug/postgres/docker_dnsrouter.log 2>&1'
191+
sh 'docker logs $(docker-compose ps --all -q db-postgres) > debug/postgres/docker_db.log 2>&1'
192+
sh 'docker logs $(docker-compose ps --all -q authentik) > debug/postgres/docker_authentik.log 2>&1'
193+
sh 'docker logs $(docker-compose ps --all -q authentik-redis) > debug/postgres/docker_authentik-redis.log 2>&1'
194+
sh 'docker logs $(docker-compose ps --all -q authentik-ldap) > debug/postgres/docker_authentik-ldap.log 2>&1'
195+
191196
junit 'test/results/junit/*'
192197
sh 'docker-compose down --remove-orphans --volumes -t 30 || true'
193198
}
@@ -248,16 +253,16 @@ pipeline {
248253
printResult()
249254
}
250255
failure {
256+
archiveArtifacts(artifacts: 'debug/**/*', allowEmptyArchive: true)
251257
dir(path: 'test') {
252258
archiveArtifacts allowEmptyArchive: true, artifacts: 'results/**/*', excludes: '**/*.xml'
253259
}
254-
archiveArtifacts(artifacts: 'debug/*', allowEmptyArchive: true)
255260
}
256261
unstable {
262+
archiveArtifacts(artifacts: 'debug/**/*', allowEmptyArchive: true)
257263
dir(path: 'test') {
258264
archiveArtifacts allowEmptyArchive: true, artifacts: 'results/**/*', excludes: '**/*.xml'
259265
}
260-
archiveArtifacts(artifacts: 'debug/*', allowEmptyArchive: true)
261266
}
262267
}
263268
}

backend/.testcoverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ threshold:
1818
# package: 30
1919
# (optional; default 0)
2020
# The minimum total coverage project should have
21-
total: 34
21+
total: 33

backend/embed/api_docs/components/UserAuthObject.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
"type": {
2626
"type": "string",
27-
"pattern": "^password$"
27+
"pattern": "^(local|ldap|oidc)$"
2828
}
2929
}
3030
}

backend/embed/api_docs/components/UserObject.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
},
5454
"type": {
5555
"type": "string",
56-
"pattern": "^password$"
56+
"pattern": "^(local|ldap|oidc)$"
5757
}
5858
}
5959
},

backend/embed/migrations/mysql/20201013035839_initial_data.sql

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,12 @@ INSERT INTO `user` (
125125
`created_at`,
126126
`updated_at`,
127127
`name`,
128-
`nickname`,
129128
`email`,
130129
`is_system`
131130
) VALUES (
132131
ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000),
133132
ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000),
134133
"System",
135-
"System",
136134
"system@localhost",
137135
TRUE
138136
);

backend/embed/migrations/postgres/20201013035839_initial_data.sql

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,12 @@ INSERT INTO "user" (
125125
"created_at",
126126
"updated_at",
127127
"name",
128-
"nickname",
129128
"email",
130129
"is_system"
131130
) VALUES (
132131
EXTRACT(EPOCH FROM TIMESTAMP '2011-05-17 10:40:28.876944') * 1000,
133132
EXTRACT(EPOCH FROM TIMESTAMP '2011-05-17 10:40:28.876944') * 1000,
134133
'System',
135-
'System',
136134
'system@localhost',
137135
TRUE
138136
);

backend/embed/migrations/sqlite/20201013035839_initial_data.sql

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,12 @@ INSERT INTO `user` (
124124
created_at,
125125
updated_at,
126126
name,
127-
nickname,
128127
email,
129128
is_system
130129
) VALUES (
131130
unixepoch() * 1000,
132131
unixepoch() * 1000,
133132
"System",
134-
"System",
135133
"system@localhost",
136134
1
137135
);

backend/internal/entity/auth/entity_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,14 @@ func (s *testsuite) TestSave() {
9797
defer goleak.VerifyNone(s.T(), goleak.IgnoreAnyFunction("database/sql.(*DB).connectionOpener"))
9898

9999
s.mock.ExpectBegin()
100-
s.mock.ExpectQuery(regexp.QuoteMeta(`INSERT INTO "auth" ("created_at","updated_at","is_deleted","user_id","type","secret") VALUES ($1,$2,$3,$4,$5,$6) RETURNING "id"`)).
100+
s.mock.ExpectQuery(regexp.QuoteMeta(`INSERT INTO "auth" ("created_at","updated_at","is_deleted","user_id","type","identity","secret") VALUES ($1,$2,$3,$4,$5,$6,$7) RETURNING "id"`)).
101101
WithArgs(
102102
sqlmock.AnyArg(),
103103
sqlmock.AnyArg(),
104104
0,
105105
100,
106106
TypeLocal,
107+
"",
107108
"abc123",
108109
).
109110
WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow("11"))

backend/internal/entity/auth/model.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ func (m *Model) LoadByID(id int) error {
3939
// Save will save this model to the DB
4040
func (m *Model) Save() error {
4141
db := database.GetDB()
42-
// todo: touch? not sure that save does this or not?
4342
result := db.Save(m)
4443
return result.Error
4544
}

backend/internal/entity/user/entity_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ func (s *testsuite) SetupTest() {
8484
).AddRow(
8585
11,
8686
"Jane Doe",
87-
"Jane",
8887
8988
true,
9089
false,
@@ -183,7 +182,6 @@ func (s *testsuite) TestSave() {
183182
sqlmock.AnyArg(),
184183
0,
185184
"John Doe",
186-
"Jonny",
187185
188186
false,
189187
false,

0 commit comments

Comments
 (0)