Example #1
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:
Example #2
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:
Example #3
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: