blob: 3a4c8afafedb246788f73635dd3e95c35ff077f8 [file] [log] [blame]
Fatih Degirmenci46838e22018-05-18 19:01:25 +02001#!/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##############################################################################
10set -o errexit
11set -o nounset
12set -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
18cat << EOF > $WORKSPACE/event.properties
19type=$PUBLISH_EVENT_TYPE
20origin=$PUBLISH_EVENT_ORIGIN
21eventBody="{ '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 } }"
25EOF
26echo "Constructed $PUBLISH_EVENT_TYPE"
27echo "--------------------------------------------"
28cat $WORKSPACE/event.properties
29echo "--------------------------------------------"