Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Also support special build:
firstBuild
lastBuild
lastStableBuild
lastSuccessfulBuild
lastCompletedBuild
lastFailedBuild
"""
# if build_number is not int, maybe it is like "lastStableBuild"
if not isinstance(build_number, int):
build_number = self._get_build_number(build_number)
url = self.builds.get(build_number)
if not url:
if build_number >= self.next_number:
raise exception.NoBuildData(build_number)
else:
raise exception.DeletedBuild(build_number)
return self.job.jenkins.PromotionBuild(url, build_number, promotion=self, depth=depth)
Also support special build:
firstBuild
lastBuild
lastStableBuild
lastSuccessfulBuild
lastCompletedBuild
lastFailedBuild
"""
# if build_number is not int, maybe it is like "lastStableBuild"
if not isinstance(build_number, int):
build_number = self._get_build_number(build_number)
url = self.builds.get(build_number)
if not url:
if build_number >= self.next_build_number:
raise exception.NoBuildData(build_number)
else:
raise exception.DeletedBuild(build_number)
return self.jenkins.Build(url, build_number, job=self, depth=depth)
Promotion = _promotion.Promotion
# import exceptions
Error = _exception.Error
NotRunningOnJenkins = _exception.NotRunningOnJenkins
BadParam = _exception.BadParam
ParamTypeError = _exception.ParamTypeError
BadValue = _exception.BadValue
RunTimeout = _exception.RunTimeout
NotFound = _exception.NotFound
UnknownNode = _exception.UnknownNode
UnknownJob = _exception.UnknownJob
UnknownPromotion = _exception.UnknownPromotion
UnknownQueueItem = _exception.UnknownQueueItem
NotBuiltYet = _exception.NotBuiltYet
NoBuildData = _exception.NoBuildData
DeletedBuild = _exception.DeletedBuild
NoArtifacts = _exception.NoArtifacts
JenkinsAPIError = _exception.JenkinsAPIError
UnsupportedAPI = _exception.UnsupportedAPI
NotStopYet = _exception.NotStopYet
ImappropriateMethod = _exception.ImappropriateMethod
ImappropriateMethodInStaticMode = _exception.ImappropriateMethodInStaticMode
NotImplementedMethod = _exception.NotImplementedMethod
OSIOError = _exception.OSIOError
RequestError = _exception.RequestError
PostRequired = _exception.PostRequired
InvalidRequestStatus = _exception.InvalidRequestStatus
UnauthorizedError = _exception.UnauthorizedError
NetworkError = _exception.NetworkError
FtpError = _exception.FtpError
"""get special build number by type.
Args:
build_type:
firstBuild
lastBuild
lastStableBuild
lastSuccessfulBuild
lastCompletedBuild
lastFailedBuild
"""
data = self.poll(tree='%s[number]' % build_type)
info = data.get(build_type)
if not info:
raise exception.NoBuildData(build_type)
return info["number"]