Copy from Atlas Autobuild scripts as a starting point

This commit is contained in:
Dan Hawkins 2020-10-22 12:12:30 +01:00
commit 2d66e342df
92 changed files with 11897 additions and 0 deletions

View file

@ -0,0 +1,149 @@
pipeline {
agent { label "${AGENT_LABEL}" }
stages {
stage ('Cleaning Test_Output') {
steps{
bat'''if exist %WORKSPACE%\\Test_Output rmdir /s /q %WORKSPACE%\\Test_Output'''
}
}
stage ('Cleaning imports') {
steps{
bat'''if exist %WORKSPACE%\\imports rmdir /s /q %WORKSPACE%\\imports'''
}
}
stage('Clean workspace') {
when {
expression {
"${CLEAN_WORKSPACE}" == "true"
}
}
steps {
cleanWs()
}
}
stage("checkout python"){
steps{
checkout([$class: 'GitSCM',
branches: [[name: 'origin/3.6.3_windows']],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'CleanBeforeCheckout'], [$class: 'RelativeTargetDirectory', relativeTargetDir: 'python']],
submoduleCfg: [], userRemoteConfigs: [[url: 'git@hydra:tools/python.git']]])
script{
env.PYTHON = "${WORKSPACE}/python/ver/python.exe"
}
}
}
stage('Checkout source') {
steps {
checkout([$class: 'GitSCM',
branches: [[name: 'origin/${TEST_BRANCH}']],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'CleanBeforeCheckout'], [$class: 'RelativeTargetDirectory', relativeTargetDir: 'testscripts']],
submoduleCfg: [], userRemoteConfigs: [[url: 'git@hydra:gis/atlaskiosksdk_test.git']]])
}
}
stage('Checkout GisCore') {
steps {
checkout([$class: 'GitSCM',
branches: [[name: 'origin/MCSRepo']],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'CleanBeforeCheckout'], [$class: 'RelativeTargetDirectory', relativeTargetDir: 'GisCore']],
submoduleCfg: [], userRemoteConfigs: [[url: 'git@hydra:gistest/giscorelite.git']]])
}
}
stage('Checkout test utilites') {
steps {
checkout([$class: 'GitSCM',
branches: [[name: 'origin/master']],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'CleanBeforeCheckout'], [$class: 'RelativeTargetDirectory', relativeTargetDir: 'Utilities']],
submoduleCfg: [], userRemoteConfigs: [[url: 'git@hydra:gistest/Utilities.git']]])
}
}
stage("Clean imports") {
steps {
script {
env.IMPORTSPATH = "${WORKSPACE}/imports"
}
dir("${IMPORTSPATH}") {
deleteDir()
}
}
}
stage("Clean exports") {
steps {
dir("${WORKSPACE}/uilogs") {
deleteDir()
}
dir("${WORKSPACE}/version") {
deleteDir()
}
dir("${WORKSPACE}/pipeline") {
deleteDir()
}
}
}
stage('Import artifacts') {
steps {
script {
env.PRINTSERVER = "${IMPORTSPATH}/printserver"
echo "Obtaining Print server artifacts from ${PRINT_SERVER_BINARIES_JOB} job and placing at folder: ${PRINTSERVER}"
copyArtifacts filter: 'bin/x64/Release/*.exe, bin/x64/Release/*.dll', projectName: "${PRINT_SERVER_BINARIES_JOB}", selector: lastSuccessful(), target: "${PRINTSERVER}"
ATLAS = "${IMPORTSPATH}/atlas"
echo "Obtaining Atlas artifacts from ${ATLAS_BINARIES_JOB} job and placing at folder: ${ATLAS}"
copyArtifacts filter: 'bin/**,LocalisationSDK/**,version/**', projectName: "${ATLAS_BINARIES_JOB}", selector: lastSuccessful(), target: "${ATLAS}"
}
}
}
stage('Save environment variable(s) to file for TestExecute bug') {
steps {
script {
bat '''
set WORKSPACE > "%SystemRoot%/Temp/environment-variables-from-jenkins.txt"
'''
}
}
}
stage('Check available TE Licences'){
steps{
script {
res = build(job: "Check_TE_Licence", propagate: false).result
if (res != 'SUCCESS') {
currentBuild.result = 'FAILED'
error "No more available Test Execute licences. Stopping pipeline."
}
}
}
}
stage('Test loop') {
steps {
script {
failureCount = 0
String[] tests
tests = "${TESTLIST}".split(",")
tests.each {
powershell(returnStdout: true, script: '$names = @("dotnet", "Atlas Professional for Print Server", "Atlas Professional", "GIS Print Server 2", "AtlasKioskSDK", "pythonw"); foreach ($item in $names) {Get-Process -Name $item | Stop-Process}')
testcompletetest generateMHT: true, launchType: 'lcItem', project: "AtlasPrintServerProject", suite: "testscripts/UITests/AtlasTestSuite/AtlasTestSuite.pjs", test: "${it}", useTCService: true, userName: 'jenkins_user', userPassword: 'ramshorn42', useActiveSession: true, executorType: "TE", useTimeout: true, timeout: '10800', actionOnErrors: 'MAKE_FAILED'
}
}
}
}
}
post {
failure {
bat " %WORKSPACE%\\python\\ver\\python.exe %WORKSPACE%\\Utilities\\sendEmail\\emailnotification.py -t TC -j ${env.BUILD_URL} -n ${env.JOB_NAME} -s FAILED"
}
success {
bat " %WORKSPACE%\\python\\ver\\python.exe %WORKSPACE%\\Utilities\\sendEmail\\emailnotification.py -t TC -j ${env.BUILD_URL} -n ${env.JOB_NAME} -s SUCCESS"
}
unstable {
bat " %WORKSPACE%\\python\\ver\\python.exe %WORKSPACE%\\Utilities\\sendEmail\\emailnotification.py -t TC -j ${env.BUILD_URL} -n ${env.JOB_NAME} -s FAILED"
}
}
}