Skip to content

Instantly share code, notes, and snippets.

; Sample supervisor config file.
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
;chmod=0700 ; sockef file mode (default 0700)
;chown=nobody:nogroup ; socket file uid:gid owner
;username=user ; (default is no username (open server))
;password=123 ; (default is no password (open server))
;[inet_http_server] ; inet (TCP) server disabled by default
import os
import subprocess
#import argparse
import sys
from time import sleep
#parser = argparse.ArgumentParser(description='Build script for creating VM and running tests against it.')
#parser.add_argument('user', metavar='U', type=str, nargs='+',
# help='The user of the hostmachine. Required to create the VM through SSH.')
#parser.add_argument('host', metavar='H', type=str, nargs='+',
#!/usr/bin/python
# -*- coding: utf-8
import ConfigParser
import argparse
import getpass
import os
import shlex
import subprocess
import sys
#!/bin/bash
# As root ( via `sudo su -` ):
# Initialize ephemeral storage
curl https://gist.githubusercontent.com/fsultan/9936494/raw/ephemeral > /etc/init.d/ephemeral
chmod +x /etc/init.d/ephemeral
ln -s ../init.d/ephemeral /etc/rcS.d/S10ephemeral
/etc/init.d/ephemeral
ln -s /mnt/jenkins /var/jenkins
#ln -s /mnt/mongodb /var/lib/mongodb
#!/usr/bin/env python
#-*-coding:utf-8-*-
import urllib, json , os
from shutil import rmtree
url = 'http://yourjenkinsbaseurl/api/python?pretty=true'
jenkins_workspace_path = '/var/lib/jenkins/workspaces/'
data = eval(urllib.urlopen(url).read())
jobnames = []
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")
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']
__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):
"""
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')
#!/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