Skip to content

Commit 1b3b0a8

Browse files
mads-hartmannroboquat
authored andcommitted
Use werft.fail to report error
1 parent afe5b57 commit 1b3b0a8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

.werft/util/certs.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,26 @@ export class InstallCertificateParams {
2626
destinationKubeconfig: string
2727
}
2828

29-
export async function issueCertificate(werft, params: IssueCertificateParams, shellOpts: ExecOptions) {
29+
export async function issueCertificate(werft: Werft, params: IssueCertificateParams, shellOpts: ExecOptions) {
3030
var subdomains = [];
3131
werft.log(shellOpts.slice, `Subdomains: ${params.additionalSubdomains}`)
3232
for (const sd of params.additionalSubdomains) {
3333
subdomains.push(sd);
3434
}
3535

3636
exec(`echo "Domain: ${params.domain}, Subdomains: ${subdomains}"`, {slice: shellOpts.slice})
37-
validateSubdomains(params.domain, subdomains)
37+
validateSubdomains(werft, shellOpts.slice, params.domain, subdomains)
3838
createCertificateResource(werft, shellOpts, params, subdomains)
3939
}
4040

41-
function validateSubdomains(domain: string, subdomains: string[]): void {
41+
function validateSubdomains(werft: Werft, slice: string, domain: string, subdomains: string[]): void {
4242
// sanity: check if there is a "SAN short enough to fit into CN (63 characters max)"
4343
// source: https://community.letsencrypt.org/t/certbot-errors-with-obtaining-a-new-certificate-an-unexpected-error-occurred-the-csr-is-unacceptable-e-g-due-to-a-short-key-error-finalizing-order-issuing-precertificate-csr-doesnt-contain-a-san-short-enough-to-fit-in-cn/105513/2
4444
if (!subdomains.some(sd => {
4545
const san = sd + domain;
4646
return san.length <= 63;
4747
})) {
48-
throw new Error(`there is no subdomain + '${domain}' shorter or equal to 63 characters, max. allowed length for CN. No HTTPS certs for you! Consider using a short branch name...`);
48+
werft.fail(slice, `there is no subdomain + '${domain}' shorter or equal to 63 characters, max. allowed length for CN. No HTTPS certs for you! Consider using a short branch name...`)
4949
}
5050
}
5151

0 commit comments

Comments
 (0)