Example #1
0
    def _build_artifact(self, assem, artifact):
        # This is a tempory hack so we don't need the build client
        # in the requirments.
        image = objects.registry.Image()
        image.name = artifact['name']
        image.source_uri = artifact['content']['href']
        image.base_image_id = artifact.get('language_pack', 'auto')
        image.source_format = artifact.get('artifact_type',
                                           CONF.api.source_format)
        image.image_format = CONF.api.image_format
        image.uuid = str(uuid.uuid4())
        image.user_id = self.context.user
        image.project_id = self.context.tenant
        image.state = IMAGE_STATES.PENDING
        image.create(self.context)
        test_cmd = artifact.get('unittest_cmd')

        api.API(context=self.context).build(
            build_id=image.id,
            source_uri=image.source_uri,
            name=image.name,
            base_image_id=image.base_image_id,
            source_format=image.source_format,
            image_format=image.image_format,
            assembly_id=assem.id,
            test_cmd=test_cmd)
Example #2
0
    def _execute_workflow_actions(self,
                                  wf_obj,
                                  app_obj,
                                  assem,
                                  verb='launch_workflow',
                                  commit_sha='',
                                  status_url=None,
                                  du_id=None):
        image = objects.registry.Image()

        image.name = app_obj.name
        image.source_uri = wf_obj.source['repository']
        image.base_image_id = app_obj.languagepack
        image.image_format = CONF.api.image_format
        image.uuid = str(uuid.uuid4())
        image.user_id = self.context.user
        image.project_id = self.context.tenant
        image.status = IMAGE_STATES.QUEUED
        image.create(self.context)
        test_cmd = wf_obj.config['test_cmd']
        run_cmd = wf_obj.config['run_cmd']

        ports = app_obj.ports

        repo_token = wf_obj.source['repo_token']

        # TODO(devkulkarni): Check whether we need image.source_format
        image.source_format = 'solum'

        git_info = {
            'source_url': image.source_uri,
            'commit_sha': commit_sha,
            'repo_token': repo_token,
            'status_url': status_url,
            'private': wf_obj.source['private'],
            'private_ssh_key': wf_obj.source['private_ssh_key']
        }

        if test_cmd:
            repo_utils.send_status(0, status_url, repo_token, pending=True)

        worker_api.API(context=self.context).build_app(
            verb=verb,
            build_id=image.id,
            git_info=git_info,
            ports=ports,
            name=image.name,
            base_image_id=image.base_image_id,
            source_format=image.source_format,
            image_format=image.image_format,
            assembly_id=assem.id,
            workflow=assem.workflow,
            test_cmd=test_cmd,
            run_cmd=run_cmd,
            du_id=du_id)
Example #3
0
    def _execute_workflow_actions(self, wf_obj, app_obj, assem,
                                  verb='launch_workflow',
                                  commit_sha='', status_url=None,
                                  du_id=None):
        image = objects.registry.Image()

        image.name = app_obj.name
        image.source_uri = wf_obj.source['repository']
        image.base_image_id = app_obj.languagepack
        image.image_format = CONF.api.image_format
        image.uuid = str(uuid.uuid4())
        image.user_id = self.context.user
        image.project_id = self.context.tenant
        image.status = IMAGE_STATES.QUEUED
        image.create(self.context)
        test_cmd = wf_obj.config['test_cmd']
        run_cmd = wf_obj.config['run_cmd']

        ports = app_obj.ports

        repo_token = wf_obj.source['repo_token']

        # TODO(devkulkarni): Check whether we need image.source_format
        image.source_format = 'solum'

        git_info = {
            'source_url': image.source_uri,
            'commit_sha': commit_sha,
            'repo_token': repo_token,
            'status_url': status_url,
            'private': wf_obj.source['private'],
            'private_ssh_key': wf_obj.source['private_ssh_key']
        }

        if test_cmd:
            repo_utils.send_status(0, status_url, repo_token, pending=True)

        worker_api.API(context=self.context).build_app(
            verb=verb,
            build_id=image.id,
            git_info=git_info,
            ports=ports,
            name=image.name,
            base_image_id=image.base_image_id,
            source_format=image.source_format,
            image_format=image.image_format,
            assembly_id=assem.id,
            workflow=assem.workflow,
            test_cmd=test_cmd,
            run_cmd=run_cmd,
            du_id=du_id)
Example #4
0
    def _build_artifact(self,
                        assem,
                        artifact,
                        verb='launch_workflow',
                        commit_sha='',
                        status_url=None):

        # This is a tempory hack so we don't need the build client
        # in the requirements.
        image = objects.registry.Image()
        image.name = artifact['name']
        image.source_uri = artifact['content']['href']
        image.base_image_id = artifact.get('language_pack', 'auto')
        image.source_format = artifact.get('artifact_type',
                                           CONF.api.source_format)
        image.image_format = CONF.api.image_format
        image.uuid = uuidutils.generate_uuid()
        image.user_id = self.context.user
        image.project_id = self.context.tenant
        image.status = IMAGE_STATES.QUEUED
        image.create(self.context)
        test_cmd = artifact.get('unittest_cmd')
        run_cmd = artifact.get('run_cmd')
        repo_token = artifact.get('repo_token')
        ports = artifact.get('ports', [80])

        git_info = {
            'source_url': image.source_uri,
            'commit_sha': commit_sha,
            'repo_token': repo_token,
            'status_url': status_url
        }

        if test_cmd:
            repo_utils.send_status(0, status_url, repo_token, pending=True)

        worker_api.API(context=self.context).build_app(
            verb=verb,
            build_id=image.id,
            git_info=git_info,
            ports=ports,
            name=image.name,
            base_image_id=image.base_image_id,
            source_format=image.source_format,
            image_format=image.image_format,
            assembly_id=assem.id,
            workflow=assem.workflow,
            test_cmd=test_cmd,
            run_cmd=run_cmd)
Example #5
0
    def _build_artifact(self, assem, artifact, verb='launch_workflow',
                        commit_sha='', status_url=None):

        # This is a tempory hack so we don't need the build client
        # in the requirements.
        image = objects.registry.Image()
        image.name = artifact['name']
        image.source_uri = artifact['content']['href']
        image.base_image_id = artifact.get('language_pack', 'auto')
        image.source_format = artifact.get('artifact_type',
                                           CONF.api.source_format)
        image.image_format = CONF.api.image_format
        image.uuid = str(uuid.uuid4())
        image.user_id = self.context.user
        image.project_id = self.context.tenant
        image.status = IMAGE_STATES.QUEUED
        image.create(self.context)
        test_cmd = artifact.get('unittest_cmd')
        run_cmd = artifact.get('run_cmd')
        repo_token = artifact.get('repo_token')
        ports = artifact.get('ports', [80])

        git_info = {
            'source_url': image.source_uri,
            'commit_sha': commit_sha,
            'repo_token': repo_token,
            'status_url': status_url
        }

        if test_cmd:
            repo_utils.send_status(0, status_url, repo_token, pending=True)

        worker_api.API(context=self.context).build_app(
            verb=verb,
            build_id=image.id,
            git_info=git_info,
            ports=ports,
            name=image.name,
            base_image_id=image.base_image_id,
            source_format=image.source_format,
            image_format=image.image_format,
            assembly_id=assem.id,
            workflow=assem.workflow,
            test_cmd=test_cmd,
            run_cmd=run_cmd)
Example #6
0
    def _build_artifact(self, assem, artifact, verb='build', commit_sha='',
                        status_url=None, deploy_keys_ref=None):

        # This is a tempory hack so we don't need the build client
        # in the requirments.
        image = objects.registry.Image()
        image.name = artifact['name']
        image.source_uri = artifact['content']['href']
        image.base_image_id = artifact.get('language_pack', 'auto')
        image.source_format = artifact.get('artifact_type',
                                           CONF.api.source_format)
        image.image_format = CONF.api.image_format
        image.uuid = str(uuid.uuid4())
        image.user_id = self.context.user
        image.project_id = self.context.tenant
        image.state = IMAGE_STATES.PENDING
        image.create(self.context)
        test_cmd = artifact.get('unittest_cmd')
        status_token = artifact.get('status_token')

        git_info = {
            'source_url': image.source_uri,
            'commit_sha': commit_sha,
            'status_token': status_token,
            'status_url': status_url
        }

        api.API(context=self.context).perform_action(
            verb=verb,
            build_id=image.id,
            git_info=git_info,
            name=image.name,
            base_image_id=image.base_image_id,
            source_format=image.source_format,
            image_format=image.image_format,
            assembly_id=assem.id,
            test_cmd=test_cmd,
            source_creds_ref=deploy_keys_ref)