<commit_before>---
# Load, Tag & Upload Specified Docker Images

#
# -----------------------------------------------------------------------------
# Verify Tarball
# -----------------------------------------------------------------------------
#
- name: Verify Docker Image Tarball File Exists
  stat:
    path: "{{ serapeum_offline_images_dir }}/{{ serapeum_docker_offline_images_tarball }}"
  register: docker_tarball

- name: Fail if Tarball Does Not Exist
  fail:
    msg: "Docker Image Tarball {{ serapeum_offline_images_dir }}/{{ serapeum_docker_offline_images_tarball }} Does Not Exist"
  when: docker_tarball.stat.exists == false

- name: Success if Tarball Does Exist
  debug:
    msg: "Docker Image Tarball {{ serapeum_offline_images_dir }}/{{ serapeum_docker_offline_images_tarball }} Exists"
  when: docker_tarball.stat.exists == true
  register: docker_tarball_exists

#
# -----------------------------------------------------------------------------
# Load and Tag Offline Images from Tarball
# -----------------------------------------------------------------------------
#
- name: Load Offline Images Tarball
  docker_image:
    name: "{{ item.name }}"
    tag: "{{ item.tag }}"
    repository: "{{ serapeum_registry_hostname }}:{{ serapeum_registry_port }}/{{ item.namespace }}/{{ item.name }}"
    load_path: "{{ serapeum_offline_images_dir }}/{{ serapeum_docker_offline_images_tarball }}"
  with_items:
  - "{{ serapeum_docker_images }}"
  when:
  - docker_tarball_exists
  register: docker_images_loaded

#
# -----------------------------------------------------------------------------
# Upload Images to Registry
# -----------------------------------------------------------------------------
#
- name: Upload Images to Registry
  docker_image:
    name: "{{ item.name }}"
    tag: "{{ item.tag }}"
    push: yes
    repository: "{{ serapeum_registry_hostname }}:{{ serapeum_registry_port }}/{{ item.namespace }}/{{ item.name }}"
  with_items:
  - "{{ serapeum_docker_images }}"
  when:
      - registry_started
      - docker_images_loaded
  register: docker_images_uploaded<commit_msg>Added debug messages<commit_after>---
# Load, Tag & Upload Specified Docker Images

#
# -----------------------------------------------------------------------------
# Verify Tarball
# -----------------------------------------------------------------------------
#
- name: Verify Docker Image Tarball File Exists
  stat:
    path: "{{ serapeum_offline_images_dir }}/{{ serapeum_docker_offline_images_tarball }}"
  register: docker_tarball

- name: Fail if Tarball Does Not Exist
  fail:
    msg: "Docker Image Tarball {{ serapeum_offline_images_dir }}/{{ serapeum_docker_offline_images_tarball }} Does Not Exist"
  when: docker_tarball.stat.exists == false

- name: Success if Tarball Does Exist
  debug:
    msg: "Docker Image Tarball {{ serapeum_offline_images_dir }}/{{ serapeum_docker_offline_images_tarball }} Exists"
  when: docker_tarball.stat.exists == true
  register: docker_tarball_exists

#
# -----------------------------------------------------------------------------
# Load and Tag Offline Images from Tarball
# -----------------------------------------------------------------------------
#

- name: Debug Vars
  debug:
    msg: "{{ serapeum_registry_hostname }}  {{ serapeum_registry_port }} {{item.namespace }}  {{ item.name }}"
  with_items:
  - "{{ serapeum_docker_images }}"

- name: Load Offline Images Tarball
  docker_image:
    name: "{{ item.name }}"
    tag: "{{ item.tag }}"
    repository: "{{ serapeum_registry_hostname }}:{{ serapeum_registry_port }}/{{ (item.namespace == None) | ternary('', '/')  }}{{ item.namespace }}/{{ item.name }}"
    load_path: "{{ serapeum_offline_images_dir }}/{{ serapeum_docker_offline_images_tarball }}"
  with_items:
  - "{{ serapeum_docker_images }}"
  when:
  - docker_tarball_exists
  register: docker_images_loaded

#
# -----------------------------------------------------------------------------
# Upload Images to Registry
# -----------------------------------------------------------------------------
#
- name: Upload Images to Registry
  docker_image:
    name: "{{ item.name }}"
    tag: "{{ item.tag }}"
    push: yes
    repository: "{{ serapeum_registry_hostname }}:{{ serapeum_registry_port }}/{{ item.namespace }}/{{ item.name }}"
  with_items:
  - "{{ serapeum_docker_images }}"
  when:
      - registry_started
      - docker_images_loaded
  register: docker_images_uploaded
{'fraction_non_alphanumeric': 0.3090705487122061, 'fraction_numerical': 0.0, 'mean_word_length': 1.768753874767514, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7290123', 'n_tokens_mistral': 1274, 'n_tokens_neox': 1238, 'n_words': 255}