2022-09-29 22:08:26 +02:00
|
|
|
// need to approve all static functions in Dashboard > Manage Jenkins > ScriptApproval
|
2022-09-29 23:18:11 +02:00
|
|
|
def ArrayList<String> copyArtifactsByBranches(projectName){
|
|
|
|
def jobs = jenkins.model.Jenkins.instance.getItemByFullName('gitea-sync/antos').getAllJobs();
|
|
|
|
Iterator<?> iterator = jobs.iterator();
|
|
|
|
def arr = new ArrayList<String>();
|
|
|
|
|
|
|
|
while (iterator.hasNext()) {
|
|
|
|
def job = iterator.next();
|
|
|
|
arr.add(job.getName());
|
|
|
|
}
|
|
|
|
return arr;
|
2022-09-29 23:13:25 +02:00
|
|
|
}
|
2022-09-29 23:18:11 +02:00
|
|
|
|
2022-09-29 23:13:25 +02:00
|
|
|
def generateStage(name) {
|
|
|
|
return {
|
|
|
|
stage("stage: ANTOS ${name}") {
|
|
|
|
copyArtifacts(projectName: 'gitea-sync/antos/' + name, target: 'build/frontend/' + name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-29 23:18:11 +02:00
|
|
|
def parallelStagesMap = jenkins.model.Jenkins.instance.getItemByFullName('gitea-sync/antos').getAllJobs().collectEntries {
|
|
|
|
["${it}" : generateStage(it)]
|
2022-09-29 22:40:38 +02:00
|
|
|
}
|
2022-09-29 23:13:25 +02:00
|
|
|
|
|
|
|
|
2022-09-20 11:44:57 +02:00
|
|
|
pipeline{
|
2022-09-29 21:30:24 +02:00
|
|
|
agent { node{ label'workstation' }}
|
2022-09-20 11:44:57 +02:00
|
|
|
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
|
|
|
|
{
|
2022-09-29 21:30:24 +02:00
|
|
|
stage('Prepare binaries') {
|
2022-09-20 14:51:40 +02:00
|
|
|
steps {
|
2022-09-29 21:30:24 +02:00
|
|
|
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');
|
2022-09-29 22:29:50 +02:00
|
|
|
script
|
|
|
|
{
|
2022-09-29 23:18:11 +02:00
|
|
|
parallel parallelStagesMap;
|
2022-09-29 22:29:50 +02:00
|
|
|
}
|
2022-09-29 22:45:16 +02:00
|
|
|
//copyArtifacts(projectName: 'gitea-sync/antos/*', target: 'build/frontend');
|
2022-09-29 21:38:32 +02:00
|
|
|
//copyArtifacts(projectName: 'gitea-sync/antd-web-apps/master', target: 'build/backend');
|
2022-09-29 21:31:29 +02:00
|
|
|
sh'''
|
|
|
|
tree build
|
2022-09-29 22:45:16 +02:00
|
|
|
exit 1
|
2022-09-29 21:31:29 +02:00
|
|
|
'''
|
2022-09-20 14:51:40 +02:00
|
|
|
}
|
|
|
|
}
|
2022-09-20 11:44:57 +02:00
|
|
|
stage('Build AMD64') {
|
|
|
|
steps {
|
2022-09-29 21:30:24 +02:00
|
|
|
sh'''
|
2022-09-20 14:21:09 +02:00
|
|
|
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
|
|
|
|
'''
|
2022-09-20 11:44:57 +02:00
|
|
|
}
|
|
|
|
}
|
2022-09-20 14:21:09 +02:00
|
|
|
stage('Build arm64') {
|
2022-09-20 11:44:57 +02:00
|
|
|
steps {
|
2022-09-29 21:30:24 +02:00
|
|
|
sh'''
|
2022-09-20 14:21:09 +02:00
|
|
|
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
|
|
|
|
'''
|
2022-09-20 11:44:57 +02:00
|
|
|
}
|
|
|
|
}
|
2022-09-20 14:21:09 +02:00
|
|
|
stage('Build arm') {
|
2022-09-20 11:44:57 +02:00
|
|
|
steps {
|
2022-09-29 21:30:24 +02:00
|
|
|
sh'''
|
2022-09-20 14:21:09 +02:00
|
|
|
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
|
|
|
|
'''
|
2022-09-20 11:44:57 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Archive') {
|
|
|
|
steps {
|
|
|
|
script {
|
|
|
|
archiveArtifacts artifacts: 'build/', fingerprint: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-09-20 11:41:59 +02:00
|
|
|
}
|