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
import tornado.web | |
class BaseHandler(tornado.web.RequestHandler): | |
pass | |
def MetaClassFactory(function): | |
class MetaClass(type): | |
def __new__(meta, classname, bases, classDict): | |
newClassDict = {} |
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_JENKINS_SERVER= | |
ORIGINAL_SERVER_USER= | |
NEW_JENKINS_SERVER= | |
NEW_SERVER_USER= | |
# ON THE ORIGINAL JENKINS SERVER | |
ssh $ORIGINAL_SERVER_USER@$ORIGINAL_JENKINS_SERVER | |
cd /var/lib/jenkins/ | |
for i in `ls jobs`; do echo "jobs/$i/config.xml";done > config.totar |
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
#! /bin/sh | |
# directory that contains the jenkins.war | |
JENKINS_WAR_DIR=/usr/share/jenkins | |
# Absolute path the jenkins.war | |
JENKINS_WAR=${JENKINS_WAR_DIR}/jenkins.war | |
# Absolute path the jenkins.war for backup | |
JENKINS_BACKUP_WAR=/tmp/jenkins.war.bak |
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
$ sudo service jenkins stop | |
$ sudo jenkins_bak.sh restore /media/backup/jenkins-150123.tar | |
$ sudo service jenkins start |
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
/usr/sbin/groupadd -g 30119 jenkins | |
/usr/sbin/useradd -u 30119 -g jenkins jenkins | |
mkdir /home/jenkins | |
# Download Play! to /home/jenkins | |
chown -R jenkins. /home/jenkins |
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
#!/bin/bash | |
# @see http://www.ittybittytalks.com/commit-push-trigger-jenkins-build/ | |
git commit -a -m "$1" | |
git push | |
curl --user <your_jenkins_username>:<your_jenkins_API_key> http://<jenkins_server_url>/job/<your_jenkins_job_name>/build |
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
from bzrlib import branch | |
import urllib | |
JENKINS_URL = 'http://.....' | |
def post_change_branch_tip_hook(push_result): | |
urllib.openurl(JENKINS_URL) | |
branch.Branch.hooks.install_named_hook('post_change_branch_tip', | |
post_change_branch_tip_hook, 'Jenkins build hook') |
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
__author__ = 'wehappyfew' | |
# the url of jenkins config.xml | |
jenkins_url = 'http://11.11.111.11:8686/job/TheJob/config.xml' | |
j_user = "someone" | |
j_pass = "somepass" | |
def get_jenkins_branch_name(jenkins_url, j_user, j_pass): | |
""" |
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
import jenkinsapi | |
from jenkinsapi.jenkins import Jenkins | |
jk = Jenkins('http://qa-dev.intra.douban.com:9999/') | |
job = jk.get_job('test_peters_master') | |
lb = job.get_last_build() | |
url = lb.python_api_url(lb.baseurl) | |
data = lb.get_data(url) | |
print data['culprits'], data['builtOn'] |
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") |
OlderNewer