-
-
Save alexmerser/0a3d768f0fd47348aa4a to your computer and use it in GitHub Desktop.
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
def build_jenkins(j_url="http://11.11.11.11:8686/", job_name='SuperJob'): | |
""" | |
Build the current branch of a provided job | |
""" | |
import time | |
from jenkins import Jenkins, JenkinsError | |
# http://jenkins-webapi.readthedocs.org/en/latest/ | |
j = Jenkins(j_url, j_user, j_pass) | |
j.job_build(job_name) ; print("\nBuild command sent!\n") | |
print("Wait for the build to complete....") ; time.sleep(15) | |
last_b = j.job_last_build(job_name) | |
last_successful_b = j.job_last_successful_build(job_name) | |
print "Checking last build ... " | |
print "Last build : %s" % last_b.number | |
print "Last successful build : %s" % last_successful_b.number, "\n" | |
# time.sleep(10) | |
if last_b.number == last_successful_b.number: | |
print "-- Build success --" | |
else: | |
print "Failed build :[" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment