예제 #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))