Пример #1
0
 def __init__(self, ccm_token, github_label):
     self._http_headers = {'Authorization': 'Token ' + ccm_token}
     self._dry_run = os.environ.get('DRY_RUN', '')
     self._github_updater = github_update.GithubStatusUpdater(
         'cluster:{}'.format(github_label))
Пример #2
0
    def __init__(
            self,
            package_name,
            input_dir_path,
            artifact_paths,
            package_version = 'stub-universe'):
        self._dry_run = os.environ.get('DRY_RUN', '')
        self._pkg_name = package_name
        self._pkg_version = package_version
        self._input_dir_path = input_dir_path

        self._aws_region = os.environ.get('AWS_UPLOAD_REGION', '')
        self._universe_url_prefix = os.environ.get(
            'UNIVERSE_URL_PREFIX',
            'https://universe-converter.mesosphere.com/transform?url=')
        s3_bucket = os.environ.get('S3_BUCKET', 'infinity-artifacts')
        s3_dir_path = os.environ.get('S3_DIR_PATH', 'autodelete7d')
        dir_name = '{}-{}'.format(
            time.strftime("%Y%m%d-%H%M%S"),
            ''.join([random.SystemRandom().choice(string.ascii_letters + string.digits) for i in range(16)]))

        # sample s3_directory: 'infinity-artifacts/autodelete7d/kafka/20160815-134747-S6vxd0gRQBw43NNy'
        self._s3_directory = os.environ.get(
            'S3_URL',
            's3://{}/{}/{}/{}'.format(
                s3_bucket,
                s3_dir_path,
                self._pkg_name,
                dir_name))

        self._http_directory = os.environ.get(
            'ARTIFACT_DIR',
            'https://{}.s3.amazonaws.com/{}/{}/{}'.format(
                s3_bucket,
                s3_dir_path,
                self._pkg_name,
                dir_name))

        self._github_updater = github_update.GithubStatusUpdater('upload:{}'.format(package_name))

        if not os.path.isdir(input_dir_path):
            err = 'Provided package path is not a directory: {}'.format(input_dir_path)
            self._github_updater.update('error', err)
            raise Exception(err)

        # check if aws cli tools are installed
        cmd = "aws --version"
        ret = os.system(cmd)
        if not ret == 0:
            err = 'Required AWS cli tools not installed.'
            self._github_updater.update('error', err)
            raise Exception(err)

        self._artifact_paths = []
        for artifact_path in artifact_paths:
            if not os.path.isfile(artifact_path):
                err = 'Provided package path is not a file: {} (full list: {})'.format(artifact_path, artifact_paths)
                raise Exception(err)
            if artifact_path in self._artifact_paths:
                err = 'Duplicate filename between "{}" and "{}". Artifact filenames must be unique.'.format(prior_path, artifact_path)
                self._github_updater.update('error', err)
                raise Exception(err)
            self._artifact_paths.append(artifact_path)
Пример #3
0
 def __init__(self, dcos_url, github_label):
     self._CLI_URL_TEMPLATE = 'https://downloads.dcos.io/binaries/cli/{}/x86-64/latest/{}'
     self._dcos_url = dcos_url
     self._sandbox_path = ''
     self._github_updater = github_update.GithubStatusUpdater(
         'test:{}'.format(github_label))
Пример #4
0
 def __init__(self, dcos_url, github_label, sandbox_path='', cli_path=None):
     self._dcos_url = dcos_url
     self._sandbox_path = sandbox_path
     self._cli_path = cli_path
     self._github_updater = github_update.GithubStatusUpdater(
         'test:{}'.format(github_label))