~andrewjbeach/juju-ci-tools/make-local-patcher

« back to all changes in this revision

Viewing changes to run_deploy_job_wr.py

  • Committer: John George
  • Date: 2015-01-14 22:03:47 UTC
  • mto: This revision was merged to the branch mainline in revision 798.
  • Revision ID: john.george@canonical.com-20150114220347-e8q5wezs1qg9a00u
Added support for setting the juju path, series and agent_url.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
import json
3
 
import os
4
 
from os.path import join
5
 
import subprocess
6
 
import sys
7
 
from tempfile import NamedTemporaryFile
8
 
 
9
 
 
10
 
def main():
11
 
    revision_build = os.environ['revision_build']
12
 
    job_name = os.environ['JOB_NAME']
13
 
    build_number = os.environ['BUILD_NUMBER']
14
 
    prefix = 'juju-ci/products/version-{}/{}/build-{}'.format(
15
 
        revision_build, job_name, build_number)
16
 
    s3_config = join(os.environ['HOME'], 'cloud-city/juju-qa.s3cfg')
17
 
    command = [
18
 
        '$HOME/juju-ci-tools/run-deploy-job-remote.bash',
19
 
        revision_build,
20
 
        job_name,
21
 
        ]
22
 
    command.extend(sys.argv[2:])
23
 
    with NamedTemporaryFile() as config_file:
24
 
        json.dump({
25
 
            'command': command, 'install': {},
26
 
            'artifacts': {'artifacts': [
27
 
                'artifacts/machine*/*log*',
28
 
                'artifacts/*.jenv',
29
 
                'artifacts/cache.yaml',
30
 
                'artifacts/*.json',
31
 
                ]},
32
 
            'bucket': 'juju-qa-data',
33
 
            }, config_file)
34
 
        config_file.flush()
35
 
        subprocess.check_call([
36
 
            'workspace-run', config_file.name, sys.argv[1], prefix,
37
 
            '--s3-config', s3_config, '-v',
38
 
            ])
39
 
 
40
 
if __name__ == '__main__':
41
 
    main()