Пример #1
0
def set_deployable():
    d = request.json
    target_ref = FQRef.from_json(d['target_ref'])
    action = d['action']
    assert action in ('unwatch', 'watch', 'deploy')
    prs.update_watch_state(target_ref, action)
    return '', 200
Пример #2
0
def set_deployable():
    d = request.json
    target_ref = FQRef.from_json(d['target_ref'])
    action = d['action']
    assert action in ('unwatch', 'watch', 'deploy')
    prs.update_watch_state(target_ref, action)
    return '', 200
Пример #3
0
def force_redeploy():
    d = request.json
    target = FQRef.from_json(d)
    if target in prs.watched_target_refs():
        prs.try_deploy(target)
        return '', 200
    else:
        return f'{target.short_str()} not in {[ref.short_str() for ref in prs.watched_target_refs()]}', 400
Пример #4
0
def force_redeploy():
    d = request.json
    target = FQRef.from_json(d)
    if target in prs.watched_target_refs():
        prs.try_deploy(target)
        return '', 200
    else:
        return f'{target.short_str()} not in {[ref.short_str() for ref in prs.watched_target_refs()]}', 400
Пример #5
0
def github_push():
    d = request.json
    ref = d['ref']
    if ref.startswith('refs/heads'):
        target_ref = FQRef(Repo.from_gh_json(d['repository']), ref[11:])
        target = FQSHA(target_ref, d['after'])
        prs.push(target)
    else:
        log.info(f'ignoring ref push {ref} because it does not start with '
                 '"refs/heads/"')
    return '', 200
Пример #6
0
import os
import uuid

INSTANCE_ID = uuid.uuid4().hex

SELF_HOSTNAME = os.environ.get('SELF_HOSTNAME',
                               'http://set_the_SELF_HOSTNAME/')
BATCH_SERVER_URL = os.environ.get('BATCH_SERVER_URL',
                                  'http://set_the_BATCH_SERVER_URL/')
REFRESH_INTERVAL_IN_SECONDS = \
    int(os.environ.get('REFRESH_INTERVAL_IN_SECONDS', 60))

CONTEXT = f'hail-ci-0-1'

try:
    WATCHED_TARGETS = [(FQRef.from_short_str(ref), deployable)
                       for [ref, deployable] in json.loads(
                           os.environ.get('WATCHED_TARGETS', '[]'))]
except Exception as e:
    raise ValueError(
        'environment variable WATCHED_TARGETS should be a json array of arrays of refs and deployability as '
        f'strings and booleans e.g. [["hail-is/hail:master", true]], but was: `{os.environ.get("WATCHED_TARGETS", None)}`',
    ) from e
try:
    with open('pr-build-script', 'r') as f:
        PR_BUILD_SCRIPT = f.read()
except FileNotFoundError as e:
    raise ValueError(
        "working directory must contain a file called `pr-build-script' "
        "containing a string that is passed to `/bin/sh -c'") from e
try:
Пример #7
0
def force_retest():
    d = request.json
    source = FQRef.from_json(d['source'])
    target = FQRef.from_json(d['target'])
    prs.build(source, target)
    return '', 200
Пример #8
0
from git_state import FQRef
from ci_logging import log
from batch.client import BatchClient
import json
import os

SELF_HOSTNAME = os.environ.get('SELF_HOSTNAME',
                               'http://set_the_SELF_HOSTNAME/')
BATCH_SERVER_URL = os.environ.get('BATCH_SERVER_URL',
                                  'http://set_the_BATCH_SERVER_URL/')
REFRESH_INTERVAL_IN_SECONDS = \
    int(os.environ.get('REFRESH_INTERVAL_IN_SECONDS', 60))

try:
    WATCHED_TARGETS = [
        (FQRef.from_short_str(ref), deployable)
        for [ref, deployable] in json.loads(os.environ.get('WATCHED_TARGETS', '[]'))
    ]
except Exception as e:
    raise ValueError(
        'environment variable WATCHED_TARGETS should be a json array of arrays of refs and deployability as '
        f'strings and booleans e.g. [["hail-is/hail:master", true]], but was: `{os.environ.get("WATCHED_TARGETS", None)}`',
    ) from e
try:
    with open('pr-build-script', 'r') as f:
        PR_BUILD_SCRIPT = f.read()
except FileNotFoundError as e:
    raise ValueError(
        "working directory must contain a file called `pr-build-script' "
        "containing a string that is passed to `/bin/sh -c'") from e
try:
Пример #9
0
def force_retest():
    d = request.json
    source = FQRef.from_json(d['source'])
    target = FQRef.from_json(d['target'])
    prs.build(source, target)
    return '', 200
Пример #10
0
import uuid

INSTANCE_ID = uuid.uuid4().hex

SELF_HOSTNAME = os.environ.get('SELF_HOSTNAME',
                               'http://set_the_SELF_HOSTNAME/')
BATCH_SERVER_URL = os.environ.get('BATCH_SERVER_URL',
                                  'http://set_the_BATCH_SERVER_URL/')
REFRESH_INTERVAL_IN_SECONDS = \
    int(os.environ.get('REFRESH_INTERVAL_IN_SECONDS', 60))

CONTEXT = f'hail-ci-0-1'

try:
    WATCHED_TARGETS = [
        (FQRef.from_short_str(ref), deployable)
        for [ref, deployable] in json.loads(os.environ.get('WATCHED_TARGETS', '[]'))
    ]
except Exception as e:
    raise ValueError(
        'environment variable WATCHED_TARGETS should be a json array of arrays of refs and deployability as '
        f'strings and booleans e.g. [["hail-is/hail:master", true]], but was: `{os.environ.get("WATCHED_TARGETS", None)}`',
    ) from e
try:
    with open('pr-build-script', 'r') as f:
        PR_BUILD_SCRIPT = f.read()
except FileNotFoundError as e:
    raise ValueError(
        "working directory must contain a file called `pr-build-script' "
        "containing a string that is passed to `/bin/sh -c'") from e
try: