Push all project docker images to a remote registry.
485986
def push_images():
    # type: () -> None
    
    registry = conf.get('docker.registry')
    docker_images = conf.get('docker.images', [])

    if registry is None:
        log.err("You must define docker.registry conf variable to push images")
        sys.exit(-1)

    for image in docker_images:
        push_image(registry, image)
796065
async function build() {
  await run(clean);
  await run(copy);
  await run(bundle);

  if (process.argv.includes('--static')) {
    await run(render);
  }

  if (process.argv.includes('--docker')) {
    cp.spawnSync('docker', ['build', '-t', pkg.name, '.'], {
      stdio: 'inherit',
    });
  }
}
125806
public static void pushImageTag(DockerClient docker, String imageName,
                                List<String> imageTags, Log log, boolean skipPush)
      throws MojoExecutionException, DockerException, IOException, InterruptedException {

    if (skipPush) {
      log.info("Skipping docker push");
      return;
    }
    // tags should not be empty if you have specified the option to push tags
    if (imageTags.isEmpty()) {
      throw new MojoExecutionException("You have used option \"pushImageTag\" but have"
                                       + " not specified an \"imageTag\" in your"
                                       + " docker-maven-client's plugin configuration");
    }
    final CompositeImageName compositeImageName = CompositeImageName.create(imageName, imageTags);
    for (final String imageTag : compositeImageName.getImageTags()) {
      final String imageNameWithTag = compositeImageName.getName() + ":" + imageTag;
      log.info("Pushing " + imageNameWithTag);
      docker.push(imageNameWithTag, new AnsiProgressHandler());
    }
  }
374187
def _ensure_image_registry(self, image):
        """"""
        image_with_registry = image.copy()
        if self.parent_registry:
            # if registry specified in Dockerfile image, ensure it's the one allowed by config
            if image.registry and image.registry != self.parent_registry:
                error = (
                    "Registry specified in dockerfile image doesn't match configured one. "
                    "Dockerfile: '%s'; expected registry: '%s'"
                    % (image, self.parent_registry))
                self.log.error("%s", error)
                raise RuntimeError(error)

            image_with_registry.registry = self.parent_registry

        return image_with_registry
856772
def build(image, build_path, tag=None, build_args=None, fromline=None, args=[]):
    

    if tag:
        image = ":".join([image, tag])

    bdir = tempfile.mkdtemp()
    os.system('cp -r {0:s}/* {1:s}'.format(build_path, bdir))
    if build_args:
        stdw = tempfile.NamedTemporaryFile(dir=bdir, mode='w')
        with open("{}/Dockerfile".format(bdir)) as std:
            dfile = std.readlines()

        for line in dfile:
            if fromline and line.lower().startswith('from'):
                stdw.write('FROM {:s}\n'.format(fromline))
            elif line.lower().startswith("cmd"):
                for arg in build_args:
                    stdw.write(arg+"\n")
                stdw.write(line)
            else:
                stdw.write(line)
        stdw.flush()
        utils.xrun("docker build", args+["--force-rm","-f", stdw.name, 
                   "-t", image, 
                    bdir])

        stdw.close()
    else:
        utils.xrun("docker build", args+["--force-rm", "-t", image, 
                    bdir])

    os.system('rm -rf {:s}'.format(bdir))
1338658
def conductorcmd_push(engine_name, project_name, services, **kwargs):
    
    username = kwargs.pop('username')
    password = kwargs.pop('password')
    email = kwargs.pop('email')
    url = kwargs.pop('url')
    namespace = kwargs.pop('namespace')
    tag = kwargs.pop('tag')
    config_path = kwargs.pop('config_path')
    repository_prefix =kwargs.pop('repository_prefix')

    engine = load_engine(['PUSH', 'LOGIN'], engine_name, project_name, services)
    logger.info(u'Engine integration loaded. Preparing push.',
                engine=engine.display_name)

    # Verify that we can authenticate with the registry
    username, password = engine.login(username, password, email, url, config_path)

    # Push each image that has been built using Ansible roles
    for name, service in iteritems(services):
        if service.get('containers'):
            for c in service['containers']:
                if 'roles' in c:
                    cname = '%s-%s' % (name, c['container_name'])
                    image_id = engine.get_latest_image_id_for_service(cname)
                    engine.push(image_id, cname, url=url, tag=tag, namespace=namespace, username=username,
                                password=password, repository_prefix=repository_prefix)
        elif 'roles' in service:
            # if the service has roles, it's an image we should push
            image_id = engine.get_latest_image_id_for_service(name)
            engine.push(image_id, name, url=url, tag=tag, namespace=namespace, username=username,
                        password=password, repository_prefix=repository_prefix)
133543
def push(self):
        """"""
        self._refresh_connection()

        # Check if we need to update mappings as this needs to be done
        # before we push anything to the Elasticsearch server.
        # This must be done even if the queue is empty, as otherwise ES
        # will fail when retrieving data.
        if not self._mapping_created:
            logger.debug("Pushing mapping for Elasticsearch index '%s'.", self.__class__.__name__)
            self.create_mapping()

        if not self.push_queue:
            logger.debug("No documents to push, skipping push.")
            return

        logger.debug("Found %s documents to push to Elasticsearch.", len(self.push_queue))

        bulk(connections.get_connection(), (doc.to_dict(True) for doc in self.push_queue), refresh=True)
        self.push_queue = []

        logger.debug("Finished pushing builded documents to Elasticsearch server.")
286069
def publish(build_entry: dict):
    """"""
    for tag in build_entry['tags']:
        print('[PUSHING]:', tag)
        os.system('docker push {}'.format(tag))
125310
def post_register_hook(self, verbosity=1):
        """"""
        if not getattr(settings, 'FLOW_DOCKER_DONT_PULL', False):
            call_command('list_docker_images', pull=True, verbosity=verbosity)
372414
def _export_remote_images(project, compute_id, image_type, image, project_zipfile, temporary_dir):
    

    log.info("Obtaining image `{}` from `{}`".format(image, compute_id))

    try:
        compute = [compute for compute in project.computes if compute.id == compute_id][0]
    except IndexError:
        raise aiohttp.web.HTTPConflict(
            text="Cannot export image from `{}` compute. Compute doesn't exist.".format(compute_id))

    (fd, temp_path) = tempfile.mkstemp(dir=temporary_dir)
    f = open(fd, "wb", closefd=True)
    response = yield from compute.download_image(image_type, image)

    if response.status != 200:
        raise aiohttp.web.HTTPConflict(
            text="Cannot export image from `{}` compute. Compute sent `{}` status.".format(
                compute_id, response.status))

    while True:
        data = yield from response.content.read(512)
        if not data:
            break
        f.write(data)
    response.close()
    f.close()
    arcname = os.path.join("images", image_type, image)
    log.info("Saved {}".format(arcname))
    project_zipfile.write(temp_path, arcname=arcname, compress_type=zipfile.ZIP_DEFLATED)
216740
def _pull_and_tag_image(self, image, build_json, nonce):
        """"""
        image = image.copy()
        first_library_exc = None
        for _ in range(20):
            # retry until pull and tag is successful or definitively fails.
            # should never require 20 retries but there's a race condition at work.
            # just in case something goes wildly wrong, limit to 20 so it terminates.
            try:
                self.tasker.pull_image(image, insecure=self.parent_registry_insecure,
                                       dockercfg_path=self.parent_registry_dockercfg_path)
                self.workflow.pulled_base_images.add(image.to_str())
            except RetryGeneratorException as exc:
                # getting here means the pull itself failed. we may want to retry if the
                # image being pulled lacks a namespace, like e.g. "rhel7". we cannot count
                # on the registry mapping this into the docker standard "library/rhel7" so
                # need to retry with that.
                if first_library_exc:
                    # we already tried and failed; report the first failure.
                    raise first_library_exc
                if image.namespace:
                    # already namespaced, do not retry with "library/", just fail.
                    raise

                self.log.info("'%s' not found", image.to_str())
                image.namespace = 'library'
                self.log.info("trying '%s'", image.to_str())
                first_library_exc = exc  # report first failure if retry also fails
                continue

            # Attempt to tag it using a unique ID. We might have to retry
            # if another build with the same parent image is finishing up
            # and removing images it pulled.

            # Use the OpenShift build name as the unique ID
            unique_id = build_json['metadata']['name']
            new_image = ImageName(repo=unique_id, tag=nonce)

            try:
                self.log.info("tagging pulled image")
                response = self.tasker.tag_image(image, new_image)
                self.workflow.pulled_base_images.add(response)
                self.log.debug("image '%s' is available as '%s'", image, new_image)
                return new_image
            except docker.errors.NotFound:
                # If we get here, some other build raced us to remove
                # the parent image, and that build won.
                # Retry the pull immediately.
                self.log.info("re-pulling removed image")
                continue

        # Failed to tag it after 20 tries
        self.log.error("giving up trying to pull image")
        raise RuntimeError("too many attempts to pull and tag image")
856689
function push() {
		Release.chdir( Release.dir.dist );

		console.log( "Pushing release to dist repo..." );
		Release.exec( "git push " + distRemote + " master --tags",
			"Error pushing master and tags to git repo." );

		// Set repo for npm publish
		Release.dir.origRepo = Release.dir.repo;
		Release.dir.repo = Release.dir.dist;
	}
1291818
def load_docker_cache(tag, docker_registry) -> None:
    """"""
    if docker_registry:
        # noinspection PyBroadException
        try:
            import docker_cache
            logging.info('Docker cache download is enabled from registry %s', docker_registry)
            docker_cache.load_docker_cache(registry=docker_registry, docker_tag=tag)
        except Exception:
            logging.exception('Unable to retrieve Docker cache. Continue without...')
    else:
        logging.info('Distributed docker cache disabled')
459555
def image_needs_pushing(image):
    
    d = docker_client()
    try:
        d.images.get_registry_data(image)
    except docker.errors.APIError:
        # image not found on registry, needs pushing
        return True
    else:
        return False
446528
public static void pushImage(String imageTag, String username, String password, String host) throws IOException {
        final AuthConfig authConfig = new AuthConfig();
        authConfig.withUsername(username);
        authConfig.withPassword(password);

        DockerClient dockerClient = null;
        try {
            dockerClient = getDockerClient(host);
            dockerClient.pushImageCmd(imageTag).withAuthConfig(authConfig).exec(new PushImageResultCallback()).awaitSuccess();
        } finally {
            closeQuietly(dockerClient);
        }
    }
735038
def build_image(self, conf, pushing=False):
        """"""
        with conf.make_context() as context:
            try:
                stream = BuildProgressStream(conf.harpoon.silent_build)
                with self.remove_replaced_images(conf) as info:
                    cached = NormalBuilder().build(conf, context, stream)
                    info['cached'] = cached
            except (KeyboardInterrupt, Exception) as error:
                exc_info = sys.exc_info()
                if stream.current_container:
                    Runner().stage_build_intervention(conf, stream.current_container)

                if isinstance(error, KeyboardInterrupt):
                    raise UserQuit()
                else:
                    six.reraise(*exc_info)
            finally:
                if stream and stream.intermediate_images and conf.cleanup_intermediate_images:
                    for image in stream.intermediate_images:
                        log.info("Deleting intermediate image\timage=%s", image)
                        try:
                            conf.harpoon.docker_api.remove_image(image)
                        except Exception as error:
                            log.error("Failed to remove intermediate image\timage=%s\terror=%s", image, error)

        return cached
24741
def get_image_registry_url(self, image_name):
        
        c = self._oc_command(["get", "is", image_name,
                              "--output=jsonpath=\'{ .status.dockerImageRepository }\'"])
        try:
            internal_registry_name = run_cmd(c, return_output=True)
        except subprocess.CalledProcessError as ex:
            raise ConuException("oc get is failed: %s" % ex)

        logger.info("Image registry url: %s", internal_registry_name)

        return internal_registry_name.replace("'", "").replace('"', '')