From ec42303750c5edfa2cef1631443566f2a99e0804 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Fri, 3 Oct 2014 13:00:41 -0400 Subject: [PATCH] image_and_tag must be before we use it --- workers/dockerfilebuild.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/workers/dockerfilebuild.py b/workers/dockerfilebuild.py index a45d82b67..60b29a109 100644 --- a/workers/dockerfilebuild.py +++ b/workers/dockerfilebuild.py @@ -223,6 +223,13 @@ class DockerfileBuildContext(object): raise RuntimeError(message) def pull(self): + image_and_tag_tuple = self._parsed_dockerfile.get_image_and_tag() + if image_and_tag_tuple is None or image_and_tag_tuple[0] is None: + self._build_logger('Missing FROM command in Dockerfile', build_logs.ERROR) + raise JobException('Missing FROM command in Dockerfile') + + image_and_tag = ':'.join(image_and_tag_tuple) + # Login with the specified credentials (if any). if self._pull_credentials: logger.debug('Logging in with pull credentials: %s@%s', @@ -238,13 +245,6 @@ class DockerfileBuildContext(object): registry=self._pull_credentials['registry'], reauth=True) # Pull the image, in case it was updated since the last build - image_and_tag_tuple = self._parsed_dockerfile.get_image_and_tag() - if image_and_tag_tuple is None or image_and_tag_tuple[0] is None: - self._build_logger('Missing FROM command in Dockerfile', build_logs.ERROR) - raise JobException('Missing FROM command in Dockerfile') - - image_and_tag = ':'.join(image_and_tag_tuple) - self._build_logger('Pulling base image: %s' % image_and_tag, log_data = { 'phasestep': 'pull', 'repo_url': image_and_tag