b4b273a32847f458d5d3663c1498b06a395d3636
[releng.git] / jjb / openci / create-cde.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 # This script creates CompositionDefinedEvent
15
16 git clone https://gitlab.openci.io/openci/prototypes.git
17 cd prototypes/federated-cicd
18 virtualenv openci_publish
19 cd openci_publish
20 source bin/activate
21 python setup.py install
22
23 # generate event body
24 cat <<EOF > ./json_body.txt
25 {
26     "type": "$PUBLISH_EVENT_TYPE",
27     "id": "$(uuidgen)",
28     "time": "$(date -u +%Y-%m-%d_%H:%M:%SUTC)",
29     "buildUrl": "$BUILD_URL",
30     "branch": "master",
31     "origin": "$PUBLISH_EVENT_ORIGIN",
32     "compositionName": "$DEPLOY_SCENARIO",
33     "compositionMetadataUrl": "$SCENARIO_METADATA_LOCATION"
34 }
35 EOF
36
37 openci_publish -H 129.192.69.55 -U ${ACTIVEMQ_USER} -p ${ACTIVEMQ_PASSWORD} -n openci.prototype -B ./json_body.txt
38
39 echo "Constructed $PUBLISH_EVENT_TYPE"
40 echo "--------------------------------------------"
41 cat  ./json_body.txt
42 echo "--------------------------------------------"
43
44 deactivate