forked from mozilla/commbadge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
53 lines (39 loc) · 1.22 KB
/
fabfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import os
from fabric.api import env, execute, lcd, local, parallel, roles, task
from fabdeploytools.rpm import RPMBuild
import fabdeploytools.envs
import deploysettings as settings
env.key_filename = settings.SSH_KEY
fabdeploytools.envs.loadenv(os.path.join('/etc/deploytools/envs',
settings.CLUSTER))
COMMBADGE = os.path.dirname(__file__)
ROOT = os.path.dirname(COMMBADGE)
@task
def pre_update(ref):
with lcd(COMMBADGE):
local('git fetch')
local('git fetch -t')
local('git reset --hard %s' % ref)
@task
def update():
with lcd(COMMBADGE):
local('npm install')
local('npm install -g commonplace')
local('commonplace includes')
@task
@roles('web')
@parallel
def _install_package(rpmbuild):
rpmbuild.install_package()
@task
def deploy():
with lcd(COMMBADGE):
ref = local('git rev-parse HEAD', capture=True)
rpmbuild = RPMBuild(name='commbadge',
env=settings.ENV,
ref=ref,
cluster=settings.CLUSTER,
domain=settings.DOMAIN)
rpmbuild.build_rpm(ROOT, ['commbadge'])
execute(_install_package, rpmbuild)
rpmbuild.clean()