It is an environmental information that can change so we should not expect to be always the same.
The execution of the stage running the Jest tests fails if the runner has an UID different than 1001.
The stage is defined like this:
stage ('Jest') {
agent {
dockerfile {
dir 'sources/tools/utils/nix/'
filename 'build-tools.dockerfile'
reuseNode true
args '--network none --tmpfs /tmp/jest_rt:rw,noexec,nosuid'
}
}
steps { script { actions.runJestTests('Tuleap', '.') } }
post {
always { junit 'results/jest/test-*-results.xml' }
}
}
The stage creates the cache directory /tmp/jest_rt
for Jest by marking it as tmpfs when launching the container.
What's interesting here is that the cache directory path is not hard-coded on the Jest side but is generated from <os_tmpdir>/jest_<Base 36 of UID>
:
const getCacheDirectory: () => Config.Path = () => {
const {getuid} = process;
const tmpdirPath = path.join(tryRealpath(tmpdir()), 'jest');
if (getuid == null) {
return tmpdirPath;
} else {
// On some platforms tmpdir() is `/tmp`, causing conflicts between different
// users and permission issues. Adding an additional subdivision by UID can
// help.
return `${tmpdirPath}_${getuid.call(process).toString(36)}`;
}
};
https://github.com/facebook/jest/blob/v26.6.3/packages/jest-config/src/getCacheDirectory.ts#L22
This makes sense when you are running Jest on a multi-user machine but in our situation it is the only process of our container.