This commit is contained in:
Maarten Groeneweg 2025-12-15 11:08:13 +00:00 committed by GitHub
commit ee0a62b8dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 27 additions and 1 deletions

View file

@ -73,7 +73,7 @@ Specify a command to run when the image start.
By default the image run By default the image run
`renovate`. `renovate`.
This option is useful to customize the image before running `renovate`. This option is useful to customize the image before running `renovate`.
It must be an existing executable file on the local system. It must be an existing file on the local system and it must have execute permission.
It will be mounted to the docker container. It will be mounted to the docker container.
For example you can create a simple script like this one (let's call it For example you can create a simple script like this one (let's call it

View file

@ -114,7 +114,11 @@ export class Renovate {
if (/\s/.test(this.input.token.value)) { if (/\s/.test(this.input.token.value)) {
throw new Error('Token MUST NOT contain whitespace'); throw new Error('Token MUST NOT contain whitespace');
} }
await this.validateConfigFileArgument();
await this.validateDockerCmdFileArgument();
}
private async validateConfigFileArgument(): Promise<void> {
const configurationFile = this.input.configurationFile(); const configurationFile = this.input.configurationFile();
if ( if (
configurationFile !== null && configurationFile !== null &&
@ -125,4 +129,26 @@ export class Renovate {
); );
} }
} }
private async validateDockerCmdFileArgument(): Promise<void> {
const dockerCmdFile = this.input.getDockerCmdFile();
if (dockerCmdFile === null) return;
try {
const s = await fs.stat(dockerCmdFile);
if (!s.isFile)
throw new Error(`dockerCmdFile '${dockerCmdFile}' MUST be a file`);
if (
(s.mode & fs.constants.R_OK) === 0 ||
(s.mode & fs.constants.X_OK) === 0
)
throw new Error(
`dockerCmdFile '${dockerCmdFile}' MUST have read and execute rights`,
);
} catch (err) {
if (err instanceof Error && 'code' in err && err.code === 'ENOENT')
throw new Error(`dockerCmdFile '${dockerCmdFile}' does not exist`);
throw new Error(err as string);
}
}
} }