Chore: Remove stable/argon jobs
[releng/builder.git] / jjb / openci / create-ape.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 # workaround for https://github.com/pypa/virtualenv/issues/1029
15 export PS1=${PS1:-}
16
17 # This script creates ArtifactPublishedEvent (APE)
18
19 git clone https://gitlab.openci.io/openci/prototypes.git
20 cd prototypes/federated-cicd
21 virtualenv openci_publish
22 cd openci_publish
23 # shellcheck disable=SC1091
24 source bin/activate
25 python setup.py install
26
27 # generate event body
28 cat <<EOF > ./json_body.txt
29 {
30     "type": "$PUBLISH_EVENT_TYPE",
31     "id": "$(uuidgen)",
32     "time": "$(date -u +%Y-%m-%d_%H:%M:%SUTC)",
33     "buildUrl": "$BUILD_URL",
34     "branch": "master",
35     "origin": "$PUBLISH_EVENT_ORIGIN",
36     "artifactLocation": "$ARTIFACT_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