forked from phacility/phabricator
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathtasks.py
68 lines (52 loc) · 1.66 KB
/
tasks.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import json
import os
from invoke import task
DOCKER_IMAGE_NAME = os.getenv('DOCKERHUB_REPO', 'mozilla/phabricator')
@task
def version(ctx):
"""Print version information in JSON format."""
print(json.dumps({
'moz_phabricator_commit':
os.getenv('CIRCLE_SHA1', None),
'moz_phabricator_version':
os.getenv('CIRCLE_SHA1', None),
'moz_phabricator_source':
'https://github.com/%s/%s' % (
os.getenv('CIRCLE_PROJECT_USERNAME', 'mozilla-conduit'),
os.getenv('CIRCLE_PROJECT_REPONAME', 'phabricator')
),
'build':
os.getenv('CIRCLE_BUILD_URL', None),
}))
@task
def build(ctx):
"""Build the docker image."""
ctx.run('docker build --pull -t {image_name} --target production .'.format(
image_name=DOCKER_IMAGE_NAME
))
@task
def imageid(ctx):
"""Print the built docker image ID."""
ctx.run("docker inspect -f '{format}' {image_name}".format(
image_name=DOCKER_IMAGE_NAME,
format='{{.Id}}'
))
@task
def buildtest(ctx):
"""Test phabricator extensions."""
ctx.run("docker compose build test_phab")
@task
def buildtestlocal(ctx):
"""Test phabricator extensions."""
ctx.run("docker compose build test_phab_local")
@task
def test(ctx):
"""Test phabricator extensions."""
ctx.run("docker compose run test_phab")
@task
def liberate(ctx):
"""Update phutil_map."""
ctx.run("docker compose run --rm test_phab arc_liberate")