From 8aebe603949b92f5530e87b3ef3d8a0d95ac7bfa Mon Sep 17 00:00:00 2001 From: "G. Blake Meike" Date: Mon, 4 Nov 2024 11:24:36 -0800 Subject: [PATCH] More windows fixes (#85) --- jenkins/pipelines/java/Jenkinsfile | 210 ++++++++---------- .../pipelines/java/desktop/win_teardown.ps1 | 6 +- jenkins/pipelines/java/desktop/win_tests.ps1 | 2 +- .../java/webservice/win_teardown.ps1 | 6 +- .../pipelines/java/webservice/win_tests.ps1 | 2 +- 5 files changed, 99 insertions(+), 127 deletions(-) diff --git a/jenkins/pipelines/java/Jenkinsfile b/jenkins/pipelines/java/Jenkinsfile index 0545a04e..6f0f6e64 100644 --- a/jenkins/pipelines/java/Jenkinsfile +++ b/jenkins/pipelines/java/Jenkinsfile @@ -17,164 +17,140 @@ pipeline { } } - // Note that there is no fundamental reason that the Desktop and Web Services - // builds couldn't run in parallel. We'd need to figure out how to set - // up the environment server and sg at alternate ports, probably, and we'd - // need hardware that can support the load. + // If Jenkins will actually run things in parallel, we will, at least for now + // Need to use locks to protect platform tests from corrupting each other's back ends. + // Might as well use them here, for exactly the same purpose. - stage('Run Desktop Tests') { + stage('Tests') { parallel { - stage('OSX Tests') { + stage('OSX Desktop Test') { agent { label 'mob-e2e-mac-01' } options { - timeout(time: 45, unit: 'MINUTES') + // timeout(time: 60, unit: 'MINUTES') lock("mob-e2e-mac-01") } - stages { - stage('OSX Desktop Tests') { - steps { - echo "Run OSX Java Desktop Tests" - sh """ - jenkins/pipelines/java/desktop/osx_tests.sh "${params.CBL_VERSION}" "${params.CBL_BUILD}" "${params.SGW_URL}" - """ - } - post { - always { - echo "Teardown OSX Java Desktop Tests" - sh ''' - jenkins/pipelines/java/desktop/osx_teardown.sh - ''' - } - } + steps { + echo "Run OSX Java Desktop Tests" + sh """ + jenkins/pipelines/java/desktop/osx_tests.sh "${params.CBL_VERSION}" "${params.CBL_BUILD}" "${params.SGW_URL}" + """ + } + post { + always { + echo "Teardown OSX Java Desktop Tests" + sh ''' + jenkins/pipelines/java/desktop/osx_teardown.sh + ''' } } } - stage('Windows Tests') { + + stage('Windows Desktop Test') { agent { label 'mob-e2e-win-01' } options { - timeout(time: 45, unit: 'MINUTES') + // timeout(time: 60, unit: 'MINUTES') lock("mob-e2e-win-01") } - stages { - stage('Windows Desktop Tests') { - steps { - echo "Run Windows Java Desktop Tests" - pwsh """ - jenkins/pipelines/java/desktop/win_tests.ps1 "${params.CBL_VERSION}" "${params.CBL_BUILD}" "${params.SGW_URL}" - """ - } - post { - always { - echo "Teardown Windows Java Desktop Tests" - pwsh ''' - jenkins/pipelines/java/desktop/win_teardown.ps1 - ''' - } - } + steps { + echo "Run Windows Java Desktop Tests" + pwsh """ + jenkins\\pipelines\\java/desktop\\win_tests.ps1 "${params.CBL_VERSION}" "${params.CBL_BUILD}" "${params.SGW_URL}" + """ + } + post { + always { + echo "Teardown Windows Java Desktop Tests" + pwsh ''' + jenkins\\pipelines\\java\\desktop\\win_teardown.ps1 + ''' } } } - stage('Linux Tests') { + + stage('Linux Desktop Test') { agent { label 'mob-e2e-deb-02' } options { - timeout(time: 45, unit: 'MINUTES') + // timeout(time: 60, unit: 'MINUTES') lock("mob-e2e-deb-02") } - stages { - stage('Linux Desktop Tests') { - steps { - echo "Run Linux Java Desktop Tests" - sh """ - jenkins/pipelines/java/desktop/linux_tests.sh "${params.CBL_VERSION}" "${params.CBL_BUILD}" "${params.SGW_URL}" - """ - } - post { - always { - echo "Teardown Linux Java Desktop Tests" - sh ''' - jenkins/pipelines/java/desktop/linux_teardown.sh - ''' - } - } + steps { + echo "Run Linux Java Desktop Tests" + sh """ + jenkins/pipelines/java/desktop/linux_tests.sh "${params.CBL_VERSION}" "${params.CBL_BUILD}" "${params.SGW_URL}" + """ + } + post { + always { + echo "Teardown Linux Java Desktop Tests" + sh ''' + jenkins/pipelines/java/desktop/linux_teardown.sh + ''' } } } - } - } - stage('Run Webservices Tests') { - parallel { - stage('OSX Tests') { + + stage('OSX Web Service Test') { agent { label 'mob-e2e-mac-01' } options { - timeout(time: 60, unit: 'MINUTES') + // timeout(time: 120, unit: 'MINUTES') lock("mob-e2e-mac-01") } - stages { - stage('OSX Web Services Tests') { - steps { - echo "Run OSX Java Web Services Tests" - sh """ - jenkins/pipelines/java/webservice/osx_tests.sh "${params.CBL_VERSION}" "${params.CBL_BUILD}" "${params.SGW_URL}" - """ - } - post { - always { - echo "Teardown OSX Web Services Tests" - sh ''' - jenkins/pipelines/java/webservice/osx_teardown.sh - ''' - } - } + steps { + echo "Run OSX Java Web Service Tests" + sh """ + jenkins/pipelines/java/webservice/osx_tests.sh "${params.CBL_VERSION}" "${params.CBL_BUILD}" "${params.SGW_URL}" + """ + } + post { + always { + echo "Teardown OSX Web Service Tests" + sh ''' + jenkins/pipelines/java/webservice/osx_teardown.sh + ''' } } } - stage('Windows Tests') { + + stage('Windows Web Service Test') { agent { label 'mob-e2e-win-01' } options { - timeout(time: 60, unit: 'MINUTES') + // timeout(time: 120, unit: 'MINUTES') lock("mob-e2e-win-01") } - stages { - stage('Windows Web Services Tests') { - steps { - echo "Run Windows Java Web Services Tests" - pwsh """ - jenkins/pipelines/java/webservice/win_tests.ps1 "${params.CBL_VERSION}" "${params.CBL_BUILD}" "${params.SGW_URL}" - """ - } - post { - always { - echo "Teardown Windows Web Services Tests" - pwsh ''' - jenkins/pipelines/java/webservice/win_teardown.ps1 - ''' - } - } + steps { + echo "Run Windows Java Web Service Tests" + pwsh """ + jenkins\\pipelines\\java\\webservice\\win_tests.ps1 "${params.CBL_VERSION}" "${params.CBL_BUILD}" "${params.SGW_URL}" + """ + } + post { + always { + echo "Teardown Windows Web Service Tests" + pwsh ''' + jenkins\\pipelines\\java\\webservice\\win_teardown.ps1 + ''' } } } - stage('Linux Tests') { + + stage('Linux Web Service Test') { agent { label 'mob-e2e-deb-02' } options { - timeout(time: 60, unit: 'MINUTES') + // timeout(time: 120, unit: 'MINUTES') lock("mob-e2e-deb-02") } - stages { - stage('Linux Web Services Tests') { - steps { - echo "Run Linux Java Web Services Tests" - sh """ - jenkins/pipelines/java/webservice/linux_tests.sh "${params.CBL_VERSION}" "${params.CBL_BUILD}" "${params.SGW_URL}" - """ - } - post { - always { - echo "Teardown Linux Web Services Tests" - sh ''' - jenkins/pipelines/java/webservice/linux_teardown.sh - ''' - } - } + steps { + echo "Run Linux Java Web Service Tests" + sh """ + jenkins/pipelines/java/webservice/linux_tests.sh "${params.CBL_VERSION}" "${params.CBL_BUILD}" "${params.SGW_URL}" + """ + } + post { + always { + echo "Teardown Linux Web Service Tests" + sh ''' + jenkins/pipelines/java/webservice/linux_teardown.sh + ''' } } } diff --git a/jenkins/pipelines/java/desktop/win_teardown.ps1 b/jenkins/pipelines/java/desktop/win_teardown.ps1 index 51b3e7f0..8b8caa84 100644 --- a/jenkins/pipelines/java/desktop/win_teardown.ps1 +++ b/jenkins/pipelines/java/desktop/win_teardown.ps1 @@ -1,7 +1,5 @@ -#!/bin/bash -# Clean up after running Java Web Services tests -echo "Shutdown Test Server" +Write-Host "Shutdown Test Server" Push-Location servers\jak\desktop if (Test-Path -Path .\server.pid){ $serverId = Get-Content .\server.pid @@ -9,7 +7,7 @@ if (Test-Path -Path .\server.pid){ } Pop-Location -echo "Shutdown Environment" +Write-Host "Shutdown Environment" Push-Location environment & docker compose down diff --git a/jenkins/pipelines/java/desktop/win_tests.ps1 b/jenkins/pipelines/java/desktop/win_tests.ps1 index 0060e9e6..9c02246d 100644 --- a/jenkins/pipelines/java/desktop/win_tests.ps1 +++ b/jenkins/pipelines/java/desktop/win_tests.ps1 @@ -65,7 +65,7 @@ Get-Content config_java_desktop.json Write-Host "Running tests on desktop test server at $serverUrl" & python3.10 -m venv venv Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force -./venv/Scripts/activate.ps1 +.\venv\Scripts\activate.ps1 pip install -r requirements.txt Write-Host "Run tests" diff --git a/jenkins/pipelines/java/webservice/win_teardown.ps1 b/jenkins/pipelines/java/webservice/win_teardown.ps1 index 1bf6756e..b65c96c5 100644 --- a/jenkins/pipelines/java/webservice/win_teardown.ps1 +++ b/jenkins/pipelines/java/webservice/win_teardown.ps1 @@ -1,13 +1,11 @@ -#!/bin/bash -# Clean up after running Java Web Services tests -echo "Shutdown Test Server" +Write-Host "Shutdown Test Server" Push-Location servers\jak\desktop & .\gradlew.bat --no-daemon appStop Remove-Item app\server.url Pop-Location -echo "Shutdown Environment" +Write-Host "Shutdown Environment" Push-Location environment & docker compose down diff --git a/jenkins/pipelines/java/webservice/win_tests.ps1 b/jenkins/pipelines/java/webservice/win_tests.ps1 index 5f8cf1a3..f1169f9f 100644 --- a/jenkins/pipelines/java/webservice/win_tests.ps1 +++ b/jenkins/pipelines/java/webservice/win_tests.ps1 @@ -59,7 +59,7 @@ Get-Content config_java_webservice.json Write-Host "Running tests on desktop test server at $SERVER_URL" & python3.10 -m venv venv Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force -./venv/Scripts/activate.ps1 +.\venv\Scripts\activate.ps1 pip install -r requirements.txt Write-Host "Run tests"