1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-15 15:03:07 +01:00

ensure to load buildconfig from selected git sha

This commit is contained in:
andreas
2023-10-05 19:37:46 +02:00
parent 12288edbf8
commit 4af9434b29
4 changed files with 28 additions and 8 deletions

View File

@@ -226,7 +226,10 @@ import fileDownload from "https://cdn.skypack.dev/js-file-download@0.4.12"
downloadConfig: downloadConfig
};
const loadConfig=async (url)=>{
let config=await fetch(url).then((r)=>r.text());
let config=await fetch(url).then((r)=>{
if (!r.ok) throw new Error("unable to fetch: "+r.statusText);
return r.text()
});
let parsed=yamlLoad(config);
return parsed;
}
@@ -423,9 +426,6 @@ import fileDownload from "https://cdn.skypack.dev/js-file-download@0.4.12"
fetchStatus(true);
setRunning(true);
}
structure=await loadConfig("build.yaml");
buildSelectors(ROOT_PATH,structure.config.children,true);
if (! running) findPipeline();
let gitParam={user:GITUSER,repo:GITREPO};
let branch=getParam('branch');
if (branch){
@@ -479,6 +479,19 @@ import fileDownload from "https://cdn.skypack.dev/js-file-download@0.4.12"
else{
setValue('gitSha',gitSha);
}
if (gitSha !== undefined){
let url=buildUrl(GITAPI,Object.assign({},gitParam,{sha:gitSha,proxy:'webinstall/build.yaml'}));
try{
structure=await loadConfig(url);
}catch (e){
alert("unable to load config for selected release:\n "+e+"\n falling back to default");
}
}
if (! structure){
structure=await loadConfig("build.yaml");
}
buildSelectors(ROOT_PATH,structure.config.children,true);
if (! running) findPipeline();
updateStart();
}
})();