Browse Source

provide deployment script using fabric

tags/sipwise-2.4
Michael Prokop 10 years ago
parent
commit
7b3c49ed04
2 changed files with 50 additions and 0 deletions
  1. +10
    -0
      Makefile
  2. +40
    -0
      fabfile.py

+ 10
- 0
Makefile View File

@@ -14,4 +14,14 @@ install: $(scripts)
mkdir -p $(DESTDIR)/usr/share/jenkins-debian-glue/examples/
install -m 0664 examples/* $(DESTDIR)/usr/share/jenkins-debian-glue/examples/

deploy:
fab all

clean:
rm -f fabfile.pyc
# avoid recursion via debian/rules clean, so manually rm:
rm -f debian/files debian/jenkins-debian-glue.debhelper.log
rm -f debian/jenkins-debian-glue.substvars
rm -rf debian/jenkins-debian-glue/

.PHONY: build install

+ 40
- 0
fabfile.py View File

@@ -0,0 +1,40 @@
################################################################################
# Deploy Debian package to jenkins build system(s)
#
# Usage examples:
# % fab all
# % fab build && fab deploy
# % fab -H root@jenkins.example.org deploy
################################################################################

from fabric.api import *
import os, paramiko, sys

def set_hosts():
if not env.hosts:
env.hosts = []

for host in 'jenkins', 'jenkins-slave1', 'jenkins-slave2':
config = paramiko.SSHConfig()
config.parse(open(os.path.expandvars("$HOME") + '/.ssh/config'))
h = config.lookup(host)
env.hosts.append(h['user'] + "@" + h['hostname'])

return env.hosts

@runs_once
def build():
local('rm -f ../jenkins-debian-glue_*all.deb')
local('fakeroot debian/rules clean')
local('fakeroot debian/rules binary')

@hosts(set_hosts())
def deploy():
put('../jenkins-debian-glue_*all.deb', '~/')
run('dpkg -i ~/jenkins-debian-glue_*all.deb')

def all():
build()
deploy()

## END OF FILE #################################################################

Loading…
Cancel
Save