Skip to content

Commit

Permalink
[minor] Mobile FVT pipelines clean up and reorganization (#1196)
Browse files Browse the repository at this point in the history
  • Loading branch information
leo-miran authored Aug 22, 2024
1 parent 467df9d commit 9071721
Show file tree
Hide file tree
Showing 32 changed files with 759 additions and 520 deletions.
6 changes: 3 additions & 3 deletions image/cli/app-root/src/mobile-version-finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def get_mobile_and_is_image_tags():
images = yaml.safe_load(cat_result)
images_json.update({"mobileapi": images["defaultTags"]["mobileapi"]})
except Exception as e:
print(f"Unable to catch images file from entitymgr pod: {e}")
print(f"Unable to catch images file from core's entitymgr-suite pod: {e}")
sys.exit(1)

# getting industry solutions images version from entitymgr-ws
Expand Down Expand Up @@ -285,7 +285,7 @@ def get_mobile_and_is_image_tags():
images_json.update(images["defaultTags"])

except Exception as e:
print(f"Unable to catch images file from entitymgr pod: {e}")
print(f"Unable to catch images file from Manage's entitymgr-ws pod: {e}")
sys.exit(1)

images_json_sorted = OrderedDict(sorted(images_json.items()))
Expand All @@ -295,7 +295,7 @@ def get_mobile_and_is_image_tags():

def artifactory_upload():

url = artDir + "/" + output_filename
url = artDir + "/fvt-mobile/" + output_filename
bearer = f"Bearer {artKey}"
headers = {"content-type": "application/json", "Authorization": bearer}

Expand Down
51 changes: 51 additions & 0 deletions image/cli/masfvt/fvt-mobile-pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
- hosts: localhost
any_errors_fatal: true
vars:
# Image Pull Policy
image_pull_policy: "{{ lookup('env', 'IMAGE_PULL_POLICY') }}"

#Registry
fvt_image_registry: "{{ lookup('env', 'FVT_IMAGE_REGISTRY') }}"
fvt_artifactory_token: "{{ lookup('env', 'FVT_ARTIFACTORY_TOKEN') }}"

# MAS Details
mas_channel: "{{ lookup('env', 'MAS_CHANNEL') }}"
mas_app_channel_manage: "{{ lookup('env', 'MAS_APP_CHANNEL_MANAGE') }}"
mas_instance_id: "{{ lookup('env', 'MAS_INSTANCE_ID') }}"
mas_workspace_id: "{{ lookup('env', 'MAS_WORKSPACE_ID') }}"

# Black and white listing
fvt_blacklist: "{{ lookup('env', 'FVT_BLACKLIST') }}"
fvt_whitelist: "{{ lookup('env', 'FVT_WHITELIST') }}"

# FVT Configuration
fvt_digest_mobile_pytest: "{{ lookup('env', 'FVT_DIGEST_MOBILE_PYTEST') }}"

# Pipeline Run Info
devops_build_number: "{{ lookup('env', 'DEVOPS_BUILD_NUMBER') | default('0', True) }}"
pipelinerun_name: "{{ lookup('env', 'PIPELINERUN_NAME') | default('mas-fvt-mobile-pytest', True) }}-{{ devops_build_number }}"
pipelinerun_namespace: "{{ lookup('env', 'PIPELINERUN_NAMESPACE') | default('mas-' ~ mas_instance_id ~ '-pipelines', True) }}"
tasks:
- name: "Debug"
debug:
msg:
- "pipelinerun_name ......................... {{ pipelinerun_name }}"
- "pipelinerun_namespace .................... {{ pipelinerun_namespace }}"
- ""
- "mas_channel .............................. {{ mas_channel }}"
- "mas_app_channel_manage ................... {{ mas_app_channel_manage }}"
- "mas_instance_id .......................... {{ mas_instance_id }}"
- "mas_workspace_id ......................... {{ mas_workspace_id }}"
- ""
- "fvt_image_registry ....................... {{ fvt_image_registry }}"
- "fvt_artifactory_token .................... {{ fvt_artifactory_token }}"
- "fvt_digest_mobile_pytest ................. {{ fvt_digest_mobile_pytest }}"
- ""
- "fvt_blacklist ..................... {{ fvt_blacklist }}"
- "fvt_whitelist ..................... {{ fvt_whitelist }}"

- name: "Start fvt-mobile-pytest pipeline"
kubernetes.core.k8s:
apply: true
template: templates/mas-fvt-mobile-pytest.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@
fvt_whitelist: "{{ lookup('env', 'FVT_WHITELIST') }}"

# FVT Configuration
fvt_digest_mobile_pytest: "{{ lookup('env', 'FVT_DIGEST_MOBILE_PYTEST') }}"
fvt_digest_mobile_testng: "{{ lookup('env', 'FVT_DIGEST_MOBILE_TESTNG') }}"
fvt_digest_manage_civil_selenium: "{{ lookup('env', 'FVT_DIGEST_MANAGE_CIVIL_SELENIUM') }}"

# Pipeline Run Info
devops_build_number: "{{ lookup('env', 'DEVOPS_BUILD_NUMBER') | default('0', True) }}"
pipelinerun_name: "{{ lookup('env', 'PIPELINERUN_NAME') | default('mas-fvt-mobile', True) }}-{{ devops_build_number }}"
pipelinerun_name: "{{ lookup('env', 'PIPELINERUN_NAME') | default('mas-fvt-mobile-testng', True) }}-{{ devops_build_number }}"
pipelinerun_namespace: "{{ lookup('env', 'PIPELINERUN_NAMESPACE') | default('mas-' ~ mas_instance_id ~ '-pipelines', True) }}"
tasks:
- name: "Debug"
Expand All @@ -42,14 +41,13 @@
- ""
- "fvt_image_registry ....................... {{ fvt_image_registry }}"
- "fvt_artifactory_token .................... {{ fvt_artifactory_token }}"
- "fvt_digest_mobile_pytest ................. {{ fvt_digest_mobile_pytest }}"
- "fvt_digest_mobile_testng ................. {{ fvt_digest_mobile_testng }}"
- "fvt_digest_manage_civil_selenium ......... {{ fvt_digest_manage_civil_selenium }}"
- ""
- "fvt_blacklist ..................... {{ fvt_blacklist }}"
- "fvt_whitelist ..................... {{ fvt_whitelist }}"

- name: "Start fvt-mobile pipeline"
- name: "Start fvt-mobile-testng pipeline"
kubernetes.core.k8s:
apply: true
template: templates/mas-fvt-mobile.yml.j2
template: templates/mas-fvt-mobile-testng.yml.j2
46 changes: 46 additions & 0 deletions image/cli/masfvt/templates/mas-fvt-mobile-pytest.yml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: "{{ pipelinerun_name }}"
namespace: "{{ pipelinerun_namespace }}"
labels:
tekton.dev/pipeline: mas-fvt-mobile-pytest
spec:
pipelineRef:
name: mas-fvt-mobile-pytest

serviceAccountName: pipeline
timeouts:
pipeline: "8h"

params:
# Pull Policy
- name: image_pull_policy
value: "{{ image_pull_policy }}"

# Registry
- name: fvt_image_registry
value: "{{ fvt_image_registry }}"
- name: fvt_artifactory_token
value: "{{ fvt_artifactory_token }}"

# MAS Info
- name: mas_channel
value: "{{ mas_channel }}"
- name: mas_app_channel_manage
value: "{{ mas_app_channel_manage }}"
- name: mas_instance_id
value: "{{ mas_instance_id }}"
- name: mas_workspace_id
value: "{{ mas_workspace_id }}"

# Digests
- name: fvt_digest_mobile_pytest
value: "{{ fvt_digest_mobile_pytest }}"

workspaces:
# The generated configuration files
- name: shared-configs
persistentVolumeClaim:
claimName: config-pvc
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ metadata:
name: "{{ pipelinerun_name }}"
namespace: "{{ pipelinerun_namespace }}"
labels:
tekton.dev/pipeline: mas-fvt-mobile
tekton.dev/pipeline: mas-fvt-mobile-testng
spec:
pipelineRef:
name: mas-fvt-mobile
name: mas-fvt-mobile-testng

serviceAccountName: pipeline
timeouts:
Expand Down Expand Up @@ -36,8 +36,6 @@ spec:
value: "{{ mas_workspace_id }}"

# Digests
- name: fvt_digest_mobile_pytest
value: "{{ fvt_digest_mobile_pytest }}"
- name: fvt_digest_mobile_testng
value: "{{ fvt_digest_mobile_testng }}"
- name: fvt_digest_manage_civil_selenium
Expand Down
3 changes: 2 additions & 1 deletion tekton/generate-tekton-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
- fvt-manage
- fvt-manage-is
- fvt-manage-regr
- fvt-mobile
- fvt-mobile-pytest
- fvt-mobile-testng
- fvt-monitor
- fvt-optimizer
- fvt-predict
Expand Down
2 changes: 1 addition & 1 deletion tekton/generate-tekton-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
- fvt-finalize
- fvt-iot
- fvt-manage
- fvt-mobile
- fvt-mobile-testng
- fvt-mobile-pytest
- fvt-manage-directprint
- fvt-manage-adhoc-report
Expand Down
6 changes: 4 additions & 2 deletions tekton/src/pipelines/fvt-launcher.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,10 @@ spec:
params:
- name: image_pull_policy
value: $(params.image_pull_policy)
- name: pipelinerun_name
value: "$(params.mas_instance_id)-fvt-mobile"
- name: pipelinerun_name_testng
value: "$(params.mas_instance_id)-fvt-mobile-testng"
- name: pipelinerun_name_pytest
value: "$(params.mas_instance_id)-fvt-mobile-pytest"
taskRef:
kind: Task
name: mas-launchfvt-mobile
Expand Down
51 changes: 51 additions & 0 deletions tekton/src/pipelines/fvt-mobile-pytest.yml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: mas-fvt-mobile-pytest
spec:
workspaces:
# The generated configuration files
- name: shared-configs

params:
# Tekton Pipeline image pull policy (for ibmmas/cli images)
- name: image_pull_policy
type: string
default: IfNotPresent
description: Pull policy for pipeline container images

# MAS Configuration
- name: mas_channel
type: string
default: ""
- name: mas_app_channel_manage
type: string
default: ""
- name: mas_instance_id
type: string
default: ""
- name: mas_workspace_id
type: string
default: ""

# FVT Configuration
- name: fvt_image_registry
type: string
default: ""
- name: fvt_artifactory_token
type: string
default: ""

# FVT: Mobile Digests
- name: fvt_digest_mobile_pytest
type: string
default: ""

tasks:
# 2. Manage FVT - Manage Mobile
# -------------------------------------------------------------------------

{{ lookup('template', 'taskdefs/fvt-mobile/pytest/phase1-setup.yml.j2') | indent(4) }}
{{ lookup('template', 'taskdefs/fvt-mobile/pytest/phase2-apps.yml.j2') | indent(4) }}

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: mas-fvt-mobile
name: mas-fvt-mobile-testng
spec:
workspaces:
# The generated configuration files
Expand Down Expand Up @@ -54,14 +54,9 @@ spec:
# 2. Manage FVT - Manage Mobile
# -------------------------------------------------------------------------

{{ lookup('template', 'taskdefs/fvt-mobile/phase1-setup.yml.j2') | indent(4) }}
{{ lookup('template', 'taskdefs/fvt-mobile/phase1.4-pytest.yml.j2') | indent(4) }}
{{ lookup('template', 'taskdefs/fvt-mobile/phase1.5-selenium-civil.yml.j2') | indent(4) }}
{{ lookup('template', 'taskdefs/fvt-mobile/phase2-android-part1.yml.j2') | indent(4) }}
{{ lookup('template', 'taskdefs/fvt-mobile/phase3-android-part2.yml.j2') | indent(4) }}
{{ lookup('template', 'taskdefs/fvt-mobile/phase4-android-part3.yml.j2') | indent(4) }}
{{ lookup('template', 'taskdefs/fvt-mobile/phase5-ios-part1.yml.j2') | indent(4) }}
{{ lookup('template', 'taskdefs/fvt-mobile/phase6-ios-part2.yml.j2') | indent(4) }}
{{ lookup('template', 'taskdefs/fvt-mobile/phase7-ios-part3.yml.j2') | indent(4) }}
{{ lookup('template', 'taskdefs/fvt-mobile/phase8-desktop.yml.j2') | indent(4) }}

{{ lookup('template', 'taskdefs/fvt-mobile/testng/phase0-civil.yml.j2') | indent(4) }}
{{ lookup('template', 'taskdefs/fvt-mobile/testng/phase1-android.yml.j2') | indent(4) }}
{{ lookup('template', 'taskdefs/fvt-mobile/testng/phase2-android.yml.j2') | indent(4) }}
{{ lookup('template', 'taskdefs/fvt-mobile/testng/phase3-ios.yml.j2') | indent(4) }}
{{ lookup('template', 'taskdefs/fvt-mobile/testng/phase4-ios.yml.j2') | indent(4) }}
{{ lookup('template', 'taskdefs/fvt-mobile/testng/phase5-desktop.yml.j2') | indent(4) }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- name: fvt_image_registry
value: $(params.fvt_image_registry)
- name: fvt_image_digest
value: $(params.fvt_digest_mobile_pytest)
- name: mas_instance_id
value: $(params.mas_instance_id)
- name: mas_workspace_id
value: $(params.mas_workspace_id)
- name: product_channel
value: $(params.mas_app_channel_manage)
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
taskRef:
kind: Task
name: mas-fvt-mobile-pytest
workspaces:
- name: configs
workspace: shared-configs
when:
- input: "$(params.mas_app_channel_manage)"
operator: notin
values: [""]
- input: "$(params.fvt_digest_mobile_pytest)"
operator: notin
values: [""]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
taskRef:
kind: Task
name: mas-fvt-mobile
name: mas-fvt-mobile-testng
workspaces:
- name: configs
workspace: shared-configs
Expand Down
Loading

0 comments on commit 9071721

Please sign in to comment.