Merge "[docs] Limit git submodule recurse to depth 1"
[releng.git] / jjb / openci / create-clme.sh
1 #!/bin/bash
2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2018 Ericsson AB and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10 set -o errexit
11 set -o nounset
12 set -o pipefail
13
14 export PS1=${PS1:-}
15
16 # This script creates ConfidenceLevelModifiedEvent
17
18 git clone https://gitlab.openci.io/openci/prototypes.git
19 cd prototypes/federated-cicd
20 virtualenv openci_publish
21 cd openci_publish
22 source bin/activate
23 python setup.py install
24
25 # generate event body
26 cat <<EOF > ./json_body.txt
27 {
28     "type": "$PUBLISH_EVENT_TYPE",
29     "id": "$(uuidgen)",
30     "time": "$(date -u +%Y-%m-%d_%H:%M:%SUTC)",
31     "buildUrl": "$BUILD_URL",
32     "branch": "master",
33     "origin": "$PUBLISH_EVENT_ORIGIN",
34     "scenario": "$DEPLOY_SCENARIO",
35     "compositionName": "$DEPLOY_SCENARIO",
36     "compositionMetadataUrl": "$SCENARIO_METADATA_LOCATION",
37     "confidenceLevel": "$CONFIDENCE_LEVEL"
38 }
39 EOF
40
41 echo "Constructed $PUBLISH_EVENT_TYPE"
42 echo "--------------------------------------------"
43 cat ./json_body.txt
44 echo "--------------------------------------------"
45
46 python openci_publish -H 129.192.69.55 -U ${ACTIVEMQ_USER} -p ${ACTIVEMQ_PASSWORD} -n openci.prototype -B ./json_body.txt
47
48 deactivate