-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #332 from redhatci/idms_on_mor
Produce IDMS for 4.14+
- Loading branch information
Showing
7 changed files
with
70 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
%global forgeurl https://github.com/%{org}/%{repo} | ||
|
||
Name: %{repo} | ||
Version: 0.10.EPOCH | ||
Version: 0.11.EPOCH | ||
Release: VERS%{?dist} | ||
Summary: Red Hat OCP CI Collection for Ansible | ||
|
||
|
@@ -51,6 +51,9 @@ find -type f ! -executable -name '*.py' -print -exec sed -i -e '1{\@^#!.*@d}' '{ | |
|
||
|
||
%changelog | ||
* Fri Jun 14 2024 Tony Garcia <[email protected]> - 0.11.EPOCH-VERS | ||
- Version bump due to mirror_ocp_release role | ||
|
||
* Thu May 9 2024 Tony Garcia <[email protected]> - 0.10.EPOCH-VERS | ||
- Version bump in the collection due to baremetal installer 4.16+ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,57 @@ | ||
--- | ||
- name: "OCP release mirror" | ||
block: | ||
- name: "Check if the release image is pullable from the local registry" | ||
ansible.builtin.command: > | ||
skopeo inspect | ||
--no-tags | ||
--authfile {{ mor_auths_file }} | ||
docker://{{ mor_registry_url }}/{{ mor_registry_path }}:{{ mor_version }} | ||
- name: Check if the release image is pullable from the local registry | ||
ansible.builtin.command: > | ||
skopeo inspect | ||
--no-tags | ||
--authfile {{ mor_auths_file }} | ||
docker://{{ mor_registry_url }}/{{ mor_registry_path }}:{{ mor_version }} | ||
register: _mor_release_image | ||
failed_when: false | ||
when: not mor_force | bool | ||
|
||
- name: "Check for cached Image Source file" | ||
ansible.builtin.stat: | ||
path: "{{ mor_cache_dir }}/{{ mor_version }}/imagesource.yaml" | ||
get_checksum: false | ||
register: target | ||
- name: Mirror release images to local registry | ||
ansible.builtin.command: >- | ||
{{ mor_cache_dir }}/{{ mor_version }}/oc adm release mirror | ||
--registry-config={{ mor_auths_file }} | ||
--from={{ ocp_release_data['container_image'] | quote }} | ||
--to-release-image={{ mor_registry_url }}/{{ mor_registry_path }}:{{ mor_version }} | ||
--to={{ mor_registry_url }}/{{ mor_registry_path }} | ||
retries: 3 | ||
delay: 10 | ||
register: _mor_result | ||
until: _mor_result.rc == 0 | ||
changed_when: _mor_result.rc == 0 | ||
when: _mor_release_image.rc != 0 or mor_force | bool | ||
|
||
- name: "Force mirroring if image source does not exist" | ||
ansible.builtin.fail: | ||
msg: "Cached image contents does not exits, forcing mirroring" | ||
when: not target.stat.exists | ||
- name: Generate Image Source manifest | ||
ansible.builtin.command: >- | ||
{{ mor_cache_dir }}/{{ mor_version }}/oc adm release mirror | ||
--registry-config={{ mor_auths_file }} | ||
--from={{ ocp_release_data['container_image'] | quote }} | ||
--to-release-image={{ mor_registry_url }}/{{ mor_registry_path }}:{{ mor_version }} | ||
--to={{ mor_registry_url }}/{{ mor_registry_path }} | ||
--print-mirror-instructions={{ mor_is_type | lower }} | ||
retries: 3 | ||
delay: 10 | ||
register: _mor_result | ||
until: _mor_result.rc == 0 | ||
changed_when: _mor_result.rc == 0 | ||
|
||
- name: "Force mirroring is enabled" | ||
ansible.builtin.fail: | ||
msg: "Forcing the release mirroring" | ||
when: | ||
- mor_force | bool | ||
- name: Grab generated Image Source manifest | ||
ansible.builtin.shell: > | ||
set -o pipefail; | ||
echo -e "{{ _mor_result.stdout }}" | | ||
sed -n '/apiVersion/,$p' | | ||
sed -e 's/name:.*/name: release-{{ mor_version }}/' | ||
register: is_release | ||
|
||
rescue: | ||
- name: "Mirror release images to local registry" | ||
ansible.builtin.command: > | ||
{{ mor_cache_dir }}/{{ mor_version }}/oc adm release mirror | ||
--registry-config={{ mor_auths_file }} | ||
--from={{ ocp_release_data['container_image'] | quote }} | ||
--to-release-image={{ mor_registry_url }}/{{ mor_registry_path }}:{{ mor_version }} | ||
--to={{ mor_registry_url }}/{{ mor_registry_path }} | ||
retries: 3 | ||
delay: 10 | ||
register: result | ||
until: result.rc == 0 | ||
|
||
- name: Generate Image Source manifest | ||
ansible.builtin.shell: > | ||
set -o pipefail; | ||
echo -e "{{ result.stdout }}" | | ||
sed -n '/apiVersion/,$p' | | ||
sed -e 's/name:.*/name: release-{{ mor_version }}/' | ||
register: is_release | ||
|
||
- name: Write Image Source manifest | ||
ansible.builtin.copy: | ||
dest: "{{ mor_cache_dir }}/{{ mor_version }}/imagesource.yaml" | ||
owner: "{{ mor_owner }}" | ||
group: "{{ mor_group }}" | ||
mode: "0644" | ||
setype: httpd_sys_content_t | ||
content: "{{ is_release.stdout }}" | ||
become: true | ||
- name: Write Image Source manifest | ||
ansible.builtin.copy: | ||
dest: "{{ mor_cache_dir }}/{{ mor_version }}/imagesource.yaml" | ||
owner: "{{ mor_owner }}" | ||
group: "{{ mor_group }}" | ||
mode: "0644" | ||
setype: httpd_sys_content_t | ||
content: "{{ is_release.stdout }}" | ||
become: true | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
mor_is_types: | ||
- "idms" | ||
- "icsp" |