Skip to content
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
47 changes: 38 additions & 9 deletions .ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ pipeline {
deleteDir()
gitCheckout(basedir: "${BASE_DIR}", githubNotifyFirstTimeContributor: true)
stash allowEmpty: true, name: 'source', useDefaultExcludes: false
dir("${BASE_DIR}"){
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)' ], shouldMatchAll: false).toString())
}
}
}
stage('Lint'){
Expand All @@ -66,6 +71,17 @@ pipeline {
}
}
stage('Test') {
when {
// Always when running builds on branches/tags
// On a PR basis, skip if changes are only related to docs.
anyOf {
not { changeRequest() } // If no PR
allOf { // If PR and no docs changes
expression { return env.ONLY_DOCS == "false" }
changeRequest()
}
}
}
failFast false
matrix {
agent {label "${PLATFORM}"}
Expand Down Expand Up @@ -108,10 +124,15 @@ pipeline {
}
stage('K8s') {
when {
// TODO: Run only if changes in
// - "^deploy/kubernetes/.*"
// - "^version/docs/version.asciidoc"
Comment on lines -111 to -113
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expression { return env.PLATFORM == 'ubuntu-20.04 && immutable' }
// Always when running builds on branches/tags
// Enable if k8s related changes.
allOf {
expression { return env.PLATFORM == 'ubuntu-20.04 && immutable' }
anyOf {
not { changeRequest() } // If no PR
expression { return env.K8S_CHANGES == "true" }
}
}
}
steps {
runK8s(k8sVersion: 'v1.23.0', kindVersion: 'v0.11.1', context: "K8s-${PLATFORM}")
Expand All @@ -124,7 +145,8 @@ pipeline {
anyOf {
expression { return env.GITHUB_COMMENT?.contains('package') }
expression { matchesPrLabel(label: 'ci:package') }
// not { changeRequest() }
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover

not { changeRequest() }
expression { return env.PACKAGING_CHANGES == "true" }
}
// Run packaging only for the linux specific arch
expression { return (PLATFORM.contains('ubuntu') || PLATFORM.contains('aarch64')) }
Expand Down Expand Up @@ -170,10 +192,17 @@ pipeline {
}
stage('K8s') {
when {
// TODO: Run only if changes in
// - "^deploy/kubernetes/.*"
// - "^version/docs/version.asciidoc"
Comment on lines -173 to -175
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not { changeRequest() }
// Always when running builds on branches/tags
// On a PR basis, skip if changes are only related to docs.
// Enable if k8s related changes.
anyOf {
not { changeRequest() } // If no PR
allOf { // If PR and no docs changes
expression { return env.ONLY_DOCS == "false" }
changeRequest()
}
expression { return env.K8S_CHANGES == "true" } // If k8s changes
}
}
steps {
runAllK8s(["v1.23.0", "v1.22.0", "v1.21.1", "v1.20.7", "v1.19.11", "v1.18.19"])
Expand Down