2019-10-14 13:52:53 +03:00
import java.net.URI
import java.nio.file.Paths
2019-10-04 14:24:32 +03:00
def confrepo = 'http://gogs.srt/BaseALT/autojen.git'
2019-10-08 12:00:21 +03:00
def infraConfRepo = 'http://gogs.srt/BaseALT/infra-conf.git'
def infraRepo = 'https://github.com/altlinuxteam/infra.git'
2019-10-04 14:24:32 +03:00
2019-10-08 12:00:51 +03:00
def stackSamba = [
'jenkins-samba-1x3' ,
'jenkins-samba-3x3' ,
'jenkins-samba-8sp-1x3-pub' ,
'jenkins-samba-8sp-3x3-pub' ,
'jenkins-samba-9-3x3-pub' ,
'jenkins-samba-sisyphus-1x3' ,
'jenkins-samba-sisyphus-1x3-pub' ,
'jenkins-samba-sisyphus-3x3-pub' ,
'jenkins-samba-sisyphus-3x3'
]
def stackKerberos = [
'jenkins-krb5-sisyphus-1x1'
]
2019-10-04 14:07:44 +03:00
folder ( 'samba' ) {
displayName ( 'Samba Team' )
description ( 'Jobs for Samba AD DC testing and deployment' )
views {
2019-10-08 12:01:28 +03:00
listView ( 'Samba stacks' ) {
2019-10-04 14:07:44 +03:00
description ( 'Samba AD DC tests' )
filterBuildQueue ( )
filterExecutors ( )
columns {
status ( )
name ( )
buildButton ( )
}
jobs {
2019-10-08 12:07:09 +03:00
stackSamba . each { stack - >
name ( stack )
}
}
}
listView ( 'Kerberos stacks' ) {
description ( 'Kerberos stacks' )
filterBuildQueue ( )
filterExecutors ( )
columns {
status ( )
name ( )
buildButton ( )
}
jobs {
stackKerberos . each { stack - >
name ( stack )
}
2019-10-04 14:07:44 +03:00
}
}
}
}
def mirrorsDest = '/data/mirrors/alt'
def mirrorsSrc = 'mirror.yandex.ru'
def platforms = [
2019-10-04 15:30:54 +03:00
'c8' ,
'p8' ,
'p9'
2019-10-04 14:07:44 +03:00
]
2019-10-08 12:30:44 +03:00
def elbrusBracnhes = [
2019-10-04 14:09:03 +03:00
'c8' ,
'p8' ,
'p9' ,
2019-10-04 14:07:44 +03:00
'sisyphus'
]
2019-10-14 15:43:35 +03:00
def images = [
2019-10-14 13:51:21 +03:00
'http://ftp.altlinux.org/pub/distributions/ALTLinux/p8/images/workstation/alt-workstation-8.2.1-20190906-x86_64-ru-install-dvd5.iso' ,
'http://ftp.altlinux.org/pub/distributions/ALTLinux/p8/images/server/alt-server-8.2.1-20190906-x86_64-ru-install-dvd5.iso' ,
'http://ftp.altlinux.org/pub/distributions/ALTLinux/p8/images/kworkstation/alt-kworkstation-8.3-install-x86_64.iso' ,
'http://ftp.altlinux.org/pub/distributions/ALTLinux/p9/images/server/alt-server-20191009_rc4-x86_64.iso' ,
'http://ftp.altlinux.org/pub/distributions/ALTLinux/p9/images/server/alt-server-20191009_rc4-aarch64.iso' ,
'http://ftp.altlinux.org/pub/distributions/ALTLinux/p9/images/workstation/x86_64/alt-workstation-8.991_rc2-x86_64.iso' ,
'http://ftp.altlinux.org/pub/distributions/ALTLinux/p9/images/workstation/aarch64/alt-workstation-8.991_rc2-aarch64.iso' ,
2019-10-14 15:43:35 +03:00
'http://ftp.altlinux.org/pub/distributions/ALTLinux/p9/images/workstation/mipsel/tavolga-alt-workstation-8.920_beta2-mipsel.recovery.tar'
]
2019-10-14 13:51:21 +03:00
2019-10-04 11:50:58 +03:00
folder ( 'infra' ) {
displayName ( 'Infrastructure' )
description ( 'Run Jenkins Job DSL to reconfigure master' )
2019-10-04 12:21:12 +03:00
views {
2019-10-08 12:30:44 +03:00
sectionedView ( 'File synchronization' ) {
2019-10-04 12:21:12 +03:00
description ( 'File synchronization' )
filterBuildQueue ( )
filterExecutors ( )
2019-10-08 12:40:07 +03:00
sections {
2019-10-14 13:52:15 +03:00
listView {
name ( 'Images' )
columns {
status ( )
name ( )
buildButton ( )
}
jobs {
2019-10-14 15:27:35 +03:00
regex ( 'sync-image-.*' )
2019-10-14 13:52:15 +03:00
}
}
2019-10-08 12:40:07 +03:00
listView {
name ( 'AMD64' )
columns {
status ( )
name ( )
buildButton ( )
}
jobs {
2019-10-08 12:43:04 +03:00
name ( "sync-c8" )
name ( "sync-p8" )
name ( "sync-p9" )
2019-10-08 12:30:44 +03:00
}
}
2019-10-08 12:40:07 +03:00
listView {
name ( 'MCST e2k' )
columns {
status ( )
name ( )
buildButton ( )
}
jobs {
2019-10-08 12:44:48 +03:00
name ( "sync-e2k-c8" )
name ( "sync-e2k-p8" )
name ( "sync-e2k-p9" )
2019-10-08 12:30:44 +03:00
}
}
2019-10-08 12:40:07 +03:00
listView {
name ( 'MIPS32 LE' )
columns {
status ( )
name ( )
buildButton ( )
}
2019-10-08 12:30:44 +03:00
}
2019-10-08 12:40:07 +03:00
listView {
name ( 'Aarch64' )
columns {
status ( )
name ( )
buildButton ( )
}
2019-10-08 12:02:13 +03:00
}
2019-10-04 12:21:12 +03:00
}
}
2019-10-04 17:00:13 +03:00
listView ( 'Backups' ) {
description ( 'Jobs to backup various artifacts' )
filterBuildQueue ( )
filterExecutors ( )
columns {
status ( )
name ( )
buildButton ( )
}
jobs {
name ( 'switch-backup' )
}
}
2019-10-04 17:33:24 +03:00
listView ( 'etc' ) {
description ( 'Uncategorized jobs' )
filterBuildQueue ( )
filterExecutors ( )
columns {
status ( )
name ( )
buildButton ( )
}
jobs {
name ( 'configure-jenkins' )
}
}
}
2019-10-04 12:21:12 +03:00
}
2019-10-04 15:30:18 +03:00
/ *
* Job to configure Jenkins
job ( 'infra/configure-jenkins' ) {
displayName ( 'Configure Jenkins' )
description ( 'Apply Jenkins configuration' )
scm {
git {
remote {
name ( 'origin' )
url ( confrepo )
}
branch ( 'master' )
extensions {
cleanAfterCheckout ( )
}
}
}
}
* /
2019-10-14 15:43:35 +03:00
for ( i = 0 ; i < images . size ( ) ; i + + ) {
2019-10-14 15:48:24 +03:00
filename = Paths . get ( new URI ( images [ i ] ) . getPath ( ) ) . getFileName ( ) . toString ( )
2019-10-14 15:43:35 +03:00
job ( "infra/sync-image-${i}" ) {
2019-10-14 15:49:57 +03:00
displayName ( "${filename}" )
description ( "Synchronize image: ${images[i]}" )
2019-10-14 13:52:53 +03:00
label ( 'pve' )
logRotator {
numToKeep ( 10 )
}
parameters {
stringParam ( 'IMAGES_DEST' ,
mirrorsDest ,
'Directory to save images to' )
}
scm {
git {
remote {
name ( 'origin' )
url ( confrepo )
}
branch ( 'master' )
extensions {
cleanAfterCheckout ( )
}
}
}
triggers {
// Make a pause for sync during working hours
2019-10-14 15:43:35 +03:00
cron ( 'H 3,7,9,20,23 * * *' )
2019-10-14 13:52:53 +03:00
}
steps {
2019-10-14 15:01:06 +03:00
//shell("/usr/bin/env IMAGES_DEST=" + '${IMAGES_DEST}' + "IMAGE=${url} HASH=${hash} /bin/sh ./scripts/sync_image")
2019-10-14 13:52:53 +03:00
}
}
2019-10-14 15:43:35 +03:00
}
2019-10-14 13:52:53 +03:00
2019-10-04 14:43:49 +03:00
/ *
* Generate jobs to syncrinize various repos . The process looks like
* this :
* 1 ) Checkout this repo ;
* 2 ) Run synchronization script with paths set via environment
* variables ;
* 3 ) Cleanup workspace ;
* /
2019-10-04 14:07:44 +03:00
platforms . each { platform - >
2019-10-04 14:24:32 +03:00
job ( "infra/sync-${platform}" ) {
2019-10-04 14:30:36 +03:00
displayName ( "Synchronize ALT Linux repos for ${platform}" )
2019-10-04 14:07:44 +03:00
description ( 'Runs synchronization script on PVE' )
2019-10-04 14:43:49 +03:00
// The job must be run on pve node
2019-10-04 14:07:44 +03:00
label ( 'pve' )
2019-10-04 15:52:35 +03:00
logRotator {
2019-10-08 12:04:40 +03:00
numToKeep ( 10 )
2019-10-04 15:52:35 +03:00
}
2019-10-04 14:43:49 +03:00
parameters {
stringParam ( 'MIRRORS_DEST' ,
mirrorsDest ,
'Directory to save repository to' )
stringParam ( 'MIRRORS_SRC' ,
mirrorsSrc ,
'Host to download files from' )
2019-10-04 14:24:32 +03:00
}
2019-10-04 14:07:44 +03:00
scm {
2019-10-04 14:24:32 +03:00
git {
remote {
name ( 'origin' )
url ( confrepo )
}
branch ( 'master' )
extensions {
cleanAfterCheckout ( )
}
}
2019-10-04 14:07:44 +03:00
}
2019-10-04 15:47:05 +03:00
triggers {
2019-10-08 12:05:58 +03:00
// Make a pause for sync during working hours
cron ( 'H 3,7,9,20,23 * * *' )
2019-10-04 15:47:05 +03:00
}
2019-10-04 14:07:44 +03:00
steps {
2019-10-04 15:53:01 +03:00
shell ( '/usr/bin/env MIRRORS_DEST=${MIRRORS_DEST} MIRRORS_SRC=${MIRRORS_SRC} PLATFORM=' + platform + ' /bin/sh ./scripts/sync_alt_repo' )
2019-10-04 14:07:44 +03:00
}
}
2019-10-04 11:50:58 +03:00
}
2019-10-04 17:00:13 +03:00
job ( 'infra/switch-backup' ) {
displayName ( 'Backup switch configuration' )
description ( 'Signals switches to dump active configuration to central storage' )
label ( 'pve' )
logRotator {
2019-10-08 12:04:40 +03:00
numToKeep ( 20 )
2019-10-04 17:00:13 +03:00
}
scm {
git {
remote {
name ( 'origin' )
url ( confrepo )
}
branch ( 'master' )
extensions {
cleanAfterCheckout ( )
}
}
}
triggers {
2019-10-08 12:06:27 +03:00
// Synchronize every 5 hours
cron ( 'H 5,10,15,20 * * *' )
2019-10-04 17:00:13 +03:00
}
steps {
shell ( 'echo test' )
}
}