Chore: Upgrade Jenkins-job-builder to 6.3.0
[releng/global-jjb.git] / shell / openstack-stack-parameters.sh
1 #!/bin/bash
2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2018 The Linux Foundation and others.
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
11 echo "---> Create parameters file for OpenStack HOT"
12 stack_parameters="$WORKSPACE/stack-parameters.yaml"
13 tmp_params="$WORKSPACE/params.yaml"
14 JOB_SUM=$(echo "$JOB_NAME" | sum | awk '{{ print $1 }}')
15 VM_NAME="$JOB_SUM-$BUILD_NUMBER"
16
17 cat > "$tmp_params" << EOF
18 {openstack-heat-parameters}
19 job_name: '$VM_NAME'
20 silo: '$SILO'
21 EOF
22
23 echo "OpenStack Heat parameters generated"
24 echo "-----------------------------------"
25 echo "parameters:" > "$stack_parameters"
26 sed 's/^/    /' >> "$stack_parameters" "$tmp_params"
27 cat "$stack_parameters"
28 rm "$tmp_params"