feat(build runner): added in context, dockerfile_location
this is a new feature meant to allow people to use any file as a dockerfile and any folder as a context directory
This commit is contained in:
parent
90b130fe16
commit
e6d201e0b0
29 changed files with 531 additions and 111 deletions
|
@ -1,5 +1,5 @@
|
|||
""" Create, list, cancel and get status/logs of repository builds. """
|
||||
|
||||
import os
|
||||
from urlparse import urlparse
|
||||
|
||||
import logging
|
||||
|
@ -51,6 +51,7 @@ def user_view(user):
|
|||
'is_robot': user.robot,
|
||||
}
|
||||
|
||||
|
||||
def trigger_view(trigger, can_read=False, can_admin=False, for_build=False):
|
||||
if trigger and trigger.uuid:
|
||||
build_trigger = BuildTriggerHandler.get_handler(trigger)
|
||||
|
@ -133,6 +134,8 @@ def build_status_view(build_obj):
|
|||
'display_name': build_obj.display_name,
|
||||
'status': status or {},
|
||||
'subdirectory': job_config.get('build_subdir', ''),
|
||||
'dockerfile_path': job_config.get('build_subdir', ''),
|
||||
'context': job_config.get('context', ''),
|
||||
'tags': job_config.get('docker_tags', []),
|
||||
'manual_user': job_config.get('manual_user', None),
|
||||
'is_writer': can_write,
|
||||
|
@ -244,6 +247,7 @@ class RepositoryBuildList(RepositoryParamResource):
|
|||
raise InvalidRequest('Invalid Archive URL: Must be http or https')
|
||||
|
||||
subdir = request_json['subdirectory'] if 'subdirectory' in request_json else ''
|
||||
context = request_json['context'] if 'context' in request_json else os.path.dirname(subdir)
|
||||
tags = request_json.get('docker_tags', ['latest'])
|
||||
pull_robot_name = request_json.get('pull_robot', None)
|
||||
|
||||
|
@ -291,9 +295,9 @@ class RepositoryBuildList(RepositoryParamResource):
|
|||
prepared.archive_url = archive_url
|
||||
prepared.tags = tags
|
||||
prepared.subdirectory = subdir
|
||||
prepared.context = context
|
||||
prepared.is_manual = True
|
||||
prepared.metadata = {}
|
||||
|
||||
try:
|
||||
build_request = start_build(repo, prepared, pull_robot_name=pull_robot_name)
|
||||
except MaximumBuildsQueuedException:
|
||||
|
|
Reference in a new issue