mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-23 05:45:35 +08:00
Set end of live date in Jenkins build
Depending on the branch, we override the end of live date relative in month from the build time. develop/ builds expire in 6 month release/ builds expire in 12 month all others expire in 3 month. ref T319
This commit is contained in:
committed by
Klaus Basan
parent
3770b02ea7
commit
21bc1f7dbe
24
Jenkinsfile
vendored
24
Jenkinsfile
vendored
@@ -12,10 +12,11 @@ builders['Build swift Linux'] = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stage('Linux Build') {
|
stage('Linux Build') {
|
||||||
|
def eolInMonth = 6
|
||||||
withEnv(['BITROCK_BUILDER=/opt/installbuilder/bin/builder', 'BITROCK_CUSTOMIZE=/opt/installbuilder/autoupdate/bin/customize.run']) {
|
withEnv(['BITROCK_BUILDER=/opt/installbuilder/bin/builder', 'BITROCK_CUSTOMIZE=/opt/installbuilder/autoupdate/bin/customize.run']) {
|
||||||
sh '''
|
sh '''
|
||||||
cp ~/vatsim.pri.official mkspecs/features/vatsim.pri
|
cp ~/vatsim.pri.official mkspecs/features/vatsim.pri
|
||||||
python3 -u scripts/jenkins.py -w 64 -t gcc -d -j 2
|
python3 -u scripts/jenkins.py -w 64 -t gcc -d -j 2 -e ''' + getEolInMonth() + '''
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,7 +63,7 @@ builders['Build swift MacOS'] = {
|
|||||||
withEnv(['PATH+LOCAL=/usr/local/bin', 'BITROCK_BUILDER=/Applications/BitRockInstallBuilderQt/bin/builder', 'BITROCK_CUSTOMIZE=/Applications/BitRockInstallBuilderQt/autoupdate/bin/customize.sh']) {
|
withEnv(['PATH+LOCAL=/usr/local/bin', 'BITROCK_BUILDER=/Applications/BitRockInstallBuilderQt/bin/builder', 'BITROCK_CUSTOMIZE=/Applications/BitRockInstallBuilderQt/autoupdate/bin/customize.sh']) {
|
||||||
sh '''
|
sh '''
|
||||||
cp ~/vatsim.pri.official mkspecs/features/vatsim.pri
|
cp ~/vatsim.pri.official mkspecs/features/vatsim.pri
|
||||||
python -u scripts/jenkins.py -w 64 -t clang -d -j2
|
python -u scripts/jenkins.py -w 64 -t clang -d -j2 -e ''' + getEolInMonth() + '''
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +102,7 @@ builders['Build swift Win32'] = {
|
|||||||
stage('Win32 Build') {
|
stage('Win32 Build') {
|
||||||
bat '''
|
bat '''
|
||||||
copy /Y c:\\var\\vatsim.pri.official mkspecs\\features\\vatsim.pri
|
copy /Y c:\\var\\vatsim.pri.official mkspecs\\features\\vatsim.pri
|
||||||
python -u scripts/jenkins.py -w 32 -t msvc -d
|
python -u scripts/jenkins.py -w 32 -t msvc -d -e ''' + getEolInMonth() + '''
|
||||||
'''
|
'''
|
||||||
|
|
||||||
warnings consoleParsers: [[parserName: 'MSBuild']], unstableTotalAll: '0'
|
warnings consoleParsers: [[parserName: 'MSBuild']], unstableTotalAll: '0'
|
||||||
@@ -140,7 +141,7 @@ builders['Build swift Win64'] = {
|
|||||||
stage('Win64 Build') {
|
stage('Win64 Build') {
|
||||||
bat '''
|
bat '''
|
||||||
copy /Y c:\\var\\vatsim.pri.official mkspecs\\features\\vatsim.pri
|
copy /Y c:\\var\\vatsim.pri.official mkspecs\\features\\vatsim.pri
|
||||||
python -u scripts/jenkins.py -w 64 -t msvc -d
|
python -u scripts/jenkins.py -w 64 -t msvc -d -e ''' + getEolInMonth() + '''
|
||||||
'''
|
'''
|
||||||
|
|
||||||
warnings consoleParsers: [[parserName: 'MSBuild']], unstableTotalAll: '0'
|
warnings consoleParsers: [[parserName: 'MSBuild']], unstableTotalAll: '0'
|
||||||
@@ -298,6 +299,21 @@ def notifySlack(nodeName, buildStatus = 'STARTED') {
|
|||||||
slackSend (color: colorCode, message: summary)
|
slackSend (color: colorCode, message: summary)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def getEolInMonth() {
|
||||||
|
def regexDevBranch = /develop\/\d.\d.\d/
|
||||||
|
def regexReleaseBranch = /^release\/\d.\d/
|
||||||
|
if (BRANCH_NAME ==~ regexDevBranch) {
|
||||||
|
// 6 month for dev builds
|
||||||
|
return 6
|
||||||
|
} else if(BRANCH_NAME ==~ regexReleaseBranch) {
|
||||||
|
// 12 month currently for release builds. That will be removed in future.
|
||||||
|
return 12
|
||||||
|
} else {
|
||||||
|
// 3 month for everything else
|
||||||
|
return 3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def killDBusDaemon() {
|
def killDBusDaemon() {
|
||||||
bat '''
|
bat '''
|
||||||
tasklist /FI "IMAGENAME eq dbus-daemon.exe" 2>NUL | find /I /N "dbus-daemon.exe">NUL
|
tasklist /FI "IMAGENAME eq dbus-daemon.exe" 2>NUL | find /I /N "dbus-daemon.exe">NUL
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
# including this file, may be copied, modified, propagated, or distributed except according to the terms
|
# including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||||
# contained in the LICENSE file.
|
# contained in the LICENSE file.
|
||||||
|
|
||||||
|
from datetime import date
|
||||||
import getopt
|
import getopt
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import os
|
import os
|
||||||
@@ -44,7 +45,7 @@ class Builder:
|
|||||||
shared_path = os.path.abspath(os.path.join(source_path, 'resources', 'share'))
|
shared_path = os.path.abspath(os.path.join(source_path, 'resources', 'share'))
|
||||||
datastore.update_shared(host, datastore_version, shared_path)
|
datastore.update_shared(host, datastore_version, shared_path)
|
||||||
|
|
||||||
def build(self, jobs, dev_build):
|
def build(self, jobs, dev_build, eolInMonth):
|
||||||
"""
|
"""
|
||||||
Run the build itself. Pass dev_build=True to enable a dev build
|
Run the build itself. Pass dev_build=True to enable a dev build
|
||||||
"""
|
"""
|
||||||
@@ -53,9 +54,20 @@ class Builder:
|
|||||||
if not os.path.isdir(build_path):
|
if not os.path.isdir(build_path):
|
||||||
os.makedirs(build_path)
|
os.makedirs(build_path)
|
||||||
os.chdir(build_path)
|
os.chdir(build_path)
|
||||||
|
|
||||||
qmake_call = ['qmake']
|
qmake_call = ['qmake']
|
||||||
if dev_build:
|
if dev_build:
|
||||||
qmake_call += ['"BLACK_CONFIG+=SwiftDevBranch"']
|
qmake_call += ['"BLACK_CONFIG+=SwiftDevBranch"']
|
||||||
|
|
||||||
|
if eolInMonth > 0:
|
||||||
|
eolYear = date.today().year
|
||||||
|
eolMonth = date.today().month + eolInMonth
|
||||||
|
eolYear = eolYear + ( eolMonth / 12 )
|
||||||
|
eolMonth = eolMonth % 12
|
||||||
|
eolDate = date(int(eolYear), int(eolMonth), 1)
|
||||||
|
print('Setting EOL date to ' + eolDate.strftime('%Y%m%d'))
|
||||||
|
qmake_call += ['BLACK_EOL=' + eolDate.strftime('%Y%m%d')]
|
||||||
|
|
||||||
qmake_call += ['-r', os.pardir]
|
qmake_call += ['-r', os.pardir]
|
||||||
subprocess.check_call(qmake_call, env=dict(os.environ))
|
subprocess.check_call(qmake_call, env=dict(os.environ))
|
||||||
|
|
||||||
@@ -372,7 +384,7 @@ def print_help():
|
|||||||
'Windows': ['msvc', 'mingw']
|
'Windows': ['msvc', 'mingw']
|
||||||
}
|
}
|
||||||
compiler_help = '|'.join(supported_compilers[platform.system()])
|
compiler_help = '|'.join(supported_compilers[platform.system()])
|
||||||
print('jenkins.py -c <config file> -w <32|64> -t <' + compiler_help + '> [-d]')
|
print('jenkins.py -c <config file> -w <32|64> -t <' + compiler_help + '> [-d] [-e <end of life in month>]')
|
||||||
|
|
||||||
|
|
||||||
# Entry point if called as a standalone program
|
# Entry point if called as a standalone program
|
||||||
@@ -383,9 +395,10 @@ def main(argv):
|
|||||||
dev_build = False
|
dev_build = False
|
||||||
jobs = None
|
jobs = None
|
||||||
upload_symbols = False
|
upload_symbols = False
|
||||||
|
eolInMonth = 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
opts, args = getopt.getopt(argv, 'hc:w:t:j:du', ['config=', 'wordsize=', 'toolchain=', 'jobs=', 'dev', 'upload'])
|
opts, args = getopt.getopt(argv, 'hc:w:t:j:due:', ['config=', 'wordsize=', 'toolchain=', 'jobs=', 'dev', 'upload', 'eol'])
|
||||||
except getopt.GetoptError:
|
except getopt.GetoptError:
|
||||||
print_help()
|
print_help()
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@@ -413,6 +426,8 @@ def main(argv):
|
|||||||
dev_build = True
|
dev_build = True
|
||||||
elif opt in ('-u', '--upload'):
|
elif opt in ('-u', '--upload'):
|
||||||
upload_symbols = True
|
upload_symbols = True
|
||||||
|
elif opt in ('-e', '--eol'):
|
||||||
|
eolInMonth = int(arg)
|
||||||
|
|
||||||
if word_size not in ['32', '64']:
|
if word_size not in ['32', '64']:
|
||||||
print('Unsupported word size. Choose 32 or 64')
|
print('Unsupported word size. Choose 32 or 64')
|
||||||
@@ -435,7 +450,7 @@ def main(argv):
|
|||||||
builder = builders[platform.system()][tool_chain](config_file, word_size)
|
builder = builders[platform.system()][tool_chain](config_file, word_size)
|
||||||
|
|
||||||
builder.prepare()
|
builder.prepare()
|
||||||
builder.build(jobs, dev_build)
|
builder.build(jobs, dev_build, eolInMonth)
|
||||||
builder.checks()
|
builder.checks()
|
||||||
builder.install()
|
builder.install()
|
||||||
builder.publish()
|
builder.publish()
|
||||||
|
|||||||
Reference in New Issue
Block a user