github.com/verrazzano/verrazzano@v1.7.0/release/scripts/validate_ocr_images.sh (about)

     1  #!/usr/bin/env bash
     2  #
     3  # Copyright (c) 2023, Oracle and/or its affiliates.
     4  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
     5  #
     6  
     7  IMAGES_FOUND_IN_OCR=("")
     8  IMAGES_NOT_FOUND_IN_OCR=("")
     9  OBJ_STORAGE_VZ_IMAGE_TXT=verrazzano_images.txt
    10  
    11  printf "Logging into Crane ..."
    12  echo "$OCR_CREDS_PSW" | crane auth login "$DOCKER_REPO" -u "$OCR_CREDS_USR" --password-stdin
    13  
    14  while IFS= read -r line
    15  do  
    16      VZ_IMAGE_NAME=$(echo "$line")
    17      crane manifest "$DOCKER_REPO/$VZ_IMAGE_NAME"
    18      if [[ $? -eq 0 ]]; then
    19          IMAGES_FOUND_IN_OCR+=("$VZ_IMAGE_NAME")
    20      else
    21          IMAGES_NOT_FOUND_IN_OCR+=("$VZ_IMAGE_NAME")
    22          FAIL_NOT_IN_OCR=true
    23      fi
    24  done < "$OBJ_STORAGE_VZ_IMAGE_TXT"
    25  
    26  
    27  printf "\n\nThe following Images were found in OCR ..."
    28  for value in "${IMAGES_FOUND_IN_OCR[@]}"
    29  do
    30       echo $value
    31  done
    32  
    33  if [[ "$FAIL_NOT_IN_OCR" ]]; then
    34      printf "\n\nThe following Images were NOT found in OCR ..."
    35      for value in "${IMAGES_NOT_FOUND_IN_OCR[@]}"
    36      do
    37          echo $value
    38      done
    39      printf "Job Failed.\n A(n) image was not found in OCR."
    40      exit 1
    41  fi