handle build version for ci builds
This commit is contained in:
parent
1da9fea9a4
commit
10058cfeec
12
post.py
12
post.py
|
@ -63,17 +63,17 @@ def post(source,target,env):
|
|||
for f in glob.glob(os.path.join(outdir,base+"*.bin")):
|
||||
print("removing old file %s"%f)
|
||||
os.unlink(f)
|
||||
ofversion=''
|
||||
if not version.startswith('dev'):
|
||||
ofversion="-"+version
|
||||
versionedFile=os.path.join(outdir,"%s%s-update.bin"%(base,ofversion))
|
||||
shutil.copyfile(firmware,versionedFile)
|
||||
outfile=os.path.join(outdir,"%s%s-all.bin"%(base,ofversion))
|
||||
outfile=os.path.join(outdir,"%s-all.bin"%(base))
|
||||
cmd=[python,esptool,"--chip",chip,"merge_bin","--target-offset",offset,"-o",outfile]
|
||||
cmd+=uploadfiles
|
||||
cmd+=[appoffset,firmware]
|
||||
print("running %s"%" ".join(cmd))
|
||||
env.Execute(" ".join(cmd),"#testpost")
|
||||
ofversion="-"+version
|
||||
versionedFile=os.path.join(outdir,"%s%s-update.bin"%(base,ofversion))
|
||||
shutil.copyfile(firmware,versionedFile)
|
||||
versioneOutFile=os.path.join(outdir,"%s%s-all.bin"%(base,ofversion))
|
||||
shutil.copyfile(outfile,versioneOutFile)
|
||||
env.AddPostAction(
|
||||
"$BUILD_DIR/${PROGNAME}.bin",
|
||||
post
|
||||
|
|
|
@ -35,6 +35,10 @@
|
|||
width: 10em;
|
||||
opacity: 0.6;
|
||||
padding: 0;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.configui .row .value{
|
||||
padding-left: 0;
|
||||
}
|
||||
.configui .since {
|
||||
display: block;
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
<span class="label" >GitSha</span>
|
||||
<span class="value" id="gitSha">---</span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span class="label" >Version</span>
|
||||
<span class="value" id="buildVersion"></span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<button id="downloadConfig">SaveCfg</button>
|
||||
<button id="uploadConfig">LoadCfg</button>
|
||||
|
@ -27,11 +31,11 @@
|
|||
</div>
|
||||
<div class="row">
|
||||
<span class="label">Board type</span>
|
||||
<input type="text" id="environment" disabled/>
|
||||
<div class="value" id="environment" ></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span class="label">Build Flags</span>
|
||||
<input type="text" id="buildflags" disabled>
|
||||
<div class="value" id="buildflags"></div>
|
||||
</div>
|
||||
<div class="row hidden error">
|
||||
<span class="label">Error</span>
|
||||
|
|
|
@ -51,6 +51,7 @@ class PipelineInfo{
|
|||
let displayMode='last';
|
||||
let delayedSearch=undefined;
|
||||
let gitSha=undefined;
|
||||
let buildVersion=undefined;
|
||||
const modeStrings={
|
||||
last: 'Last Build',
|
||||
existing: 'Existing Build',
|
||||
|
@ -73,15 +74,20 @@ class PipelineInfo{
|
|||
setVisible('download',currentPipeline.valid() && currentPipeline.downloadUrl!==undefined,true);
|
||||
setVisible('status_url',currentPipeline.valid() && currentPipeline.status_url!==undefined,true);
|
||||
setVisible('error',currentPipeline.error!==undefined,true);
|
||||
let e=document.getElementById('configError');
|
||||
if (e.textContent) {
|
||||
let values={};
|
||||
fillValues(values,['configError','environment']);
|
||||
if (values.textContent) {
|
||||
enableEl('start',false);
|
||||
return;
|
||||
}
|
||||
if (!values.environment){
|
||||
enableEl('start',false);
|
||||
return;
|
||||
}
|
||||
if (displayMode != 'existing'){
|
||||
if (currentPipeline.valid()){
|
||||
//check pipeline state
|
||||
if (['error','success','canceled'].indexOf(currentPipeline.status) >= 0){
|
||||
if (['error','success','canceled','failed'].indexOf(currentPipeline.status) >= 0){
|
||||
enableEl('start',true);
|
||||
return;
|
||||
}
|
||||
|
@ -91,8 +97,9 @@ class PipelineInfo{
|
|||
enableEl('start',true);
|
||||
return;
|
||||
}
|
||||
//display node existing
|
||||
enableEl('start',!currentPipeline.valid());
|
||||
//display mode existing
|
||||
//allow start if either no pipeline or not running and status != success
|
||||
enableEl('start',!currentPipeline.valid() || (!currentPipeline.isRunning() && currentPipeline.status != "success"));
|
||||
}
|
||||
const isRunning=()=>{
|
||||
return currentPipeline.isRunning();
|
||||
|
@ -154,10 +161,13 @@ class PipelineInfo{
|
|||
updateStatus();
|
||||
if (gitSha !== undefined) param.tag=gitSha;
|
||||
param.config=JSON.stringify(config);
|
||||
if (buildVersion !== undefined){
|
||||
param.suffix="-"+buildVersion;
|
||||
}
|
||||
fetchJson(API,Object.assign({
|
||||
api:'start'},param))
|
||||
.then((json)=>{
|
||||
let status=json.status || 'error';
|
||||
let status=json.status || json.state|| 'error';
|
||||
if (status === 'error'){
|
||||
currentPipeline.update({status:status,error:json.error})
|
||||
updateStatus();
|
||||
|
@ -367,8 +377,10 @@ class PipelineInfo{
|
|||
}
|
||||
}
|
||||
}
|
||||
document.getElementById('environment').value=environment;
|
||||
document.getElementById('buildflags').value=flags;
|
||||
if (buildVersion !== undefined){
|
||||
flags+=" -DGWRELEASEVERSION="+buildVersion;
|
||||
}
|
||||
setValues({environment:environment,buildflags:flags});
|
||||
//check resources
|
||||
for (let k in currentResources){
|
||||
let resList=currentResources[k];
|
||||
|
@ -484,6 +496,26 @@ class PipelineInfo{
|
|||
else{
|
||||
setValue('gitSha',gitSha);
|
||||
}
|
||||
let bot=document.getElementById('branchOrTag');
|
||||
let botv=document.getElementById('branchOrTagValue');
|
||||
if (bot && botv){
|
||||
let type=bot.textContent;
|
||||
let val=botv.textContent;
|
||||
if (type && val){
|
||||
if (type != 'release' && type != 'tag'){
|
||||
val=type+val;
|
||||
}
|
||||
val=val.replace(/[:.]/g,'_');
|
||||
val=val.replace(/[^a-zA-Z0-9_]*/g,'');
|
||||
if (val.length > 32){
|
||||
val=val.substring(val.length-32)
|
||||
}
|
||||
if (val.length > 0){
|
||||
buildVersion=val;
|
||||
setValue('buildVersion',buildVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (gitSha !== undefined){
|
||||
let url=buildUrl(GITAPI,Object.assign({},gitParam,{sha:gitSha,proxy:'webinstall/build.yaml'}));
|
||||
try{
|
||||
|
|
|
@ -50,7 +50,8 @@ const fillValues=(values,items)=>{
|
|||
items.forEach((it)=>{
|
||||
let e=document.getElementById(it);
|
||||
if (e){
|
||||
values[it]=e.value; //TODO: type of el
|
||||
if (e.tagName == 'INPUT') values[it]=e.value;
|
||||
if (e.tagName == 'DIV' || e.tagName == 'SPAN') values [it]=e.textContent;
|
||||
}
|
||||
})
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue