diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a023fab..35222a2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,23 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [35.0.0](https://github.com/renovatebot/github-action/compare/v34.159.2...v35.0.0) (2023-03-10) + + +### ⚠ BREAKING CHANGES + +* **deps:** update renovate/renovate docker tag to v35 (#702) +* remove docker socket and change to current user (#700) + +### Features + +* remove docker socket and change to current user ([#700](https://github.com/renovatebot/github-action/issues/700)) ([827e518](https://github.com/renovatebot/github-action/commit/827e51874a2f7544d608b0bd2f70df46ec1bb2d3)) + + +### Bug Fixes + +* **deps:** update renovate/renovate docker tag to v35 ([#702](https://github.com/renovatebot/github-action/issues/702)) ([fedfacb](https://github.com/renovatebot/github-action/commit/fedfacb882fd7868a046812a437c6175928bcfd3)) + ### [34.159.2](https://github.com/renovatebot/github-action/compare/v34.159.1...v34.159.2) (2023-03-09) diff --git a/dist/index.js b/dist/index.js index 9d6874b6..755c979e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -3962,7 +3962,7 @@ exports["default"] = _default; Object.defineProperty(exports, "__esModule", ({ value: true })); // renovate: datasource=docker depName=renovate/renovate versioning=docker -const tag = '34.159.2-slim'; +const tag = '35.0.0-slim'; class Docker { constructor(input) { this.fullTag = input.useSlim() ? tag : tag.replace(Docker.tagSuffix, ''); @@ -4147,17 +4147,16 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); const docker_1 = __importDefault(__nccwpck_require__(512)); const exec_1 = __nccwpck_require__(514); const fs_1 = __importDefault(__nccwpck_require__(147)); +const os_1 = __importDefault(__nccwpck_require__(37)); const path_1 = __importDefault(__nccwpck_require__(17)); class Renovate { constructor(input) { this.input = input; - this.dockerGroupName = 'docker'; this.configFileMountDir = '/github-action'; this.validateArguments(); this.docker = new docker_1.default(input); } async runDockerContainer() { - const renovateDockerUser = '1000'; const dockerArguments = this.input .toEnvironmentVariables() .map((e) => `--env ${e.key}`) @@ -4167,37 +4166,14 @@ class Renovate { const mountPath = path_1.default.join(this.configFileMountDir, baseName); dockerArguments.push(`--env ${this.input.configurationFile().key}=${mountPath}`, `--volume ${this.input.configurationFile().value}:${mountPath}`); } - dockerArguments.push('--volume /var/run/docker.sock:/var/run/docker.sock', '--volume /tmp:/tmp', `--user ${renovateDockerUser}:${this.getDockerGroupId()}`, '--rm', this.docker.image()); + const user = os_1.default.userInfo(); + dockerArguments.push('--volume /tmp:/tmp', `--user ${user.uid}:0`, '--rm', this.docker.image()); const command = `docker run ${dockerArguments.join(' ')}`; const code = await (0, exec_1.exec)(command); if (code !== 0) { new Error(`'docker run' failed with exit code ${code}.`); } } - /** - * Fetch the host docker group of the GitHub Action runner. - * - * The Renovate container needs access to this group in order to have the - * required permissions on the Docker socket. - */ - getDockerGroupId() { - const groupFile = '/etc/group'; - const groups = fs_1.default.readFileSync(groupFile, { - encoding: 'utf-8', - }); - /** - * The group file has `groupname:group-password:GID:username-list` as - * structure and we're interested in the `GID` (the group ID). - * - * Source: https://www.thegeekdiary.com/etcgroup-file-explained/ - */ - const re = new RegExp(`^${this.dockerGroupName}:x:([1-9][0-9]*):`, 'm'); - const match = re.exec(groups); - if (!match || match.length < 2) { - throw new Error(`Could not find group '${this.dockerGroupName}' in ${groupFile}`); - } - return match[1]; - } validateArguments() { if (/\s/.test(this.input.token.value)) { throw new Error('Token MUST NOT contain whitespace'); diff --git a/package.json b/package.json index f7512ec9..2656dfcf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "github-action", - "version": "34.159.2", + "version": "35.0.0", "description": "GitHub Action to run Renovate self-hosted.", "private": true, "main": "src/index.ts",