[Bazel] More resilient Workspace Status (#93244)

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
This commit is contained in:
Tyler Smalley 2021-03-02 09:30:03 -08:00 committed by GitHub
parent b2b16d6aaf
commit 5521fe400f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -43,17 +43,14 @@
// Commit SHA
const commitSHACmdResult = await runCmd('git', ['rev-parse', 'HEAD']);
if (commitSHACmdResult.exitCode !== 0) {
process.exit(1);
}
if (commitSHACmdResult.exitCode === 0) {
console.log(`COMMIT_SHA ${commitSHACmdResult.stdout}`);
// Git branch
// Branch
const gitBranchCmdResult = await runCmd('git', ['rev-parse', '--abbrev-ref', 'HEAD']);
if (gitBranchCmdResult.exitCode !== 0) {
process.exit(1);
}
if (gitBranchCmdResult.exitCode === 0) {
console.log(`GIT_BRANCH ${gitBranchCmdResult.stdout}`);
}
// Tree status
const treeStatusCmdResult = await runCmd('git', ['diff-index', '--quiet', 'HEAD', '--']);
@ -63,6 +60,7 @@
} else {
console.log(`${treeStatusVarStr} Modified`);
}
}
// Host
if (process.env.CI) {
@ -72,9 +70,8 @@
return !cpu.model.includes('Intel') || index % 2 === 1;
}).length;
if (hostCmdResult.exitCode !== 0) {
process.exit(1);
}
if (hostCmdResult.exitCode === 0) {
console.log(`HOST ${hostStr}-${coresStr}`);
}
}
})();