Skip to content

Commit 5c8749c

Browse files
authored
refactor: remove hacky workaround for hiding FF_DISABLE_UMASK_FOR_DOCKER_EXECUTOR (#1382)
1 parent b3434b5 commit 5c8749c

2 files changed

Lines changed: 6 additions & 12 deletions

File tree

src/job.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,6 @@ export class Job {
151151
this.rules = jobData.rules || null;
152152
this.environment = typeof jobData.environment === "string" ? {name: jobData.environment} : jobData.environment;
153153

154-
// HACK: So that this won't show up in the preview variables
155-
if (! argv.preview) {
156-
globalVariables["FF_DISABLE_UMASK_FOR_DOCKER_EXECUTOR"] = argv.umask ? "false" : "true";
157-
}
158-
159154
const matrixVariables = opt.matrixVariables ?? {};
160155
const fileVariables = Utils.findEnvMatchedVariables(variablesFromFiles, this.fileVariablesDir);
161156
this._variables = {...globalVariables, ...jobVariables, ...matrixVariables, ...predefinedVariables, ...fileVariables, ...argvVariables};
@@ -494,7 +489,7 @@ export class Job {
494489

495490
let chownOpt = "0:0";
496491
let chmodOpt = "a+rw";
497-
if (expanded["FF_DISABLE_UMASK_FOR_DOCKER_EXECUTOR"] === "true") {
492+
if (this.argv.umask === false) {
498493
const {stdout} = await Utils.spawn(["docker", "run", "--rm", "--entrypoint", "sh", imageName, "-c", "echo \"$(id -u):$(id -g)\""]);
499494
chownOpt = stdout;
500495
if (chownOpt == "0:0") {
@@ -705,7 +700,7 @@ export class Job {
705700
dockerCmd += `--ulimit nofile=${this.argv.ulimit} `;
706701
}
707702

708-
if (expanded["FF_DISABLE_UMASK_FOR_DOCKER_EXECUTOR"] === "false") {
703+
if (this.argv.umask === true) {
709704
dockerCmd += "--user 0:0 ";
710705
}
711706

@@ -1204,7 +1199,7 @@ export class Job {
12041199
let dockerCmd = `${this.argv.containerExecutable} create --interactive `;
12051200
this.refreshLongRunningSilentTimeout(writeStreams);
12061201

1207-
if (expanded["FF_DISABLE_UMASK_FOR_DOCKER_EXECUTOR"] === "false") {
1202+
if (this.argv.umask === true) {
12081203
dockerCmd += "--user 0:0 ";
12091204
}
12101205

src/predefined-variables.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import camelCase from "camelcase";
22
import {GitData} from "./git-data.js";
3+
import {Argv} from "./argv.js";
34

45
type PredefinedVariablesOpts = {
56
gitData: GitData;
6-
argv: {
7-
unsetVariables: string[];
8-
variable: {[key: string]: string};
9-
};
7+
argv: Argv;
108
envMatchedVariables: {[key: string]: string};
119
};
1210

@@ -79,6 +77,7 @@ export function init ({gitData, argv, envMatchedVariables}: PredefinedVariablesO
7977
CI_PROJECT_URL: `${CI_SERVER_URL}/${gitData.remote.group}/${gitData.remote.project}`,
8078
CI_TEMPLATE_REGISTRY_HOST: "registry.gitlab.com",
8179
GITLAB_CI: "false",
80+
FF_DISABLE_UMASK_FOR_DOCKER_EXECUTOR: argv.umask ? "false" : "true",
8281
};
8382

8483
// Delete variables the user intentionally wants unset

0 commit comments

Comments
 (0)