-
Notifications
You must be signed in to change notification settings - Fork 92
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
DNM: Combine ceph-pull-requests and API jobs #1657
Open
djgalloway
wants to merge
2
commits into
main
Choose a base branch
from
wip-make-api-pipeline
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
- job: | ||
disabled: true | ||
name: ceph-api | ||
project-type: freestyle | ||
defaults: global | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
github_status_setup | ||
|
||
# the following two methods exist in scripts/build_utils.sh | ||
pkgs=( "github-status>0.0.3" ) | ||
install_python_packages "pkgs[@]" | ||
GITHUB_STATUS_STATE="pending" $VENV/github-status create |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
github_status_setup | ||
|
||
# the following two methods exist in scripts/build_utils.sh | ||
pkgs=( "github-status>0.0.3" ) | ||
install_python_packages "pkgs[@]" | ||
GITHUB_STATUS_STATE="success" $VENV/github-status create |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
github_status_setup | ||
|
||
# the following two methods exist in scripts/build_utils.sh | ||
pkgs=( "github-status>0.0.3" ) | ||
install_python_packages "pkgs[@]" | ||
|
||
# The end of the build/make-check/build writes this sentinel file if `make check` passes. | ||
if [[ -f "$WORKSPACE/.makecheckpassed" ]]; then | ||
GITHUB_STATUS_CONTEXT="ceph PR - API tests" | ||
else | ||
GITHUB_STATUS_CONTEXT="ceph PR - make check" | ||
fi | ||
GITHUB_STATUS_STATE="failure" $VENV/github-status create |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
github_status_setup | ||
|
||
# the following two methods exist in scripts/build_utils.sh | ||
pkgs=( "github-status>0.0.3" ) | ||
install_python_packages "pkgs[@]" | ||
GITHUB_STATUS_STATE="pending" $VENV/github-status create | ||
|
||
export NPROC=$(nproc) | ||
export WITH_SEASTAR=true | ||
timeout 3h ./run-make-check.sh | ||
sleep 5 | ||
ps -ef | grep -v jnlp | grep ceph || true | ||
|
||
# This is so ugly but in order for github-status to know if `make check` or API tests failed in the postbuildscript, the ceph-pr-combined/build/failure script can check for this sentinel file. | ||
touch $WORKSPACE/.makecheckpassed | ||
|
||
GITHUB_STATUS_STATE="success" $VENV/github-status create |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
set -ex | ||
|
||
# set up variables needed for | ||
# githubstatus to report back to the github PR | ||
# if this project was started manually | ||
github_status_setup | ||
|
||
# the following two methods exist in scripts/build_utils.sh | ||
pkgs=( "github-status>0.0.3" ) | ||
install_python_packages "pkgs[@]" | ||
|
||
# The github-status project checks if a job was triggered by github-pull-request-builder and will not updated PR statuses if it was. | ||
# This is because github-pull-request-builder already updates PR statuses. However, we can't set stages in the status message. | ||
# So I'm unsetting the ghprb vars to trick github-status into running. | ||
# https://github.com/alfredodeza/github-status/blob/master/github_status/util.py | ||
for var in ghprbActualCommit ghprbTriggerAuthor ghprbTargetBranch ghprbTriggerAuthorLogin ghprbCredentialsId ghprbGhRepository; do | ||
unset $var | ||
done |
135 changes: 135 additions & 0 deletions
135
ceph-pr-combined/config/definitions/ceph-pr-combined.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
- job: | ||
name: ceph-pr-combined | ||
description: 'make check and ceph API tests combined' | ||
project-type: freestyle | ||
defaults: global | ||
concurrent: true | ||
node: huge && bionic && x86_64 && !xenial && !trusty | ||
display-name: 'ceph PRs: make check and API tests' | ||
quiet-period: 5 | ||
block-downstream: false | ||
block-upstream: false | ||
retry-count: 3 | ||
properties: | ||
- build-discarder: | ||
days-to-keep: 15 | ||
num-to-keep: 300 | ||
artifact-days-to-keep: -1 | ||
artifact-num-to-keep: -1 | ||
- github: | ||
url: https://github.com/ceph/ceph/ | ||
- rebuild: | ||
auto-rebuild: true | ||
- inject: | ||
properties-content: | | ||
TERM=xterm | ||
|
||
parameters: | ||
- string: | ||
name: ghprbPullId | ||
description: "the GitHub pull id, like '72' in 'ceph/pull/72'" | ||
|
||
triggers: | ||
- github-pull-request: | ||
cancel-builds-on-update: true | ||
allow-whitelist-orgs-as-admins: true | ||
org-list: | ||
- ceph | ||
white-list-target-branches: | ||
- master | ||
- octopus | ||
- nautilus | ||
trigger-phrase: '^jenkins test make check|^jenkins test pr.*|^jenkins retest.*|^jenkins test api' | ||
skip-build-phrase: '^jenkins do not test.*' | ||
only-trigger-phrase: false | ||
github-hooks: true | ||
permit-all: true | ||
auto-close-on-fail: false | ||
# The option below requires jenkins-job-builder>=3.5.0 | ||
no-commit-status: true | ||
# I had hoped to get these working by running 'make check' and the API tests in the same job | ||
# and somehow changing {stage} throughout the job but that doesn't appear to be possible. | ||
# So I'm using github.com/alfredodeza/github-status | ||
# status-context: "ceph PR: {stage}" | ||
# started-status: "ceph PR: {stage} running" | ||
# success-status: "ceph PR: {stage} succeeded" | ||
# failure-status: "ceph PR: {stage} failed" | ||
|
||
scm: | ||
- git: | ||
url: https://github.com/ceph/ceph.git | ||
branches: | ||
- ${sha1} | ||
refspec: +refs/pull/${ghprbPullId}/*:refs/remotes/origin/pr/${ghprbPullId}/* | ||
browser: auto | ||
timeout: 20 | ||
skip-tag: true | ||
shallow-clone: true | ||
wipe-workspace: true | ||
|
||
## TODO: (maybe) I'm sure there's a cleaner/prettier way to do this. Maybe doing an actual Jenkins pipeline. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is a great improvement in terms of resource usage, and Jenkins pipelines will definitely improve also the reporting of the different stages. If you need any help for a next PR, I'll gladly volunteer for helping bring pipelines into Ceph. |
||
builders: | ||
- inject: | ||
properties-content: | | ||
GITHUB_REPOSITORY="ceph/ceph" | ||
GITHUB_STATUS_CONTEXT="ceph PR - make check" | ||
GITHUB_STATUS_STARTED="running" | ||
GITHUB_STATUS_SUCCESS="OK" | ||
GITHUB_STATUS_FAILURE="failed" | ||
GITHUB_STATUS_ERROR="completed with errors" | ||
GITHUB_SHA=${ghprbActualCommit} | ||
- shell: | ||
!include-raw: | ||
- ../../../scripts/build_utils.sh | ||
- ../../build/setup | ||
- ../../build/make-check/build | ||
- inject: | ||
properties-content: | | ||
GITHUB_REPOSITORY="ceph/ceph" | ||
GITHUB_STATUS_CONTEXT="ceph PR - API tests" | ||
GITHUB_STATUS_STARTED="running" | ||
GITHUB_STATUS_SUCCESS="OK" | ||
GITHUB_STATUS_FAILURE="failed" | ||
GITHUB_STATUS_ERROR="completed with errors" | ||
GITHUB_SHA=${ghprbActualCommit} | ||
- shell: | ||
!include-raw: | ||
- ../../../scripts/build_utils.sh | ||
- ../../build/setup | ||
- ../../build/api/start | ||
- ../../../scripts/dashboard/install-backend-api-test-deps.sh | ||
- shell: "cd src/pybind/mgr/dashboard; timeout 7200 ./run-backend-api-tests.sh" | ||
- shell: | ||
!include-raw: | ||
- ../../../scripts/build_utils.sh | ||
- ../../build/setup | ||
- ../../build/api/success | ||
|
||
publishers: | ||
- postbuildscript: | ||
builders: | ||
- role: SLAVE | ||
build-on: | ||
- FAILURE | ||
- ABORTED | ||
build-steps: | ||
- inject: | ||
properties-content: | | ||
GITHUB_REPOSITORY="ceph/ceph" | ||
GITHUB_STATUS_STARTED="running" | ||
GITHUB_STATUS_SUCCESS="OK" | ||
GITHUB_STATUS_FAILURE="failed" | ||
GITHUB_STATUS_ERROR="completed with errors" | ||
GITHUB_SHA=${ghprbActualCommit} | ||
- shell: | ||
!include-raw: | ||
- ../../../scripts/build_utils.sh | ||
- ../../build/setup | ||
- ../../build/failure | ||
|
||
wrappers: | ||
- ansicolor | ||
- credentials-binding: | ||
- text: | ||
credential-id: 8dff73ff-506c-4397-969d-023f15aedea9 | ||
variable: GITHUB_OAUTH_TOKEN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
- job: | ||
disabled: true | ||
name: ceph-pull-requests | ||
project-type: freestyle | ||
defaults: global | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this would imply much change to everything else, but we might keep the Jenkins Job Builder YAML syntax while introducing
project-type: pipeline
...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm sure in the future we can streamline this job by making pipeline. The two troubles I had with that were
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!