Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add extended support for windows #683

Merged
merged 3 commits into from
Aug 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -259,6 +264,66 @@ pipeline {
gitHubCheckSha1: env.GIT_BASE_COMMIT)
}
}
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 @@ -372,3 +437,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')
}