Change to wrapper used for Artifactory key
[infra/cicd.git] / jjb / onap / uds / uds-macros.yaml
1 # ============LICENSE_START=======================================================
2 #  Copyright (C) 2019 Nordix Foundation.
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 implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16 # SPDX-License-Identifier: Apache-2.0
17 # ============LICENSE_END=========================================================
18
19 #-------------------------------------------------------------------------------
20 # Macros are used to avoid hitting parameter expansion of curly brackets and
21 # the need to using include-raw-escape
22 #-------------------------------------------------------------------------------
23
24 ---
25 # Parameters used for setting multiple Gerrit Projects on Nordix
26 # Required for cases where source repositories depend on each other to build
27 # e.g. sdc-customization depends on sdc repo
28 - parameter:
29     name: multi-project-parameters
30     parameters:
31       - string:
32           name: PROJECTS
33           default: '{projects}'
34           description: JJB configured PROJECTS parameter to identify Nordix Gerrit projects
35       - string:
36           name: BRANCHES
37           default: '{branches}'
38           description: "JJB configured BRANCHES parameter (e.g. 20.1, master)"
39       - string:
40           name: PROJECT_DIRECTORIES
41           default: '{project_directories}'
42           description: Directory names to place PROJECTS
43       - string:
44           name: PROJECT_VERSIONS
45           default: '{project_versions}'
46           description: Commit ids of PROJECTS source to checkout e.g. 6d3ab, d96ba Allows for building from specific versions of a source or can also be left blank to pull latest source.
47
48 - parameter:
49     name: git-parameters
50     parameters:
51       - string:
52           name: GIT_BASE_HTTPS
53           default: https://gerrit.nordix.org/
54           description: Base HTTPS URL of repository to clone from
55
56 - parameter:
57     name: maven-parameters
58     parameters:
59       - string:
60           name: MVN_VERSION
61           default: 3.6.0
62           description: Maven version to build with
63       - string:
64           name: MVN_URL
65           default: https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/$MVN_VERSION/apache-maven-$MVN_VERSION-bin.zip
66           description: Download URL for Maven
67       - string:
68           name: MVN
69           default: $WORKSPACE/apache-maven-$MVN_VERSION/bin/mvn
70           description: Path to mvn executable
71       - string:
72           name: MVN_PARAMS
73           default: -Pdocker
74           description: Maven build parameters
75       - string:
76           name: MVN_SETTINGS_XML_VERSION
77           default: '{mvn_settings_xml_version}'
78           description: Commit ID of ONAP Oparent repository (https://git.onap.org/oparent/) to pull. Used for Maven settings file. Can be left blank to pull the latest version.
79
80 - parameter:
81     name: artifactory-parameters
82     parameters:
83       - string:
84           name: ARTIFACTORY_URL
85           default: "https://artifactory.nordix.org/artifactory"
86           description: Artifactory URL to push to
87
88 # Parameters for source repository artifacts
89 - parameter:
90     name: repo-archive-parameters
91     parameters:
92       - string:
93           name: POM_LOCATION
94           default: '{pom_location}'
95           description: Path to repository pom.xml parsed for version number used within archive filenames
96       - string:
97           name: GREP_PARAMS
98           default: '{grep_parameters}'
99           description: Parameters for grep command used for parsing pom file for version number used within archive filenames
100       - string:
101           name: ARCHIVENAME
102           default: '{archive_name}'
103           description: Name to be given to archive holding the repositories pushed to Artifactory
104       - string:
105           name: ARTIFACTORY_REPO_ARCHIVE_PATH
106           default: '{artifactory_repo_archive_path}'
107           description: Artifactory repository and path to push repository archive to
108       - string:
109           name: REPO_ARCHIVE_ARTIFACT_DIRECTORY
110           default: '{repo_archive_artifact_directory}'
111           description: Workspace directory to hold repository artifacts
112
113
114 # Parameters regarding docker image artifacts
115 - parameter:
116     name: docker-archive-parameters
117     parameters:
118       - text:
119           name: DOCKER_IMAGES
120           default: '{docker_images}'
121           description: Docker image names to archive and push to Artifactory
122       - string:
123           name: ARTIFACTORY_DOCKER_IMAGES_PATH
124           default: '{artifactory_docker_images_path}'
125           description: Artifactory repository and path to push docker images to
126       - string:
127           name: DOCKER_IMAGE_ARTIFACT_DIRECTORY
128           default: '{docker_image_artifact_directory}'
129           description: Workspace directory to hold docker image artifacts
130
131 # Parameters regarding file artifacts (.war, .jar files etc)
132 - parameter:
133     name: artifact_parameters
134     parameters:
135       - text:
136           name: ARTIFACT_PATHS
137           default: '{artifact_paths}'
138           description: Artifact file paths that should be pushed to Artifactory, can contain wildcards e.g. PROJECTDIRECTORY/some/path/catalog-be-*.war
139       - string:
140           name: ARTIFACTORY_ARTIFACT_PATH
141           default: '{artifactory_artifact_path}'
142           description: Artifactory repository and path to push artifacts to e.g. .war .jar files
143       - string:
144           name: ARTIFACT_DIRECTORY
145           default: '{artifact_directory}'
146           description: Workspace directory to hold artifacts
147
148
149 # Builders for maven builds
150 - builder:
151     name: 'generate-build-metadata'
152     builders:
153       - shell:
154           !include-raw: ./scripts/generate-build-metadata.sh
155
156 - builder:
157     name: 'pull-source-repositories'
158     builders:
159       - shell:
160           !include-raw: ./scripts/pull-repos.sh
161
162 - builder:
163     name: 'maven-build-repositories'
164     builders:
165       - shell:
166           !include-raw: ./scripts/maven-build.sh
167
168 - builder:
169     name: 'maven-clean-repositories'
170     builders:
171       - shell:
172           !include-raw: ./scripts/maven-clean.sh
173
174 # Builders for packaging artifacts (.war .jar, docker images and source repositories)
175 - builder:
176     name: 'collect-file-artifacts'
177     builders:
178       - shell:
179           !include-raw: ./scripts/collect-artifacts.sh
180
181 - builder:
182     name: 'package-docker-images'
183     builders:
184       - shell:
185           !include-raw: ./scripts/archive-images.sh
186
187 - builder:
188     name: 'package-source-repositories'
189     builders:
190       - shell:
191           !include-raw: ./scripts/archive-repos.sh
192
193 # Builders for promoting/pushing artifacts (.war, .jar, docker images and source repositories) to Artifactory
194 - builder:
195     name: 'promote-file-artifacts-to-artifactory'
196     builders:
197       - shell:
198           !include-raw: ./scripts/push-artifacts.sh
199
200 - builder:
201     name: 'promote-docker-images-to-artifactory'
202     builders:
203       - shell:
204           !include-raw: ./scripts/push-images.sh
205
206 - builder:
207     name: 'promote-source-repositories-to-artifactory'
208     builders:
209       - shell:
210           !include-raw: ./scripts/push-repos.sh
211
212 # Wrapper for Artifactory API Key
213 - wrapper:
214     name: 'artifactory-credentials'
215     wrappers:
216       - credentials-binding:
217         - username-password-separated:
218             credential-id: 'nordix-cicd-arm-credentials'
219             username: NORDIX_ARM_USERNAME
220             password: NORDIX_ARM_TOKEN