mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #17104 from dannon/fix-build-hash-backport
[23.1] Ensure that plugin build hash actually has a git hash to compare with…
This commit is contained in:
+17
-13
@@ -121,21 +121,25 @@ function buildPlugins(callback, forceRebuild) {
|
||||
skipBuild = false;
|
||||
} else {
|
||||
if (fs.existsSync(hashFilePath)) {
|
||||
skipBuild =
|
||||
child_process.spawnSync(
|
||||
"git",
|
||||
["diff", "--quiet", `$(cat ${hashFilePath})`, "--", pluginDir],
|
||||
{
|
||||
const hashFileContent = fs.readFileSync(hashFilePath, "utf8").trim();
|
||||
const isHash = /^[0-9a-f]{7,40}$/.test(hashFileContent); // Check for a 7 to 40 character hexadecimal string
|
||||
|
||||
if (!isHash) {
|
||||
console.log(`Hash file for ${pluginName} exists but does not have a valid git hash.`);
|
||||
skipBuild = false;
|
||||
} else {
|
||||
skipBuild =
|
||||
child_process.spawnSync("git", ["diff", "--quiet", hashFileContent, "--", pluginDir], {
|
||||
stdio: "inherit",
|
||||
shell: true,
|
||||
}
|
||||
).status === 0;
|
||||
if (!skipBuild) {
|
||||
// Hash exists and is outdated, triggering a rebuild.
|
||||
// Stage current hash to .orig for debugging and to
|
||||
// force a plugin rebuild in the event of a failure
|
||||
// (i.e. -- we're committed to a new build of this plugin).
|
||||
fs.renameSync(hashFilePath, `${hashFilePath}.orig`);
|
||||
}).status === 0;
|
||||
if (!skipBuild) {
|
||||
// Hash exists and is outdated, triggering a rebuild.
|
||||
// Stage current hash to .orig for debugging and to
|
||||
// force a plugin rebuild in the event of a failure
|
||||
// (i.e. -- we're committed to a new build of this plugin).
|
||||
fs.renameSync(hashFilePath, `${hashFilePath}.orig`);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log(`No build hashfile detected for ${pluginName}, generating now.`);
|
||||
|
||||
Reference in New Issue
Block a user