Add jenkinfiles
Some checks failed
gitea-sync/antos-deb/pipeline/head There was a failure building this commit
Some checks failed
gitea-sync/antos-deb/pipeline/head There was a failure building this commit
This commit is contained in:
parent
837c583825
commit
d85bb18afe
99
Jenkinsfile
vendored
Normal file
99
Jenkinsfile
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
// need to approve all static functions in Dashboard > Manage Jenkins > ScriptApproval
|
||||
// method hudson.model.Item getAllJobs
|
||||
// method hudson.model.Item getName
|
||||
// method hudson.model.ItemGroup getItem java.lang.String
|
||||
// method hudson.model.ItemGroup getItems
|
||||
// method jenkins.model.Jenkins getItemByFullName java.lang.String
|
||||
// new java.util.ArrayList
|
||||
// staticMethod jenkins.model.Jenkins getInstance
|
||||
def ArrayList<String> getBranches(projectName){
|
||||
def jobs = jenkins.model.Jenkins.instance.getItemByFullName(projectName).getAllJobs();
|
||||
Iterator<?> iterator = jobs.iterator();
|
||||
def arr = new ArrayList<String>();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
def job = iterator.next();
|
||||
arr.add(job.getName());
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
def generateStage(name) {
|
||||
return {
|
||||
stage("ANTOS ${name} AMD64") {
|
||||
copyArtifacts(projectName: 'gitea-sync/antos/' + name, target: 'antos/frontend/' + name);
|
||||
env.tag = name;
|
||||
env.arch = x86_64
|
||||
sh'''
|
||||
echo "Deploy antos webapps for version $tag on architecture $arch"
|
||||
set -e
|
||||
set -x
|
||||
'''
|
||||
}
|
||||
stage("ANTOS ${name} ARM64") {
|
||||
copyArtifacts(projectName: 'gitea-sync/antos/' + name, target: 'antos/frontend/' + name);
|
||||
env.tag = name;
|
||||
env.arch = aarch64
|
||||
sh'''
|
||||
echo "Deploy antos webapps for version $tag on architecture $arch"
|
||||
set -e
|
||||
set -x
|
||||
'''
|
||||
}
|
||||
stage("ANTOS ${name} ARM") {
|
||||
copyArtifacts(projectName: 'gitea-sync/antos/' + name, target: 'antos/frontend/' + name);
|
||||
env.tag = name;
|
||||
env.arch = armv7l
|
||||
sh'''
|
||||
echo "Deploy antos webapps for version $tag on architecture $arch"
|
||||
set -e
|
||||
set -x
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def parallelStagesMap = getBranches("gitea-sync/antos").collectEntries {
|
||||
["${it}" : generateStage(it)]
|
||||
}
|
||||
|
||||
|
||||
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 build
|
||||
[ -d antos ] && rm -rf antos
|
||||
'''
|
||||
copyArtifacts(projectName: 'gitea-sync/antos-appimage/master', target: 'antos/');
|
||||
script
|
||||
{
|
||||
parallel parallelStagesMap;
|
||||
}
|
||||
sh'''
|
||||
tree antos
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user