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] Add new fvt-sls pipeline #975

Merged
merged 6 commits into from
May 22, 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
52 changes: 52 additions & 0 deletions image/cli/masfvt/fvt-sls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
- hosts: localhost
any_errors_fatal: true
vars:
# Image Pull Policy
image_pull_policy: "{{ lookup('env', 'IMAGE_PULL_POLICY') }}"
# MAS Details
mas_channel: "{{ lookup('env', 'MAS_CHANNEL') }}"
mas_instance_id: "{{ lookup('env', 'MAS_INSTANCE_ID') }}"
mas_workspace_id: "{{ lookup('env', 'MAS_WORKSPACE_ID') }}"
# FVT Configuration
fvt_image_registry: "{{ lookup('env', 'FVT_IMAGE_REGISTRY') }}"
fvt_artifactory_username: "{{ lookup('env', 'FVT_ARTIFACTORY_USERNAME') }}"
fvt_artifactory_token: "{{ lookup('env', 'FVT_ARTIFACTORY_TOKEN') }}"
fvt_digest_sls: "{{ lookup('env', 'FVT_DIGEST_SLS') }}"
#Dependencies - SLS
sls_namespace: "{{ lookup('env', 'SLS_NAMESPACE') }}"
sls_channel: "{{ lookup('env', 'SLS_CHANNEL') }}"
# Pipeline Run Info
devops_build_number: "{{ lookup('env', 'DEVOPS_BUILD_NUMBER') | default('0', True) }}"
pipelinerun_name: "{{ lookup('env', 'PIPELINERUN_NAME') | default('mas-fvt-sls', True) }}-{{ devops_build_number }}"
pipelinerun_namespace: "{{ lookup('env', 'PIPELINERUN_NAMESPACE') | default('mas-' ~ mas_instance_id ~ '-pipelines', True) }}"
tasks:
- name: "Debug"
debug:
msg:
- "pipelinerun_namespace ................... {{ pipelinerun_namespace }}"
- "pipelinerun_name ........................ {{ pipelinerun_name }}"
- ""
- "image_pull_policy ....................... {{ image_pull_policy }}"
- ""
- "sls_namespace ........................... {{ sls_namespace }}"
- "sls_channel ............................. {{ sls_channel }}"
- ""
- "mas_instance_id ......................... {{ mas_instance_id }}"
- "mas_channel ............................. {{ mas_channel }}"
- "mas_workspace_id ........................ {{ mas_workspace_id }}"
- ""
- "devops_build_number ..................... {{ devops_build_number }}"
- ""
- "fvt_image_registry ...................... {{ fvt_image_registry }}"
- "fvt_artifactory_username ................ {{ fvt_artifactory_username }}"
- "fvt_artifactory_token ................... ************"
- ""
- "SLS FVT"
- ""
- "fvt_digest_sls .......................... {{ fvt_digest_sls }}"

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

serviceAccountName: pipeline
timeouts:
pipeline: "8h"

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

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

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

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

# Dependencies - SLS
- name: sls_namespace
value: "{{ sls_namespace }}"
- name: sls_channel
value: "{{ sls_channel }}"

workspaces:
# The generated configuration files
- name: shared-configs
persistentVolumeClaim:
claimName: config-pvc
# PodTemplates configurations
- name: shared-pod-templates
secret:
secretName: pipeline-pod-templates
1 change: 1 addition & 0 deletions tekton/generate-tekton-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
with_items:
- launchfvt-assist
- launchfvt-core
- launchfvt-sls
- launchfvt-iot
- launchfvt-manage
- launchfvt-manage-health
Expand Down
35 changes: 16 additions & 19 deletions tekton/src/pipelines/fvt-launcher.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -103,23 +103,21 @@ spec:
operator: in
values: ["true", "True"]

# See: https://jsw.ibm.com/browse/IBMSLS-17
# - name: launchfvt-sls
# taskRef:
# kind: Task
# name: mas-launchfvt-sls
# params:
# - name: image_pull_policy
# value: $(params.image_pull_policy)
# - name: pipelinerun_name
# value: "$(params.mas_instance_id)-fvt-sls"
# when:
# - input: $(params.launchfvt_core)
# operator: in
# values: ["true", "True"]
# runAfter:
# - waitfor-suite-verify
#
- name: launchfvt-sls
taskRef:
kind: Task
name: mas-launchfvt-sls
params:
- name: image_pull_policy
value: $(params.image_pull_policy)
- name: pipelinerun_name
value: "$(params.mas_instance_id)-fvt-sls"
when:
- input: $(params.launchfvt_core)
operator: in
values: ["true", "True"]
runAfter:
- waitfor-suite-verify

- name: launchfvt-core
taskRef:
Expand Down Expand Up @@ -156,8 +154,7 @@ spec:
values: ["true", "True"]
runAfter:
- launchfvt-core
# See: https://jsw.ibm.com/browse/IBMSLS-17
# - launchfvt-sls
- launchfvt-sls


# 2. Application FVT - Assist
Expand Down
126 changes: 126 additions & 0 deletions tekton/src/tasks/fvt-launcher/launchfvt-sls.yml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: mas-launchfvt-sls
spec:
params:
# Control the image pull policy for the FVT container image
- name: image_pull_policy
type: string
default: IfNotPresent

- name: pipelinerun_name
type: string

steps:
- name: start-pipelinerun
image: quay.io/ibmmas/cli:latest
imagePullPolicy: $(params.image_pull_policy)
command:
- ansible-playbook
- /masfvt/fvt-sls.yml
env:
- name: IMAGE_PULL_POLICY
value: $(params.image_pull_policy)
- name: PIPELINERUN_NAME
value: $(params.pipelinerun_name)
- name: PIPELINERUN_NAMESPACE
value: $(context.taskRun.namespace)

# Lookups from mas-devops
# -----------------------------------------------------------------------
- name: DEVOPS_BUILD_NUMBER
valueFrom:
secretKeyRef:
name: mas-devops
key: DEVOPS_BUILD_NUMBER
optional: true
- name: MAS_INSTANCE_ID
valueFrom:
secretKeyRef:
name: mas-devops
key: MAS_INSTANCE_ID
optional: false

# Lookups from mas-fvt
# -----------------------------------------------------------------------
- name: FVT_IMAGE_REGISTRY
valueFrom:
secretKeyRef:
name: mas-fvt
key: FVT_IMAGE_REGISTRY
optional: false
- name: FVT_ARTIFACTORY_USERNAME
valueFrom:
secretKeyRef:
name: mas-fvt
key: FVT_ARTIFACTORY_USERNAME
optional: false
- name: FVT_ARTIFACTORY_TOKEN
valueFrom:
secretKeyRef:
name: mas-fvt
key: FVT_ARTIFACTORY_TOKEN
optional: false

# Lookups from mas-fvt-sls
# -----------------------------------------------------------------------
# Framework Information
- name: MAS_CHANNEL
valueFrom:
secretKeyRef:
name: mas-fvt-sls
key: MAS_CHANNEL
optional: false
- name: MAS_WORKSPACE_ID
valueFrom:
secretKeyRef:
name: mas-fvt-sls
key: MAS_WORKSPACE_ID
optional: false
# Digests
- name: FVT_DIGEST_SLS
valueFrom:
secretKeyRef:
name: mas-fvt-sls
key: FVT_DIGEST_SLS
optional: false
- name: SLS_NAMESPACE
valueFrom:
secretKeyRef:
name: mas-fvt-sls
key: SLS_NAMESPACE
optional: false
- name: SLS_CHANNEL
valueFrom:
secretKeyRef:
name: mas-fvt-sls
key: SLS_CHANNEL
optional: false

- name: wait-for-pipelinerun
image: quay.io/ibmmas/cli:latest
imagePullPolicy: $(params.image_pull_policy)
# 15 retries at 5 minute intervals = just over 1 hour
command:
- /opt/app-root/src/wait-for-tekton.sh
env:
- name: TYPE
value: pipelinerun
- name: NAME
value: $(params.pipelinerun_name)
- name: SUFFIX
valueFrom:
secretKeyRef:
name: mas-devops
key: DEVOPS_BUILD_NUMBER
optional: true
- name: NAMESPACE
value: $(context.taskRun.namespace)
- name: DELAY
value: "300"
- name: MAX_RETRIES
value: "15"
- name: IGNORE_FAILURE
value: "True"
Loading