Automation Suite
2023.10
False
Image de fond de la bannière
Guide d'installation d'Automation Suite sur Linux
Dernière mise à jour 19 avr. 2024

Comment supprimer des images de l’ancien programme d’installation après la mise à niveau

Si vous rencontrez des problèmes de vulnérabilité d’image ou de consommation de stockage après avoir effectué une mise à niveau, vous pouvez supprimer les images de l’ancien programme d’installation.

Pour effectuer cette opération facultative après la mise à niveau, procédez comme suit :

  1. Mettez à jour IMG, TAG, USER, PASS, registry et latest_image_json en fonction de la configuration du cluster dans le script suivant, puis exécutez-le :
    #!/bin/bash
    
    ### Please change below variables as required
    IMG=<E.g. dataservice/dataservice-designer>
    TAG=<E.g. v20231116-tag>
    USER=<E.g. "admin">
    PASS=<E.g. "password">
    registry=<E.g. "registry.mycluster.com">
    latest_image_json=<E.g. "/opt/UiPathAutomationSuite/UiPath_Installer/versions/docker-images.json">
    ####
    
    [[ -f "${latest_image_json}" ]] || {
    	echo "File "$latest_image_json" doesn't exist"
    	exit 1
    }
    
    cat "${latest_image_json}" | tr -d '",' | grep -w "${IMG}:${TAG}" >> /dev/null && {
    	echo "Image ${IMG}:${TAG} is being used in cluster. Will skip the deletion."
    	exit 0
    }
    
    echo "Deleting image ${IMG}:${TAG}"
    
    cred="-u ${USER}:${PASS}"
    
    for i in `curl -k -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' $cred "https://$registry/v2/$IMG/manifests/$TAG" | jq -r '.layers | .[] | .digest'`; do
    	curl -k  -H "Accept: application/vnd.docker.distribution.manifest.v2+json"  $cred -X DELETE "https://$registry/v2/$IMG/manifests/$i"
    done
    
    for i in `curl -k -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' $cred "https://$registry/v2/$IMG/manifests/$TAG" | jq -r '.config.digest'`; do
    	curl -k  -H "Accept: application/vnd.docker.distribution.manifest.v2+json"  $cred -X DELETE "https://$registry/v2/$IMG/manifests/$i"
    done#!/bin/bash
    
    ### Please change below variables as required
    IMG=<E.g. dataservice/dataservice-designer>
    TAG=<E.g. v20231116-tag>
    USER=<E.g. "admin">
    PASS=<E.g. "password">
    registry=<E.g. "registry.mycluster.com">
    latest_image_json=<E.g. "/opt/UiPathAutomationSuite/UiPath_Installer/versions/docker-images.json">
    ####
    
    [[ -f "${latest_image_json}" ]] || {
    	echo "File "$latest_image_json" doesn't exist"
    	exit 1
    }
    
    cat "${latest_image_json}" | tr -d '",' | grep -w "${IMG}:${TAG}" >> /dev/null && {
    	echo "Image ${IMG}:${TAG} is being used in cluster. Will skip the deletion."
    	exit 0
    }
    
    echo "Deleting image ${IMG}:${TAG}"
    
    cred="-u ${USER}:${PASS}"
    
    for i in `curl -k -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' $cred "https://$registry/v2/$IMG/manifests/$TAG" | jq -r '.layers | .[] | .digest'`; do
    	curl -k  -H "Accept: application/vnd.docker.distribution.manifest.v2+json"  $cred -X DELETE "https://$registry/v2/$IMG/manifests/$i"
    done
    
    for i in `curl -k -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' $cred "https://$registry/v2/$IMG/manifests/$TAG" | jq -r '.config.digest'`; do
    	curl -k  -H "Accept: application/vnd.docker.distribution.manifest.v2+json"  $cred -X DELETE "https://$registry/v2/$IMG/manifests/$i"
    done
  2. Redémarrez le pod de registre pour l’exécution de la Collecte de données indésirables (Garbage Collection) ou exécutez-le dans le pod de registre et exécutez la Collecte de données indésirables à l’aide de la commande suivante :

    registry garbage-collect /etc/docker/registry/config.ymlregistry garbage-collect /etc/docker/registry/config.yml

Cette page vous a-t-elle été utile ?

Obtenez l'aide dont vous avez besoin
Formation RPA - Cours d'automatisation
Forum de la communauté UiPath
Logo Uipath blanc
Confiance et sécurité
© 2005-2024 UiPath. All rights reserved.