优化
This commit is contained in:
@@ -15,6 +15,29 @@ const serviceDockerfile = (await readFile(new URL('../deploy/docker/Dockerfile',
|
||||
const serviceCompose = (await readFile(new URL('../deploy/docker-compose.yml', import.meta.url), 'utf8'))
|
||||
.replaceAll('\r\n', '\n')
|
||||
|
||||
test('both pipelines reject the placeholder registry from failed build 662 before Maven or Docker', () => {
|
||||
for (const source of [coordinatorPipeline, pipeline]) {
|
||||
assert.match(source, /string\(name: 'IMAGE_REPOSITORY', defaultValue: ''/)
|
||||
const guard = source.match(/(?:requestedRepository|imageRepository)\.tokenize\('\/'\)\[0\] ==~ \/\(\?i\)([^\n]+)\//)
|
||||
assert.ok(guard, 'registry host must reject reserved example domains')
|
||||
const reservedHost = new RegExp(`^(?:${guard[1]})$`, 'i')
|
||||
for (const repository of [
|
||||
'registry.example.com/team/baiyue-firstleg',
|
||||
'registry.example.com/your-group/baiyue-firstleg',
|
||||
'EXAMPLE.COM:5000/team/image',
|
||||
'registry.example.net/team/image',
|
||||
'example.org/team/image'
|
||||
]) assert.ok(reservedHost.test(repository.split('/')[0]), repository)
|
||||
for (const host of ['registry.company.com:5000', '10.0.0.10:10082', 'example.company.com']) {
|
||||
assert.equal(reservedHost.test(host), false, host)
|
||||
}
|
||||
const mavenStage = source.match(/stage\('[^']*Maven[^']*'\)/)
|
||||
assert.ok(mavenStage)
|
||||
assert.ok(source.indexOf(guard[0]) < mavenStage.index,
|
||||
'invalid registry must fail before expensive Java builds')
|
||||
}
|
||||
})
|
||||
|
||||
test('service pipeline keeps boolean operators on parseable Groovy continuation lines', () => {
|
||||
assert.doesNotMatch(pipeline, /^\s*(?:&&|\|\|)/m)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user