示例#1
0
文件: remote.py 项目: CodeJuan/noel
def add_git_remote(remote_name, remote_url):
    """Adds a given remote to the repository in the current directory."""
    call(
        'git',
        'remote',
        'add',
        remote_name,
        remote_url)
示例#2
0
def push(tag_name, use_gcloud=False):
    """Pushes an image to a repository.

    Because Noel uses Google Container Registry, this has logic to use the
    Google Cloud SDK to push the image. If you're not using GCR, you'll need
    to make sure login is called before calling this.
    """

    if not use_gcloud:
        call('docker', 'push', tag_name)
    else:
        # When not on GCE/GKE, use gcloud to push. gcloud will handle
        # authentication.
        call('gcloud', 'docker', 'push', tag_name)
示例#3
0
文件: docker.py 项目: CodeJuan/noel
def push(tag_name, use_gcloud=False):
    """Pushes an image to a repository.

    Because Noel uses Google Container Registry, this has logic to use the
    Google Cloud SDK to push the image. If you're not using GCR, you'll need
    to make sure login is called before calling this.
    """

    if not use_gcloud:
        call('docker', 'push', tag_name)
    else:
        # When not on GCE/GKE, use gcloud to push. gcloud will handle
        # authentication.
        call('gcloud', 'docker', 'push', tag_name)
示例#4
0
文件: shell.py 项目: rmoorman/noel
def do_receive(path):
    adjusted_path = os.path.join('~', path)

    if not os.path.exists(path):
        create_repository(os.environ['HOME'], path)

    return call('/bin/bash', '-c',
                'git-receive-pack \'{}\''.format(adjusted_path))
示例#5
0
文件: shell.py 项目: CodeJuan/noel
def do_receive(path):
    adjusted_path = os.path.join('~', path)

    if not os.path.exists(path):
        create_repository(os.environ['HOME'], path)

    return call('/bin/bash', '-c', 'git-receive-pack \'{}\''.format(
        adjusted_path))
示例#6
0
def get_project_id():
    """Gets the google cloud project either via the GCE metadata service or
    the Google Cloud SDK."""
    project_id = get_gce_project_id()

    if project_id:
        return project_id

    return call(
        'gcloud',
        'config',
        'list',
        'project',
        '--format=value(core.project)',
        silent=True).strip().split('\n').pop()
示例#7
0
文件: shell.py 项目: rmoorman/noel
def create_repository(repo_root, name):
    path = os.path.join(repo_root, name)
    hook_path = os.path.join(path, 'hooks', 'post-receive')
    os.makedirs(path)
    call('git', 'init', '--bare', path, silent=True)

    with open(hook_path, 'w') as f:
        f.write(RECEIVE_HOOK)

    call('chmod', '+x', hook_path, silent=True)
    call('chown', '-R', 'git:git', path, silent=True)
示例#8
0
文件: shell.py 项目: CodeJuan/noel
def create_repository(repo_root, name):
    path = os.path.join(repo_root, name)
    hook_path = os.path.join(path, 'hooks', 'post-receive')
    os.makedirs(path)
    call('git', 'init', '--bare', path, silent=True)

    with open(hook_path, 'w') as f:
        f.write(RECEIVE_HOOK)

    call('chmod', '+x', hook_path, silent=True)
    call('chown', '-R', 'git:git', path, silent=True)
示例#9
0
def checkout_repo(staging_dir):
    if not os.path.exists(staging_dir):
        os.makedirs(staging_dir)

    call('git', '--work-tree', staging_dir, 'checkout', '-f')
示例#10
0
文件: remote.py 项目: rmoorman/noel
def add_git_remote(remote_name, remote_url):
    """Adds a given remote to the repository in the current directory."""
    call('git', 'remote', 'add', remote_name, remote_url)
示例#11
0
def login(host, token):
    call('docker', 'login', '-e', '*****@*****.**', '-u', '_token', '-p', token,
         host)
示例#12
0
def build(tag_name, context_dir):
    call('docker', 'build', '-t', tag_name, context_dir)
示例#13
0
文件: docker.py 项目: CodeJuan/noel
def login(host, token):
    call('docker', 'login', '-e', '*****@*****.**', '-u', '_token',
         '-p', token, host)
示例#14
0
文件: docker.py 项目: CodeJuan/noel
def build(tag_name, context_dir):
    call('docker', 'build', '-t', tag_name, context_dir)
示例#15
0
文件: shell.py 项目: rmoorman/noel
def do_upload(path):
    adjusted_path = os.path.join('~', path)
    return call('/bin/bash', '-c',
                'git-upload-pack-pack \'{}\''.format(adjusted_path))
示例#16
0
文件: shell.py 项目: CodeJuan/noel
def do_upload(path):
    adjusted_path = os.path.join('~', path)
    return call('/bin/bash', '-c', 'git-upload-pack-pack \'{}\''.format(
        adjusted_path))