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