[Bazel] More resilient Workspace Status (#93244)
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
This commit is contained in:
parent
b2b16d6aaf
commit
5521fe400f
1 changed files with 17 additions and 20 deletions
|
@ -43,17 +43,14 @@
|
||||||
|
|
||||||
// Commit SHA
|
// Commit SHA
|
||||||
const commitSHACmdResult = await runCmd('git', ['rev-parse', 'HEAD']);
|
const commitSHACmdResult = await runCmd('git', ['rev-parse', 'HEAD']);
|
||||||
if (commitSHACmdResult.exitCode !== 0) {
|
if (commitSHACmdResult.exitCode === 0) {
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
console.log(`COMMIT_SHA ${commitSHACmdResult.stdout}`);
|
console.log(`COMMIT_SHA ${commitSHACmdResult.stdout}`);
|
||||||
|
|
||||||
// Git branch
|
// Branch
|
||||||
const gitBranchCmdResult = await runCmd('git', ['rev-parse', '--abbrev-ref', 'HEAD']);
|
const gitBranchCmdResult = await runCmd('git', ['rev-parse', '--abbrev-ref', 'HEAD']);
|
||||||
if (gitBranchCmdResult.exitCode !== 0) {
|
if (gitBranchCmdResult.exitCode === 0) {
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
console.log(`GIT_BRANCH ${gitBranchCmdResult.stdout}`);
|
console.log(`GIT_BRANCH ${gitBranchCmdResult.stdout}`);
|
||||||
|
}
|
||||||
|
|
||||||
// Tree status
|
// Tree status
|
||||||
const treeStatusCmdResult = await runCmd('git', ['diff-index', '--quiet', 'HEAD', '--']);
|
const treeStatusCmdResult = await runCmd('git', ['diff-index', '--quiet', 'HEAD', '--']);
|
||||||
|
@ -63,6 +60,7 @@
|
||||||
} else {
|
} else {
|
||||||
console.log(`${treeStatusVarStr} Modified`);
|
console.log(`${treeStatusVarStr} Modified`);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Host
|
// Host
|
||||||
if (process.env.CI) {
|
if (process.env.CI) {
|
||||||
|
@ -72,9 +70,8 @@
|
||||||
return !cpu.model.includes('Intel') || index % 2 === 1;
|
return !cpu.model.includes('Intel') || index % 2 === 1;
|
||||||
}).length;
|
}).length;
|
||||||
|
|
||||||
if (hostCmdResult.exitCode !== 0) {
|
if (hostCmdResult.exitCode === 0) {
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
console.log(`HOST ${hostStr}-${coresStr}`);
|
console.log(`HOST ${hostStr}-${coresStr}`);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Reference in a new issue