src/main/java/org/edgegallery/appstore/application/inner/AppService.java
public void uploadAppImage(List<SwImgDesc> imageInfoList) {

        for (SwImgDesc imageInfo : imageInfoList) {
            LOGGER.info("Docker image to  upload: {}", imageInfo.getSwImage());

            DockerClient dockerClient = getDockerClient(appstoreRepoEndpoint, appstoreRepoUsername,
                appstoreRepoPassword);

            String[] dockerImageNames = imageInfo.getSwImage().split("/");
            String uploadImgName;
            if (dockerImageNames.length > 1) {
                uploadImgName = new StringBuilder(appstoreRepoEndpoint).append(APPSTORE_URL)
                    .append(dockerImageNames[dockerImageNames.length - 1]).toString();
            } else {
                uploadImgName = new StringBuilder(appstoreRepoEndpoint).append(APPSTORE_URL).append(dockerImageNames[0])
                    .toString();
            }

            try {
                LOGGER.info("Upload tagged docker image: {}", uploadImgName);
                String id = dockerClient.inspectImageCmd(imageInfo.getSwImage()).exec().getId();
                dockerClient.tagImageCmd(id, uploadImgName, imageInfo.getVersion()).withForce().exec();
                dockerClient.pushImageCmd(uploadImgName).exec(new PushImageResultCallback()).awaitCompletion();
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
                throw new AppException(PUSH_IMAGE_ERR_MESSAGES, ResponseConst.RET_PUSH_IMAGE_FAILED, uploadImgName);
            } catch (Exception e) {
                LOGGER.error("failed to push image {}, errormsg: {}", uploadImgName, e.getMessage());
                throw new AppException(PUSH_IMAGE_ERR_MESSAGES, ResponseConst.RET_PUSH_IMAGE_FAILED, uploadImgName);
            }
        }
        LOGGER.info("images to appstore repo uploaded successfully");
    }
/**
     * Uploads app image from repo.
     *
     * @param imageInfoList list of images
     */
Uploads app image from repo.
@param imageInfoList list of images
Uploads app image from repo . @param imageInfoList list of images
public void uploadAppImage(List<SwImgDesc> imageInfoList) {
        for (SwImgDesc imageInfo : imageInfoList) {
            LOGGER.info("Docker image to  upload: {}", imageInfo.getSwImage());
            DockerClient dockerClient = getDockerClient(appstoreRepoEndpoint, appstoreRepoUsername,
                appstoreRepoPassword);
            String[] dockerImageNames = imageInfo.getSwImage().split("/");
            String uploadImgName;
            if (dockerImageNames.length > 1) {
                uploadImgName = new StringBuilder(appstoreRepoEndpoint).append(APPSTORE_URL)
                    .append(dockerImageNames[dockerImageNames.length - 1]).toString();
            } else {
                uploadImgName = new StringBuilder(appstoreRepoEndpoint).append(APPSTORE_URL).append(dockerImageNames[0])
                    .toString();
            }
            try {
                LOGGER.info("Upload tagged docker image: {}", uploadImgName);
                String id = dockerClient.inspectImageCmd(imageInfo.getSwImage()).exec().getId();
                dockerClient.tagImageCmd(id, uploadImgName, imageInfo.getVersion()).withForce().exec();
                dockerClient.pushImageCmd(uploadImgName).exec(new PushImageResultCallback()).awaitCompletion();
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
                throw new AppException(PUSH_IMAGE_ERR_MESSAGES, ResponseConst.RET_PUSH_IMAGE_FAILED, uploadImgName);
            } catch (Exception e) {
                LOGGER.error("failed to push image {}, errormsg: {}", uploadImgName, e.getMessage());
                throw new AppException(PUSH_IMAGE_ERR_MESSAGES, ResponseConst.RET_PUSH_IMAGE_FAILED, uploadImgName);
            }
        }
        LOGGER.info("images to appstore repo uploaded successfully");
    }
public void uploadAppImage ( List < SwImgDesc > imageInfoList ) { for ( SwImgDesc imageInfo : imageInfoList ) { LOGGER . info ( "Docker image to  upload: {}" , imageInfo . getSwImage ( ) ) ; DockerClient dockerClient = getDockerClient ( appstoreRepoEndpoint , appstoreRepoUsername , appstoreRepoPassword ) ; String [ ] dockerImageNames = imageInfo . getSwImage ( ) . split ( "/" ) ; String uploadImgName ; if ( dockerImageNames . length > 1 ) { uploadImgName = new StringBuilder ( appstoreRepoEndpoint ) . append ( APPSTORE_URL ) . append ( dockerImageNames [ dockerImageNames . length - 1 ] ) . toString ( ) ; } else { uploadImgName = new StringBuilder ( appstoreRepoEndpoint ) . append ( APPSTORE_URL ) . append ( dockerImageNames [ 0 ] ) . toString ( ) ; } try { LOGGER . info ( "Upload tagged docker image: {}" , uploadImgName ) ; String id = dockerClient . inspectImageCmd ( imageInfo . getSwImage ( ) ) . exec ( ) . getId ( ) ; dockerClient . tagImageCmd ( id , uploadImgName , imageInfo . getVersion ( ) ) . withForce ( ) . exec ( ) ; dockerClient . pushImageCmd ( uploadImgName ) . exec ( new PushImageResultCallback ( ) ) . awaitCompletion ( ) ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; throw new AppException ( PUSH_IMAGE_ERR_MESSAGES , ResponseConst . RET_PUSH_IMAGE_FAILED , uploadImgName ) ; } catch ( Exception e ) { LOGGER . error ( "failed to push image {}, errormsg: {}" , uploadImgName , e . getMessage ( ) ) ; throw new AppException ( PUSH_IMAGE_ERR_MESSAGES , ResponseConst . RET_PUSH_IMAGE_FAILED , uploadImgName ) ; } } LOGGER . info ( "images to appstore repo uploaded successfully" ) ; }
Uploads app image from repo.
Uploads app image from repo .