Skip to content

Commit 8021363

Browse files
authored
Merge pull request #14 from ansible-middleware/fix_olympus_ci
Skip staging if creds are not provided.
2 parents ec9e10c + c9e8d9c commit 8021363

File tree

3 files changed

+61
-40
lines changed

3 files changed

+61
-40
lines changed

molecule/prod_eap/converge.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,21 @@
22
- name: Converge
33
hosts: localhost
44
gather_facts: no
5+
vars:
6+
client_id: "{{ lookup('env', 'PROD_JBOSSNETWORK_API_CLIENTID') }}"
7+
client_secret: "{{ lookup('env', 'PROD_JBOSSNETWORK_API_SECRET') }}"
58
tasks:
9+
- name: "Ensures required secret are provided."
10+
ansible.builtin.assert:
11+
that:
12+
- client_id is defined and client_id | length > 0
13+
- client_secret is defined and client_secret | length > 0
14+
fail_msg: "Missing required env vars PROD_JBOSSNETWORK_API_CLIENTID and/or PROD_JBOSSNETWORK_API_SECRET"
15+
616
- name: Search EAP Product
717
middleware_automation.common.product_search:
8-
client_id: "{{ lookup('env', 'PROD_JBOSSNETWORK_API_CLIENTID') }}"
9-
client_secret: "{{ lookup('env', 'PROD_JBOSSNETWORK_API_SECRET') }}"
18+
client_id: "{{ client_id }}"
19+
client_secret: "{{ client_secret }}"
1020
product_type: DISTRIBUTION
1121
product_version: '7.4'
1222
product_category: appplatform
@@ -19,8 +29,8 @@
1929

2030
- name: Retrieve product download using JBossNetwork API
2131
middleware_automation.common.product_search:
22-
client_id: "{{ lookup('env', 'PROD_JBOSSNETWORK_API_CLIENTID') }}"
23-
client_secret: "{{ lookup('env', 'PROD_JBOSSNETWORK_API_SECRET') }}"
32+
client_id: "{{ client_id }}"
33+
client_secret: "{{ client_secret }}"
2434
product_type: BUGFIX
2535
product_version: '7.4'
2636
product_category: appplatform

molecule/prod_eap/molecule.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ provisioner:
1717
interpreter_python: auto_silent
1818
ssh_connection:
1919
pipelining: false
20+
env:
21+
REDHAT_PRODUCT_DOWNLOAD_CLIENT_ID: "${REDHAT_PRODUCT_DOWNLOAD_CLIENT_ID}"
22+
REDHAT_PRODUCT_DOWNLOAD_CLIENT_SECRET: "${REDHAT_PRODUCT_DOWNLOAD_CLIENT_SECRET}"
2023
playbooks:
2124
converge: converge.yml
2225
inventory:

molecule/stage_eap/converge.yml

Lines changed: 44 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,52 @@
22
- name: Converge
33
hosts: all
44
gather_facts: yes
5-
tasks:
6-
- name: Search EAP Product
7-
middleware_automation.common.product_search:
8-
api_url: "https://jbossnetwork.stage.api.redhat.com"
9-
sso_url: "https://sso.stage.redhat.com"
5+
vars:
106
client_id: "{{ lookup('env', 'STAGE_JBOSSNETWORK_API_CLIENTID') }}"
117
client_secret: "{{ lookup('env', 'STAGE_JBOSSNETWORK_API_SECRET') }}"
12-
product_type: DISTRIBUTION
13-
product_version: '7.4'
14-
product_category: appplatform
15-
register: rhn_products
16-
no_log: false
8+
tasks:
9+
- name: Execute scenario if staging credentials are provided
10+
when:
11+
- client_id is defined and client_password is defined
12+
block:
1713

18-
- name: Search install zipfile
19-
ansible.builtin.set_fact:
20-
rhn_filtered_products: "{{ rhn_products.results | selectattr('file_path', 'match', '[^/]*/jboss-eap-7.4.0.zip$') }}"
14+
- name: Search EAP Product
15+
middleware_automation.common.product_search:
16+
api_url: "https://jbossnetwork.stage.api.redhat.com"
17+
sso_url: "https://sso.stage.redhat.com"
18+
client_id: "{{ lookup('env', 'STAGE_JBOSSNETWORK_API_CLIENTID') }}"
19+
client_secret: "{{ lookup('env', 'STAGE_JBOSSNETWORK_API_SECRET') }}"
20+
product_type: DISTRIBUTION
21+
product_version: '7.4'
22+
product_category: appplatform
23+
register: rhn_products
24+
no_log: false
2125

22-
- name: Retrieve product download using JBossNetwork API
23-
middleware_automation.common.product_search:
24-
api_url: "https://jbossnetwork.stage.api.redhat.com"
25-
sso_url: "https://sso.stage.redhat.com"
26-
client_id: "{{ lookup('env', 'STAGE_JBOSSNETWORK_API_CLIENTID') }}"
27-
client_secret: "{{ lookup('env', 'STAGE_JBOSSNETWORK_API_SECRET') }}"
28-
product_type: BUGFIX
29-
product_version: '7.4'
30-
product_category: appplatform
31-
register: rhn_products
32-
no_log: true
33-
34-
- name: Patch
35-
block:
36-
- name: Determine patch versions list
26+
- name: Search install zipfile
3727
ansible.builtin.set_fact:
38-
filtered_versions: "{{ rhn_products.results | map(attribute='file_path') | select('match', '^[^/]*/jboss-eap-.*[0-9]*[.][0-9]*[.][0-9]*.*$') | map('regex_replace','[^/]*/jboss-eap-([0-9]*[.][0-9]*[.][0-9]*)-.*','\\1' ) | list | unique }}"
39-
- name: Determine latest version
40-
ansible.builtin.debug:
41-
msg: "JBoss EAP 7.4 most recent CP is version {{ filtered_versions | middleware_automation.common.version_sort | last }}"
42-
rescue:
43-
- name: No patches on staging
44-
ansible.builtin.debug:
45-
msg: "JBoss EAP 7.4 has no patches"
28+
rhn_filtered_products: "{{ rhn_products.results | selectattr('file_path', 'match', '[^/]*/jboss-eap-7.4.0.zip$') }}"
29+
30+
- name: Retrieve product download using JBossNetwork API
31+
middleware_automation.common.product_search:
32+
api_url: "https://jbossnetwork.stage.api.redhat.com"
33+
sso_url: "https://sso.stage.redhat.com"
34+
client_id: "{{ lookup('env', 'STAGE_JBOSSNETWORK_API_CLIENTID') }}"
35+
client_secret: "{{ lookup('env', 'STAGE_JBOSSNETWORK_API_SECRET') }}"
36+
product_type: BUGFIX
37+
product_version: '7.4'
38+
product_category: appplatform
39+
register: rhn_products
40+
no_log: true
41+
42+
- name: Patch
43+
block:
44+
- name: Determine patch versions list
45+
ansible.builtin.set_fact:
46+
filtered_versions: "{{ rhn_products.results | map(attribute='file_path') | select('match', '^[^/]*/jboss-eap-.*[0-9]*[.][0-9]*[.][0-9]*.*$') | map('regex_replace','[^/]*/jboss-eap-([0-9]*[.][0-9]*[.][0-9]*)-.*','\\1' ) | list | unique }}"
47+
- name: Determine latest version
48+
ansible.builtin.debug:
49+
msg: "JBoss EAP 7.4 most recent CP is version {{ filtered_versions | middleware_automation.common.version_sort | last }}"
50+
rescue:
51+
- name: No patches on staging
52+
ansible.builtin.debug:
53+
msg: "JBoss EAP 7.4 has no patches"

0 commit comments

Comments
 (0)