Esempio n. 1
0
 def _start_build(self, image):
     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)
Esempio n. 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)
 def _start_build(self, image):
     git_info = {
         'source_url': image.source_uri,
     }
     api.API(context=self.context).build_lp(
         image_id=image.id,
         git_info=git_info,
         name=image.name,
         source_format=image.source_format,
         image_format=image.image_format,
         artifact_type=image.artifact_type)
Esempio n. 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)
Esempio n. 5
0
#!/usr/bin/env python
# Copyright 2014 - Rackspace Hosting
#
#    Licensed under the Apache License, Version 2.0 (the "License");
#    you may not use this file except in compliance with the License.
#    You may obtain a copy of the License at
#
#        http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.

import sys

from oslo_config import cfg

from solum.common import context
from solum.openstack.common import log as logging
from solum.worker import api

LOG = logging.getLogger(__name__)

if __name__ == '__main__':
    conf_files = ['--config-file=/etc/solum/solum.conf']
    cfg.CONF(conf_files, project='solum')
    message = ' '.join(sys.argv[1:])
    api.API(context=context.RequestContext()).echo(message)