Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[minor] Manage FVT Phase 5 #859

Merged
merged 22 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions image/cli/app-root/src/finalizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,21 @@ def buildContext(texts):
}


# Get Kafka Provider and Version
# -------------------------------------------------------------------------
def getKafkaVersion(namespace):
try:
crs = dynClient.resources.get(api_version="kafka.strimzi.io/v1beta2", kind="Kafka")
cr = crs.get(name=f"mas-{instanceId}-system", namespace=f"{namespace}")
if cr.status and cr.status.kafkaVersion:
return cr.status.kafkaVersion
else:
print(f"Unable to determine kafka version: status.KafkaVersion unavailable")
except Exception as e:
print(f"Unable to determine kafka version: {e}")
return "unknown"


# Script start
# -----------------------------------------------------------------------------
if __name__ == "__main__":
Expand Down Expand Up @@ -277,6 +292,77 @@ def buildContext(texts):
except Exception as e:
print(f"Unable to determine Maximo Process Automation Engine (MPAE) version: {e}")

# Get DB2 CLuster Version
# -------------------------------------------------------------------------
try:
crs = dynClient.resources.get(api_version="db2u.databases.ibm.com/v1", kind="Db2uCluster")
cr = crs.get(name=f"mas-{instanceId}-system", namespace="db2u")
if cr.status and cr.status.version:
db2ClusterVersion = cr.status.version

setObject[f"target.db2ClusterVersion"] = db2ClusterVersion
else:
print(f"Unable to determine DB2 cluster version: status.version unavailable")
except Exception as e:
print(f"Unable to determine DB2 cluster version: {e}")

# Lookup DB2 operator version
# -------------------------------------------------------------------------
try:

csvl = dynClient.resources.get(api_version="operators.coreos.com/v1alpha1", kind="ClusterServiceVersion")
csv = csvl.get(namespace=f"db2u",label_selector=f'operators.coreos.com/db2u-operator.db2u')

if csv is None or csv.items is None or len(csv.items) == 0:
print(f"Unable to determine DB2 operator version: component unavailable")
else:
db2OperatorVersion= (csv.items[0].metadata.name).lstrip('db2u-operator.')
setObject[f"target.db2OperatorVersion"] = db2OperatorVersion
except Exception as e:
print(f"Unable to determine DB2 operator version: {e}")

# Get Kafka Provider and Version
# -------------------------------------------------------------------------
namespace=''
try:
crs = dynClient.resources.get(api_version="config.mas.ibm.com/v1", kind="KafkaCfg")
cr = crs.get(name=f"{instanceId}-kafka-system", namespace=f"mas-{instanceId}-core")
if cr.status and cr.status.config.hosts:
firstBroker = cr.status.config.hosts[0].host
if firstBroker.find('eventstreams') != -1:
setObject[f"target.kafkaProvider"] = 'External'
elif firstBroker.find('amq-streams') != -1:
setObject[f"target.kafkaProvider"] = 'AMQ'
namespace="amq-streams"
elif firstBroker.find('strimzi') != -1:
setObject[f"target.kafkaProvider"] = 'STRIMZI'
namespace="strimzi"
else:
print(f"Unable to determine kafka provider using broker host")
# check if we need to get the kafka version, this will happen with AMQ and STRIMZI
if namespace != '':
setObject[f"target.kafkaVersion"] = getKafkaVersion(namespace)
else:
setObject[f"target.kafkaVersion"] = 'unknown'
else:
print(f"Unable to determine kafka provider: status.config.hosts unavailable")
except Exception as e:
print(f"Unable to determine kafka provider and version: {e}")

# Lookup SLS version
# -------------------------------------------------------------------------
try:
crs = dynClient.resources.get(api_version="sls.ibm.com/v1", kind="LicenseService")
cr = crs.get(name=f"sls", namespace="ibm-sls")
if cr.status and cr.status.versions:
slsVersion = cr.status.versions.reconciled
print(slsVersion)
setObject[f"target.slsVersion"] = slsVersion
else:
print(f"Unable to determine SLS version: status.versions unavailable")
except Exception as e:
print(f"Unable to determine SLS version: {e}")

# Connect to mongoDb
# -------------------------------------------------------------------------
client = MongoClient(os.getenv("DEVOPS_MONGO_URI"))
Expand Down
36 changes: 30 additions & 6 deletions tekton/src/pipelines/fvt-manage-is.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,35 @@ spec:
- name: fvt_digest_manage
type: string
default: ""
- name: fvt_digest_manage_pytest
type: string
default: ""

tasks:
{{ lookup('template', 'taskdefs/fvt-manage-is/phase0-aviation.yml.j2') | indent(4) }}
{{ lookup('template', 'taskdefs/fvt-manage-is/phase1-scheduler.yml.j2') | indent(4) }}
{{ lookup('template', 'taskdefs/fvt-manage-is/phase2-all-setup.yml.j2') | indent(4) }}
{{ lookup('template', 'taskdefs/fvt-manage-is/phase3-all-user.yml.j2') | indent(4) }}
{{ lookup('template', 'taskdefs/fvt-manage-is/phase4-all-test.yml.j2') | indent(4) }}
{{ lookup('template', 'taskdefs/fvt-manage-is/phase5-maintmanager.yml.j2') | indent(4) }}

# ----------------------------------------
# Manage Industry Solutions Setup
# Responsible for:
# - User Creation
# - Add User into Security Group
# - Set User's Default Site
# ----------------------------------------
- name: fvt-manage-setup-is # convention: use fvt-manage-<keyword>, as the value of fvt_test_suite parameter
{{ lookup('template', 'taskdefs/fvt-manage/api/taskref.yml.j2') | indent(6) }}
params:
{{ lookup('template', 'taskdefs/fvt-manage/api/params.yml.j2') | indent(8) }}
- name: fvt_test_suite_prefix
value: base
- name: fvt_test_suite
value: setup-is

# ----------------------------------------
# Industry Solution Tests
# ----------------------------------------
{{ lookup('template', 'taskdefs/fvt-manage-is/acm.yml.j2') | indent(4) }}
{{ lookup('template', 'taskdefs/fvt-manage-is/scheduler.yml.j2') | indent(4) }}
{{ lookup('template', 'taskdefs/fvt-manage-is/maintmanager.yml.j2') | indent(4) }}

# Tests within _others will be re-introduced later
# ------------------------
{# {{ lookup('template', 'taskdefs/fvt-manage-is/_oyhers.yml.j2') | indent(4) }} #}
7 changes: 1 addition & 6 deletions tekton/src/pipelines/fvt-manage.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,14 @@ spec:
operator: notin
values: [""]


# 2. Manage FVT - Manage
# -------------------------------------------------------------------------
{{ lookup('template', 'taskdefs/fvt-manage/phase0.yml.j2') | indent(4) }}
{{ lookup('template', 'taskdefs/fvt-manage/phase1.yml.j2') | indent(4) }}
{{ lookup('template', 'taskdefs/fvt-manage/phase2.yml.j2') | indent(4) }}
{{ lookup('template', 'taskdefs/fvt-manage/phase3.yml.j2') | indent(4) }}
{{ lookup('template', 'taskdefs/fvt-manage/phase4.yml.j2') | indent(4) }}

# Phase 5 disabled. Focus on getting phase 0-4 suites 100% reliable
# -------------------------------------------------------------------------
# Re-introduce phases 1-by-1 while maintaining a stable state
# lookup('template', 'taskdefs/fvt-manage/phase5.yml.j2') | indent(4)
{{ lookup('template', 'taskdefs/fvt-manage/phase5.yml.j2') | indent(4) }}

finally:
# 3. Run CV
Expand Down
Loading
Loading