antos-appimage/Jenkinsfile
dany b77980eebe
Some checks failed
gitea-sync/antos-appimage/pipeline/head There was a failure building this commit
Update 'Jenkinsfile'
2022-09-29 23:13:25 +02:00

118 lines
4.0 KiB
Groovy

// need to approve all static functions in Dashboard > Manage Jenkins > ScriptApproval
def parallelStagesMap = jenkins.model.Jenkins.instance.getItemByFullName('gitea-sync/antos').getAllJobs().collectEntries {
["${it}" : generateStage(it.getName())]
}
def generateStage(name) {
return {
stage("stage: ANTOS ${name}") {
copyArtifacts(projectName: 'gitea-sync/antos/' + name, target: 'build/frontend/' + name);
}
}
}
def copyArtifactsByBranches(projectName){
def jobs = jenkins.model.Jenkins.instance.getItemByFullName('gitea-sync/antos').getAllJobs();
Iterator<?> iterator = jobs.iterator();
while (iterator.hasNext()) {
def job = iterator.next();
step([$class: 'CopyArtifact',
projectName: 'gitea-sync/antos/' + job.getName(),
target: 'build/frontend/' + job.getName()
]);
//copyArtifacts(projectName: 'gitea-sync/antos/' + job.getName(), target: 'build/frontend/' + job.getName());
}
return null;
}
pipeline{
agent { node{ label'workstation' }}
options {
// Limit build history with buildDiscarder option:
// daysToKeepStr: history is only kept up to this many days.
// numToKeepStr: only this many build logs are kept.
// artifactDaysToKeepStr: artifacts are only kept up to this many days.
// artifactNumToKeepStr: only this many builds have their artifacts kept.
buildDiscarder(logRotator(numToKeepStr: "1"))
// Enable timestamps in build log console
timestamps()
// Maximum time to run the whole pipeline before canceling it
timeout(time: 3, unit: 'HOURS')
// Use Jenkins ANSI Color Plugin for log console
ansiColor('xterm')
// Limit build concurrency to 1 per branch
disableConcurrentBuilds()
}
stages
{
stage('Prepare binaries') {
steps {
sh'''
[ -d build ] && rm -rf build
mkdir -p build/frontend
mkdir -p build/backend
'''
copyArtifacts(projectName: 'gitea-sync/ant-http/master', target: 'build/backend');
copyArtifacts(projectName: 'gitea-sync/antd-lua-plugin/master', target: 'build/backend');
copyArtifacts(projectName: 'gitea-sync/antd-tunnel-plugin/master', target: 'build/backend');
copyArtifacts(projectName: 'gitea-sync/antd-wvnc-plugin/master', target: 'build/backend');
copyArtifacts(projectName: 'gitea-sync/antd-tunnel-publishers/master', target: 'build/backend');
copyArtifacts(projectName: 'luasocket', target: 'build/backend');
copyArtifacts(projectName: 'luasec', target: 'build/backend');
script
{
parallel(parallelStagesMap);
}
//copyArtifacts(projectName: 'gitea-sync/antos/*', target: 'build/frontend');
//copyArtifacts(projectName: 'gitea-sync/antd-web-apps/master', target: 'build/backend');
sh'''
tree build
exit 1
'''
}
}
stage('Build AMD64') {
steps {
sh'''
cd $WORKSPACE
[ -d build ] || mkdir build
for file in /var/jenkins_home/workspace/nightly-antosaio/build/frontend/*; do
echo "Building for AMD64 version $tag"
./mkimg.sh amd64 $(basename $file)
done
'''
}
}
stage('Build arm64') {
steps {
sh'''
cd $WORKSPACE
[ -d build ] || mkdir build
for file in /var/jenkins_home/workspace/nightly-antosaio/build/frontend/*; do
echo "Building for arm64 version $tag"
./mkimg.sh arm64 $(basename $file)
done
'''
}
}
stage('Build arm') {
steps {
sh'''
cd $WORKSPACE
[ -d build ] || mkdir build
for file in /var/jenkins_home/workspace/nightly-antosaio/build/frontend/*; do
echo "Building for arm version $tag"
./mkimg.sh arm $(basename $file)
done
'''
}
}
stage('Archive') {
steps {
script {
archiveArtifacts artifacts: 'build/', fingerprint: true
}
}
}
}
}