Fatih Degirmenci | 46838e2 | 2018-05-18 19:01:25 +0200 | [diff] [blame] | 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 ArtifactPublishedEvent (APE) |
| 15 | # The JMS Messaging Plugin doesn't handle the newlines well so the eventBody is |
| 16 | # constructed on a single line. This is something that needs to be fixed properly |
| 17 | |
| 18 | cat << EOF > $WORKSPACE/event.properties |
| 19 | type=$PUBLISH_EVENT_TYPE |
| 20 | origin=$PUBLISH_EVENT_ORIGIN |
| 21 | eventBody="{ 'type': '$PUBLISH_EVENT_TYPE', 'id': '$(uuidgen)', \ |
| 22 | 'time': '$(date -u +%Y-%m-%d_%H:%M:%SUTC)', 'origin': '$PUBLISH_EVENT_ORIGIN', \ |
| 23 | 'buildUrl': '$BUILD_URL', 'branch': 'master', 'artifactLocation': '$ARTIFACT_LOCATION', \ |
| 24 | 'confidenceLevel': { $CONFIDENCE_LEVEL } }" |
| 25 | EOF |
| 26 | echo "Constructed $PUBLISH_EVENT_TYPE" |
| 27 | echo "--------------------------------------------" |
| 28 | cat $WORKSPACE/event.properties |
| 29 | echo "--------------------------------------------" |