c39c595d7739a5354818c377b857b849a3f141f7
[osm/devops.git] /
1 #######################################################################################
2 # Copyright ETSI Contributors and Others.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #    http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13 # implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #######################################################################################
17
18 apiVersion: argoproj.io/v1alpha1
19 kind: WorkflowTemplate
20 metadata:
21   name: full-delete-oka-wtf
22   namespace: osm-workflows
23 spec:
24   arguments:
25     parameters:
26     # SW-Catalogs repo
27     - name: git_sw_catalogs_url
28     - name: sw_catalogs_destination_folder
29     - name: git_sw_catalogs_cred_secret
30     # Specific parameters - OKA
31     - name: oka_name
32     ## Choose among `infra-controllers`, `infra-configs`, `cloud-resources`, `apps`:
33     - name: oka_type
34     - name: project_name
35       value: "osm_admin"
36     # Debug/dry run?
37     - name: debug
38       value: "false"
39     - name: dry_run
40       value: "false"
41
42   # Cleanup policy
43   ttlStrategy:
44     secondsAfterCompletion: 6000  # Time to live after workflow is completed, replaces ttlSecondsAfterFinished
45     secondsAfterSuccess: 6000     # Time to live after workflow is successful
46     secondsAfterFailure: 9000     # Time to live after workflow fails
47
48   entrypoint: delete-oka
49
50   templates:
51   # Main template
52   - name: delete-oka
53     inputs:
54       parameters:
55       - name: git_sw_catalogs_url
56       - name: sw_catalogs_destination_folder
57       - name: git_sw_catalogs_cred_secret
58       - name: oka_name
59       - name: oka_type
60       - name: project_name
61       - name: debug
62       - name: dry_run
63     steps:
64     # ------ Preparations for transaction
65     - - name: generate-sw-catalogs-volume-repo
66         templateRef:
67           name: k8s-resources-wft
68           template: generate-volume
69         arguments:
70           parameters:
71             - name: pvc-size
72               value: '100Mi'
73     - - name: clone-sw-catalogs
74         templateRef:
75           name: git-wft
76           template: git-clone
77         arguments:
78           parameters:
79           - name: mount_path
80             value: "/sw-catalogs"
81           - name: repo_url
82             value: "{{inputs.parameters.git_sw_catalogs_url}}"
83           - name: destination_folder
84             value: "{{inputs.parameters.sw_catalogs_destination_folder}}"
85           - name: git_cred_secret
86             value: "{{inputs.parameters.git_sw_catalogs_cred_secret}}"
87           - name: git_volume_name
88             value: '{{steps.generate-sw-catalogs-volume-repo.outputs.parameters.pvc-name}}'
89     # ------ end of preparations for transaction
90
91     # ------ Transformations
92     - - name: delete-oka
93         templateRef:
94           name: oka-management-wft
95           template: delete-oka
96         arguments:
97           parameters:
98           # References to required external resources
99           - name: sw_catalogs_volume_name
100             value: '{{steps.generate-sw-catalogs-volume-repo.outputs.parameters.pvc-name}}'
101           # Specific parameters
102           - name: oka_name
103             value: "{{inputs.parameters.oka_name}}"
104           - name: oka_type
105             value: "{{inputs.parameters.oka_type}}"
106           - name: project_name
107             value: "{{inputs.parameters.project_name}}"
108           # Debug?
109           - name: debug
110             value: "{{inputs.parameters.debug}}"
111     # ------ end of transformations
112
113     # ------ Commit transaction
114     - - name: push-to-sw-catalogs
115         templateRef:
116           name: git-wft
117           template: git-commit-merge-push
118         arguments:
119           parameters:
120           - name: mount_path
121             value: "/sw-catalogs"
122           - name: repo_folder
123             value: "{{inputs.parameters.sw_catalogs_destination_folder}}"
124           - name: git_cred_secret
125             value: "{{inputs.parameters.git_sw_catalogs_cred_secret}}"
126           - name: git_volume_name
127             value: '{{steps.generate-sw-catalogs-volume-repo.outputs.parameters.pvc-name}}'
128           - name: commit_message
129             value: "Delete OKA {{inputs.parameters.oka_name}} of {{inputs.parameters.oka_type}} type @ {{inputs.parameters.project_name}} project"
130           - name: main_branch
131             value: main
132           - name: contrib_branch
133             value: osm_contrib
134           - name: dry_run
135             value: "{{inputs.parameters.dry_run}}"
136 # ------ end of commit transaction