This repository was archived by the owner on Sep 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Misc improvements mostly Jenkins #113
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
37e2ce2
Rename class tresult to TestResult, and move into sktm.misc
danghai 67a4c00
Convert Jenkins interface to Jenkins project interface
danghai 94adc08
Spell out patch URL list in sktm.jenkins
danghai 6a92aba
Specify patch order for patch_url_list args
danghai 0e55b3e
Document sktm.jenkins.Project.is_build_complete()
danghai d9b6c0e
Create Jenkins project interface outside watcher
danghai 390543a
Describe sktm.jenkins.get_result* functions
danghai 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 hidden or 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 |
|---|---|---|
|
|
@@ -22,7 +22,9 @@ | |
|
|
||
| import sktm.db | ||
| import sktm.jenkins | ||
| import sktm.misc | ||
| import sktm.patchwork | ||
| import sktm.jenkins | ||
|
|
||
|
|
||
| def join_with_slash(base, *suffix): | ||
|
|
@@ -43,15 +45,6 @@ def join_with_slash(base, *suffix): | |
| return '/'.join(parts) + ending | ||
|
|
||
|
|
||
| class tresult(enum.IntEnum): | ||
| """Test result""" | ||
| ERROR = -1 | ||
| SUCCESS = 0 | ||
| MERGE_FAILURE = 1 | ||
| BUILD_FAILURE = 2 | ||
| TEST_FAILURE = 4 | ||
|
|
||
|
|
||
| class jtype(enum.IntEnum): | ||
| """Job type""" | ||
| BASELINE = 0 | ||
|
|
@@ -60,16 +53,11 @@ class jtype(enum.IntEnum): | |
|
|
||
| # TODO This is no longer just a watcher. Rename/refactor/describe accordingly. | ||
| class watcher(object): | ||
| def __init__(self, jenkinsurl, jenkinslogin, jenkinspassword, | ||
| jenkinsjobname, dbpath, patch_filter, makeopts=None): | ||
| def __init__(self, jenkins_project, dbpath, patch_filter, makeopts=None): | ||
| """ | ||
| Initialize a "watcher". | ||
|
|
||
| Args: | ||
| jenkinsurl: Jenkins instance URL. | ||
| jenkinslogin: Jenkins user name. | ||
| jenkinspassword: Jenkins user password. | ||
| jenkinsjobname: Name of the Jenkins job to trigger and watch. | ||
| dbpath: Path to the job status database file. | ||
| patch_filter: The name of a patch series filter program. | ||
| The program should accept a list of mbox URLs | ||
|
|
@@ -87,10 +75,7 @@ def __init__(self, jenkinsurl, jenkinslogin, jenkinspassword, | |
| # Database instance | ||
| self.db = sktm.db.SktDb(os.path.expanduser(dbpath)) | ||
| # Jenkins interface instance | ||
| self.jk = sktm.jenkins.skt_jenkins(jenkinsurl, jenkinslogin, | ||
| jenkinspassword) | ||
| # Jenkins project name | ||
| self.jobname = jenkinsjobname | ||
| self.jk = jenkins_project | ||
| # Patchset filter program | ||
| self.patch_filter = patch_filter | ||
| # Extra arguments to pass to "make" | ||
|
|
@@ -198,8 +183,7 @@ def add_pw(self, baseurl, pname, lpatch=None, apikey=None, skip=[]): | |
| def check_baseline(self): | ||
| """Submit a build for baseline""" | ||
| self.pj.append((sktm.jtype.BASELINE, | ||
| self.jk.build(self.jobname, | ||
| baserepo=self.baserepo, | ||
| self.jk.build(baserepo=self.baserepo, | ||
| ref=self.baseref, | ||
| baseconfig=self.cfgurl, | ||
| makeopts=self.makeopts), | ||
|
|
@@ -329,38 +313,37 @@ def check_patchwork(self): | |
| self.db.set_patchset_pending(cpw.baseurl, cpw.project_id, | ||
| series.get_patch_info_list()) | ||
| # Submit and remember a Jenkins build for the series | ||
| url_list = series.get_patch_url_list() | ||
|
Contributor
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. Same here, could you please use |
||
| self.pj.append((sktm.jtype.PATCHWORK, | ||
| self.jk.build( | ||
| self.jobname, | ||
| baserepo=self.baserepo, | ||
| ref=stablecommit, | ||
| baseconfig=self.cfgurl, | ||
| message_id=series.message_id, | ||
| subject=series.subject, | ||
| emails=series.email_addr_set, | ||
| patchwork=series.get_patch_url_list(), | ||
| patch_url_list=url_list, | ||
| makeopts=self.makeopts), | ||
| cpw)) | ||
| logging.info("submitted message ID: %s", series.message_id) | ||
| logging.info("submitted subject: %s", series.subject) | ||
| logging.info("submitted emails: %s", series.email_addr_set) | ||
| logging.info("submitted series: %s", | ||
| series.get_patch_url_list()) | ||
| logging.info("submitted series: %s", url_list) | ||
|
|
||
| def check_pending(self): | ||
| for (pjt, bid, cpw) in self.pj: | ||
| if self.jk.is_build_complete(self.jobname, bid): | ||
| bres = self.jk.get_result(self.jobname, bid) | ||
| rurl = self.jk.get_result_url(self.jobname, bid) | ||
| basehash = self.jk.get_base_hash(self.jobname, bid) | ||
| basedate = self.jk.get_base_commitdate(self.jobname, bid) | ||
| if self.jk.is_build_complete(bid): | ||
| bres = self.jk.get_result(bid) | ||
| rurl = self.jk.get_result_url(bid) | ||
| basehash = self.jk.get_base_hash(bid) | ||
| basedate = self.jk.get_base_commitdate(bid) | ||
|
|
||
| logging.info("job completed: " | ||
| "type=%d; jjid=%d; result=%s; url=%s", | ||
| pjt, bid, bres.name, rurl) | ||
| self.pj.remove((pjt, bid, cpw)) | ||
|
|
||
| if bres == sktm.tresult.ERROR: | ||
| if bres == sktm.misc.TestResult.ERROR: | ||
| logging.warning("job completed with an error, ignoring") | ||
| continue | ||
|
|
||
|
|
@@ -375,7 +358,7 @@ def check_pending(self): | |
| elif pjt == sktm.jtype.PATCHWORK: | ||
| patches = list() | ||
|
|
||
| patch_url_list = self.jk.get_patchwork(self.jobname, bid) | ||
| patch_url_list = self.jk.get_patch_url_list(bid) | ||
| for patch_url in patch_url_list: | ||
| patches.append(self.get_patch_info_from_url(cpw, | ||
| patch_url)) | ||
|
|
||
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
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.
A comment on the commit message: Could you update the message to say
sktm.jenkins.JenkinsProjectinstead ofsktm.jenkins.Project? Thank you.