ensure to load buildconfig from selected git sha
This commit is contained in:
parent
12288edbf8
commit
4af9434b29
|
@ -226,7 +226,10 @@ import fileDownload from "https://cdn.skypack.dev/js-file-download@0.4.12"
|
||||||
downloadConfig: downloadConfig
|
downloadConfig: downloadConfig
|
||||||
};
|
};
|
||||||
const loadConfig=async (url)=>{
|
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);
|
let parsed=yamlLoad(config);
|
||||||
return parsed;
|
return parsed;
|
||||||
}
|
}
|
||||||
|
@ -423,9 +426,6 @@ import fileDownload from "https://cdn.skypack.dev/js-file-download@0.4.12"
|
||||||
fetchStatus(true);
|
fetchStatus(true);
|
||||||
setRunning(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 gitParam={user:GITUSER,repo:GITREPO};
|
||||||
let branch=getParam('branch');
|
let branch=getParam('branch');
|
||||||
if (branch){
|
if (branch){
|
||||||
|
@ -479,6 +479,19 @@ import fileDownload from "https://cdn.skypack.dev/js-file-download@0.4.12"
|
||||||
else{
|
else{
|
||||||
setValue('gitSha',gitSha);
|
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();
|
updateStart();
|
||||||
}
|
}
|
||||||
})();
|
})();
|
|
@ -15,12 +15,12 @@ function fillUserAndRepo($vars=null,$source=null){
|
||||||
}
|
}
|
||||||
foreach (array('user','repo') as $n){
|
foreach (array('user','repo') as $n){
|
||||||
if (! isset($source[$n])){
|
if (! isset($source[$n])){
|
||||||
die("missing parameter $n");
|
throw new Exception("missing parameter $n");
|
||||||
}
|
}
|
||||||
$v=$source[$n];
|
$v=$source[$n];
|
||||||
$av=$allowed[$n];
|
$av=$allowed[$n];
|
||||||
if (! in_array($v,$av)){
|
if (! in_array($v,$av)){
|
||||||
die("value $v for $n not allowed");
|
throw new Exception("value $v for $n not allowed");
|
||||||
}
|
}
|
||||||
$vars[$n]=$v;
|
$vars[$n]=$v;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ function addVars(&$vars,$names,$defaults=null){
|
||||||
foreach ($names as $n){
|
foreach ($names as $n){
|
||||||
$v=null;
|
$v=null;
|
||||||
if (! isset($_REQUEST[$n])){
|
if (! isset($_REQUEST[$n])){
|
||||||
if ($defaults == null || ! isset($defaults[$n])) die("missing parameter $n");
|
if ($defaults == null || ! isset($defaults[$n])) throw new Exception("missing parameter $n");
|
||||||
$v=$defaults[$n];
|
$v=$defaults[$n];
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
|
@ -7,6 +7,7 @@ $branchsha=API_BASE."/git/refs/heads/#branch#";
|
||||||
$tagsha=API_BASE."/git/refs/tags/#tag#";
|
$tagsha=API_BASE."/git/refs/tags/#tag#";
|
||||||
$download = "https://github.com/#user#/#repo#/releases/download/#dlVersion#/#dlName#";
|
$download = "https://github.com/#user#/#repo#/releases/download/#dlVersion#/#dlName#";
|
||||||
$manifest = "?dlName=#mName#&dlVersion=#mVersion#&user=#user#&repo=#repo#";
|
$manifest = "?dlName=#mName#&dlVersion=#mVersion#&user=#user#&repo=#repo#";
|
||||||
|
$proxurl="https://raw.githubusercontent.com/#user#/#repo#/#sha#/#proxy#";
|
||||||
try {
|
try {
|
||||||
if (isset($_REQUEST['api'])) {
|
if (isset($_REQUEST['api'])) {
|
||||||
$vars = fillUserAndRepo();
|
$vars = fillUserAndRepo();
|
||||||
|
@ -50,11 +51,17 @@ try {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$targetUrl)
|
if (!$targetUrl)
|
||||||
die("unable to find $targetBase $mode\n");
|
throw new Exception("unable to find $targetBase $mode\n");
|
||||||
#echo("download for $targetBase=$targetUrl\n");
|
#echo("download for $targetBase=$targetUrl\n");
|
||||||
proxy($targetUrl);
|
proxy($targetUrl);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
if (isset($_REQUEST['proxy'])){
|
||||||
|
$vars = fillUserAndRepo();
|
||||||
|
$vars = addVars($vars, array('sha', 'proxy'));
|
||||||
|
proxy(replaceVars($proxurl, $vars));
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
} catch (HTTPErrorException $h) {
|
} catch (HTTPErrorException $h) {
|
||||||
header($_SERVER['SERVER_PROTOCOL'] . " " . $h->code . " " . $h->getMessage());
|
header($_SERVER['SERVER_PROTOCOL'] . " " . $h->code . " " . $h->getMessage());
|
||||||
die($h->getMessage());
|
die($h->getMessage());
|
||||||
|
|
Loading…
Reference in New Issue