This repository has been 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
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
152 additions
and
0 deletions.
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 |
---|---|---|
@@ -0,0 +1,152 @@ | ||
# Copyright (c) 2017-2018 Red Hat, Inc. All rights reserved. This copyrighted | ||
# material is made available to anyone wishing to use, modify, copy, or | ||
# redistribute it subject to the terms and conditions of the GNU General | ||
# Public License v.2 or later. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
# details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software Foundation, Inc., | ||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
|
||
|
||
class DirectBuild(object): | ||
"""Direct test build""" | ||
|
||
def __init__(self, baserepo=None, ref=None, baseconfig=None, | ||
message_id=None, subject=None, emails=set(), | ||
patch_url_list=[], makeopts=None): | ||
""" | ||
Initialize a direct test build. | ||
Args: | ||
baserepo: Baseline Git repo URL. | ||
ref: Baseline Git reference to test. | ||
baseconfig: Kernel configuration URL. | ||
message_id: Value of the "Message-Id" header of the e-mail | ||
message representing the patchset, or None if | ||
unknown. | ||
subject: Subject of the message representing the patchset, | ||
or None if unknown. | ||
emails: Set of e-mail addresses involved with the patchset | ||
to send notifications to. | ||
patch_url_list: List of URLs pointing to patches to apply. | ||
makeopts: String of extra arguments to pass to the build's | ||
make invocation. | ||
""" | ||
|
||
|
||
class Direct(object): | ||
"""Direct test build scheduler""" | ||
|
||
def __init__(self): | ||
""" | ||
Initialize a Jenkins interface. | ||
""" | ||
self. | ||
|
||
def get_base_commitdate(self, buildid): | ||
""" | ||
Get base commit's committer date of the specified completed build. | ||
Wait for the build to complete, if it hasn't yet. | ||
Args: | ||
buildid: Jenkins build ID. | ||
Return: | ||
The epoch timestamp string of the committer date. | ||
""" | ||
|
||
def get_base_hash(self, buildid): | ||
""" | ||
Get base commit's hash of the specified completed build. | ||
Wait for the build to complete, if it hasn't yet. | ||
Args: | ||
buildid: Jenkins build ID. | ||
Return: | ||
The base commit's hash string. | ||
""" | ||
|
||
def get_patch_url_list(self, buildid): | ||
""" | ||
Get the list of Patchwork patch URLs for the specified completed | ||
build. Wait for the build to complete, if it hasn't yet. | ||
Args: | ||
buildid: Jenkins build ID. | ||
Return: | ||
The list of Patchwork patch URLs. | ||
""" | ||
|
||
def get_result_url(self, buildid): | ||
""" | ||
Get the URL of the web representation of the specified build. | ||
Args: | ||
buildid: Jenkins build ID. | ||
Result: | ||
The URL of the build result. | ||
""" | ||
|
||
def get_result(self, buildid): | ||
""" | ||
Get result code (sktm.misc.tresult) for the specified build. | ||
Wait for the build to complete, if it hasn't yet. | ||
Args: | ||
buildid: Jenkins build ID. | ||
Result: | ||
The build result code (sktm.misc.tresult). | ||
""" | ||
|
||
def build(self, baserepo=None, ref=None, baseconfig=None, | ||
message_id=None, subject=None, emails=set(), patch_url_list=[], | ||
makeopts=None): | ||
""" | ||
Submit a build of a patchset. | ||
Args: | ||
baserepo: Baseline Git repo URL. | ||
ref: Baseline Git reference to test. | ||
baseconfig: Kernel configuration URL. | ||
message_id: Value of the "Message-Id" header of the e-mail | ||
message representing the patchset, or None if | ||
unknown. | ||
subject: Subject of the message representing the patchset, | ||
or None if unknown. | ||
emails: Set of e-mail addresses involved with the patchset | ||
to send notifications to. | ||
patch_url_list: List of URLs pointing to patches to apply. | ||
makeopts: String of extra arguments to pass to the build's | ||
make invocation. | ||
Returns: | ||
Submitted build number. | ||
""" | ||
job = DirectJob(baserepo=baserepo, ref=ref, | ||
baseconfig=baseconfig, | ||
message_id=message_id, subject=subject, emails=emails, | ||
patch_url_list=patch_url_list, | ||
makeopts=makeopts) | ||
pid = job.get_pid() | ||
self.job_map[pid] = job | ||
return pid | ||
|
||
def is_build_complete(self, buildid): | ||
""" | ||
Check if a project build is still running. | ||
Args: | ||
buildid: Jenkins build ID to get the status of. | ||
Return: | ||
True if the build is still running. | ||
""" |