mirror of
https://github.com/renovatebot/github-action.git
synced 2025-12-17 09:22:36 +00:00
chore: test user with ubuntu:docker argument
This commit is contained in:
parent
936e6436e3
commit
8fd16c9263
1 changed files with 4 additions and 14 deletions
|
|
@ -20,7 +20,9 @@ class Renovate {
|
||||||
}
|
}
|
||||||
|
|
||||||
async runDockerContainer(): Promise<void> {
|
async runDockerContainer(): Promise<void> {
|
||||||
const group = await this.getDockerGroup();
|
const renovateDockerUser = 'ubuntu';
|
||||||
|
const githubActionsDockerGroup = 'docker';
|
||||||
|
|
||||||
const commandArguments = [
|
const commandArguments = [
|
||||||
'--rm',
|
'--rm',
|
||||||
`--env ${this.configFileEnv}=${this.configFileMountPath()}`,
|
`--env ${this.configFileEnv}=${this.configFileMountPath()}`,
|
||||||
|
|
@ -28,7 +30,7 @@ class Renovate {
|
||||||
`--volume ${this.configFile}:${this.configFileMountPath()}`,
|
`--volume ${this.configFile}:${this.configFileMountPath()}`,
|
||||||
`--volume /var/run/docker.sock:/var/run/docker.sock`,
|
`--volume /var/run/docker.sock:/var/run/docker.sock`,
|
||||||
`--volume /tmp:/tmp`,
|
`--volume /tmp:/tmp`,
|
||||||
`--user 1000:${group}`,
|
`--user ${renovateDockerUser}:${githubActionsDockerGroup}`,
|
||||||
this.docker.image(),
|
this.docker.image(),
|
||||||
];
|
];
|
||||||
const command = `docker run ${commandArguments.join(' ')}`;
|
const command = `docker run ${commandArguments.join(' ')}`;
|
||||||
|
|
@ -39,18 +41,6 @@ class Renovate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Fetch the host docker group on github.
|
|
||||||
* Container user needs this to access the docker socket.
|
|
||||||
*/
|
|
||||||
private async getDockerGroup(): Promise<string> {
|
|
||||||
const groups = await fs.promises.readFile('/etc/group', {
|
|
||||||
encoding: 'utf-8',
|
|
||||||
});
|
|
||||||
const [, group] = /^docker:x:([1-9][0-9]*):$/m.exec(groups);
|
|
||||||
return group;
|
|
||||||
}
|
|
||||||
|
|
||||||
private validateArguments(): void {
|
private validateArguments(): void {
|
||||||
if (!fs.existsSync(this.configFile)) {
|
if (!fs.existsSync(this.configFile)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue