Skip to content

Commit

Permalink
ci: add extended support for windows (#683)
Browse files Browse the repository at this point in the history
(cherry picked from commit 9c0cb45)
  • Loading branch information
v1v authored and mergify[bot] committed Aug 26, 2022
1 parent 88efae5 commit 1f7245e
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ pipeline {
// disabled by default, but required for merge:
// opt-in with 'ci:end-to-end' tag on PR
booleanParam(name: 'end_to_end_tests_ci', defaultValue: false, description: 'Enable End-to-End tests')

// disabled by default, but required for merge:
// opt-in with 'ci:extended-windows' tag on PR
booleanParam(name: 'extended_windows_ci', defaultValue: false, description: 'Enable Extended Windows tests')
}
stages {
stage('Checkout') {
Expand All @@ -51,6 +55,7 @@ pipeline {
setEnvVar('ONLY_DOCS', isGitRegionMatch(patterns: [ '.*\\.(asciidoc|md)' ], shouldMatchAll: true).toString())
setEnvVar('PACKAGING_CHANGES', isGitRegionMatch(patterns: [ '(^dev-tools/packaging/.*|.ci/Jenkinsfile)' ], shouldMatchAll: false).toString())
setEnvVar('K8S_CHANGES', isGitRegionMatch(patterns: [ '(^deploy/kubernetes/.*|^version/docs/version.asciidoc|.ci/Jenkinsfile)' ], shouldMatchAll: false).toString())
setEnvVar('EXT_WINDOWS_CHANGES', isGitRegionMatch(patterns: [ '.ci/Jenkinsfile' ], shouldMatchAll: false).toString())
}
}
}
Expand Down Expand Up @@ -261,6 +266,66 @@ pipeline {
wait: true)
}
}
stage('extended windows') {
when {
// Always when running builds on branches/tags
// Enable if extended windows support related changes.
beforeAgent true
anyOf {
not { changeRequest() }
expression { return isExtendedWindowsEnabled() && env.ONLY_DOCS == "false"}
}
}
failFast false
matrix {
agent {label "${PLATFORM} && windows-immutable"}
options { skipDefaultCheckout() }
axes {
axis {
name 'PLATFORM'
values 'windows-8', 'windows-10', 'windows-11'
}
}
stages {
stage('build'){
options { skipDefaultCheckout() }
steps {
withGithubNotify(context: "Build-${PLATFORM}") {
deleteDir()
unstashV2(name: 'source', bucket: "${JOB_GCS_BUCKET}", credentialsId: "${JOB_GCS_CREDENTIALS}")
withMageEnv(){
dir("${BASE_DIR}"){
cmd(label: 'Go build', script: 'mage build')
}
}
}
}
}
stage('Test') {
options { skipDefaultCheckout() }
steps {
withGithubNotify(context: "Test-${PLATFORM}") {
withMageEnv(){
dir("${BASE_DIR}"){
withEnv(["TEST_COVERAGE=${isCodeCoverageEnabled()}"]) {
cmd(label: 'Go unitTest', script: 'mage unitTest')
}
}
}
}
}
post {
always {
junit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/build/TEST-*.xml")
whenTrue(isCodeCoverageEnabled()) {
coverageReport(baseDir: "**/build", reportFiles: 'TEST-go-unit.html', coverageFiles: 'TEST-go-unit-cov.xml')
}
}
}
}
}
}
}
}
post {
cleanup {
Expand Down Expand Up @@ -374,3 +439,10 @@ def isE2eEnabled() {
def isPackageEnabled() {
return env.PACKAGING_CHANGES == "true" || env.GITHUB_COMMENT?.contains('package') || matchesPrLabel(label: 'ci:package')
}

/**
* Wrapper to know if the build should enable the windows extended support
*/
def isExtendedWindowsEnabled() {
return env.EXT_WINDOWS_CHANGES == "true" || params.extended_windows_ci || env.GITHUB_COMMENT?.contains('extended windows') || matchesPrLabel(label: 'ci:extended-windows')
}

0 comments on commit 1f7245e

Please sign in to comment.