Merge branch 'rustedbuilds' of https://bitbucket.org/yackob03/quay into rustedbuilds

This commit is contained in:
Joseph Schorr 2014-02-25 00:19:43 -05:00
commit df915b5b21
2 changed files with 7 additions and 2 deletions

View file

@ -1,6 +1,7 @@
import logging import logging
import io import io
import os.path import os.path
import zipfile
from github import Github, UnknownObjectException, GithubException from github import Github, UnknownObjectException, GithubException
from tempfile import SpooledTemporaryFile from tempfile import SpooledTemporaryFile
@ -228,10 +229,15 @@ class GithubBuildTrigger(BuildTrigger):
archive_link = repo.get_archive_link('zipball', short_sha) archive_link = repo.get_archive_link('zipball', short_sha)
download_archive = client.get(archive_link, stream=True) download_archive = client.get(archive_link, stream=True)
zipball_subdir = ''
with SpooledTemporaryFile(CHUNK_SIZE) as zipball: with SpooledTemporaryFile(CHUNK_SIZE) as zipball:
for chunk in download_archive.iter_content(CHUNK_SIZE): for chunk in download_archive.iter_content(CHUNK_SIZE):
zipball.write(chunk) zipball.write(chunk)
# Pull out the name of the subdir that GitHub generated
with zipfile.ZipFile(zipball) as archive:
zipball_subdir = archive.namelist()[0]
dockerfile_id = user_files.store_file(zipball, ZIPBALL) dockerfile_id = user_files.store_file(zipball, ZIPBALL)
logger.debug('Successfully prepared job') logger.debug('Successfully prepared job')
@ -245,7 +251,6 @@ class GithubBuildTrigger(BuildTrigger):
# compute the subdir # compute the subdir
repo_subdir = config['subdir'] repo_subdir = config['subdir']
zipball_subdir = '%s-%s-%s' % (repo.owner.login, repo.name, short_sha)
joined_subdir = os.path.join(zipball_subdir, repo_subdir) joined_subdir = os.path.join(zipball_subdir, repo_subdir)
logger.debug('Final subdir: %s' % joined_subdir) logger.debug('Final subdir: %s' % joined_subdir)

View file

@ -87,7 +87,7 @@ def build_trigger_webhook(namespace, repository, trigger_uuid):
'resource_key': dockerfile_id, 'resource_key': dockerfile_id,
} }
build_request = model.create_repository_build(trigger.repository, token, build_request = model.create_repository_build(trigger.repository, token,
job_config, name) job_config, name, trigger)
dockerfile_build_queue.put(json.dumps({ dockerfile_build_queue.put(json.dumps({
'build_uuid': build_request.uuid, 'build_uuid': build_request.uuid,