Skip to content

Commit 902e85d

Browse files
eduolivareslewisdenny
authored andcommitted
[devscripts] Allow using OCP stable versions
With this patch, ci-fmw allows to configure devscripts openshift_version values "stable-<majorversion>" (e.g. "stable-4.18") which is dynamically updated every time a new minor version becomes the latest stable. Example: https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable-4.18/
1 parent f86744e commit 902e85d

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

roles/devscripts/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ If you provide neither, or both, it will fail.
7676

7777
### Supported keys in cifmw_devscripts_config_overrides
7878

79+
The `openshift_version` value can be set to either a minor version "X.Y.Z" (e.g.
80+
4.16.0) or a stable version "stable-X.Y" (e.g. stable-4.16), which would be
81+
translated to the corresponding minor version.
82+
Allowed values can be found [here](https://mirror.openshift.com/pub/openshift-v4/clients/ocp/)
83+
7984
| Key | Default Value | Description |
8085
| --- | ------------- | ----------- |
8186
| working_dir | `/home/dev-scripts` | Path to the directory to store script artifacts. |

roles/devscripts/tasks/build_config.yml

+10
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@
4040
devscripts_config_patches
4141
}}
4242
43+
- name: Replace OCP version if "stable-" alias used
44+
when:
45+
- cifmw_devscripts_config.openshift_version.startswith("stable-")
46+
vars:
47+
_ocp_release_txt: "{{ lookup('ansible.builtin.url', 'https://mirror.openshift.com/pub/openshift-v4/clients/ocp/' ~ cifmw_devscripts_config.openshift_version ~ '/release.txt', split_lines=False) }}"
48+
_ocp_release_name: "{{ _ocp_release_txt | regex_search('^Name:.*', multiline=True) }}"
49+
_ocp_release_version: "{{ _ocp_release_name.split()[1] }}"
50+
ansible.builtin.set_fact:
51+
cifmw_devscripts_config: "{{ cifmw_devscripts_config | combine({'openshift_version': _ocp_release_version}) }}"
52+
4353
- name: Ensure output directory exists
4454
become: true
4555
ansible.builtin.file:

0 commit comments

Comments
 (0)