b9b63eace61498feaa7f694bd4d3114b2b3f61e0
[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-create-profile-wft
22   namespace: osm-workflows
23
24 spec:
25   arguments:
26     parameters:
27
28     # Fleet repo
29     - name: git_fleet_url
30     - name: fleet_destination_folder
31     - name: git_fleet_cred_secret
32
33     # Specific parameters
34     - name: profile_name
35     - name: profile_type
36     - name: project_name
37       value: "osm_admin"
38
39     # Debugging
40     - name: dry_run
41       value: false
42
43
44   # # Cleanup policy
45   # ttlStrategy:
46   #   secondsAfterCompletion: 100 # Time to live after workflow is completed, replaces ttlSecondsAfterFinished
47   #   secondsAfterSuccess: 50     # Time to live after workflow is successful
48   #   secondsAfterFailure: 50     # Time to live after workflow fails
49
50   entrypoint: create-profile
51
52   templates:
53
54   # Main template
55   - name: create-profile
56     inputs:
57       parameters:
58       # Git repos
59       - name: git_fleet_url
60       - name: fleet_destination_folder
61       - name: git_fleet_cred_secret
62
63       # Specific parameters
64       - name: profile_name
65       - name: profile_type
66       - name: project_name
67
68       # Debugging
69       - name: dry_run
70     steps:
71
72     # ------ Preparations for transaction
73     - - name: generate-fleet-volume-repo
74         templateRef:
75           name: k8s-resources-wft
76           template: generate-volume
77         arguments:
78           parameters:
79             - name: pvc-size
80               value: '100Mi'
81     - - name: clone-fleet
82         templateRef:
83           name: git-wft
84           template: git-clone
85         arguments:
86           parameters:
87           - name: mount_path
88             value: "/fleet"
89           - name: repo_url
90             value: "{{inputs.parameters.git_fleet_url}}"
91           - name: destination_folder
92             value: "{{inputs.parameters.fleet_destination_folder}}"
93           - name: git_cred_secret
94             value: "{{inputs.parameters.git_fleet_cred_secret}}"
95           - name: git_volume_name
96             value: '{{steps.generate-fleet-volume-repo.outputs.parameters.pvc-name}}'
97     # ------ end of preparations for transaction
98
99     # ------ Transformations
100     # Create profile
101     - - name: create-profile
102         templateRef:
103           name: profile-management-wft
104           template: create-profile
105         arguments:
106           parameters:
107           # Volumes with cloned repos
108           - name: fleet_volume_name
109             value: '{{steps.generate-fleet-volume-repo.outputs.parameters.pvc-name}}'
110           - name: fleet_mount_path
111             value: "/fleet"
112           # Specific parameters
113           - name: profile_name
114             value: "{{inputs.parameters.profile_name}}"
115           - name: profile_type
116             value: "{{inputs.parameters.profile_type}}"
117           - name: project_name
118             value: "{{inputs.parameters.project_name}}"
119           - name: fleet_repo_url
120             value: "{{inputs.parameters.git_fleet_url}}"
121     # ------ end of transformations
122
123     # ------ Commit transaction
124     - - name: push-to-fleet
125         templateRef:
126           name: git-wft
127           template: git-commit-merge-push
128         arguments:
129           parameters:
130           - name: mount_path
131             value: "/fleet"
132           - name: repo_folder
133             value: "{{inputs.parameters.fleet_destination_folder}}"
134           - name: git_cred_secret
135             value: "{{inputs.parameters.git_fleet_cred_secret}}"
136           - name: git_volume_name
137             value: '{{steps.generate-fleet-volume-repo.outputs.parameters.pvc-name}}'
138           - name: commit_message
139             value: "Create profile {{inputs.parameters.profile_name}} of type {{inputs.parameters.profile_type}}"
140           - name: main_branch
141             value: main
142           - name: contrib_branch
143             value: osm_contrib
144           - name: dry_run
145             value: "{{inputs.parameters.dry_run}}"
146 # ------ end of commit transaction