Use publisher in OPNFV compose daily jobs 43/62543/2
authorYolanda Robla <yroblamo@redhat.com>
Wed, 19 Sep 2018 08:19:19 +0000 (10:19 +0200)
committerYolanda Robla <yroblamo@redhat.com>
Thu, 20 Sep 2018 07:09:23 +0000 (09:09 +0200)
Change-Id: I2341191b9afbf7b572a6ae28a50eb722b66109c7
Signed-off-by: Yolanda Robla <yroblamo@redhat.com>
jjb/openci/create-cde.sh
jjb/openci/openci-opnfv-daily-jobs.yaml

index 410db50..b4b273a 100755 (executable)
@@ -12,16 +12,33 @@ set -o nounset
 set -o pipefail
 
 # This script creates CompositionDefinedEvent
-# The JMS Messaging Plugin doesn't handle the newlines well so the eventBody is
-# constructed on a single line. This is something that needs to be fixed properly
 
-cat << EOF > $WORKSPACE/event.properties
-type=$PUBLISH_EVENT_TYPE
-origin=$PUBLISH_EVENT_ORIGIN
-scenario=$DEPLOY_SCENARIO
-eventBody="{ 'type': '$PUBLISH_EVENT_TYPE', 'id': '$(uuidgen)', 'time': '$(date -u +%Y-%m-%d_%H:%M:%SUTC)', 'origin': '$PUBLISH_EVENT_ORIGIN', 'buildUrl': '$BUILD_URL', 'branch': 'master', 'compositionName': '$DEPLOY_SCENARIO', 'compositionMetadataUrl': '$SCENARIO_METADATA_LOCATION' }"
+git clone https://gitlab.openci.io/openci/prototypes.git
+cd prototypes/federated-cicd
+virtualenv openci_publish
+cd openci_publish
+source bin/activate
+python setup.py install
+
+# generate event body
+cat <<EOF > ./json_body.txt
+{
+    "type": "$PUBLISH_EVENT_TYPE",
+    "id": "$(uuidgen)",
+    "time": "$(date -u +%Y-%m-%d_%H:%M:%SUTC)",
+    "buildUrl": "$BUILD_URL",
+    "branch": "master",
+    "origin": "$PUBLISH_EVENT_ORIGIN",
+    "compositionName": "$DEPLOY_SCENARIO",
+    "compositionMetadataUrl": "$SCENARIO_METADATA_LOCATION"
+}
 EOF
+
+openci_publish -H 129.192.69.55 -U ${ACTIVEMQ_USER} -p ${ACTIVEMQ_PASSWORD} -n openci.prototype -B ./json_body.txt
+
 echo "Constructed $PUBLISH_EVENT_TYPE"
 echo "--------------------------------------------"
-cat $WORKSPACE/event.properties
+cat  ./json_body.txt
 echo "--------------------------------------------"
+
+deactivate
index cb15014..3cacee6 100644 (file)
           description: 'The location of the scenario metadata'
       - 'opnfv-build-defaults'
 
+    wrappers:
+      - credentials-binding:
+          - username-password-separated:
+              credential-id: openci-connect-activemq
+              username: ACTIVEMQ_USER
+              password: ACTIVEMQ_PASSWORD
+
     triggers:
       - jms-messaging:
           provider-name: openci.activemq
-          selector: CI_TYPE = 'custom'
-          checks:
-            - field: origin
-              expected-value: '{origin}'
-            - field: type
-              expected-value: 'ArtifactPublishedEvent'
+          selector: JMSType = 'ArtifactPublishedEvent' and JMSOrigin = 'ODL'
 
     builders:
       - shell: |
       - inject:
           properties-file: "$WORKSPACE/event.properties"
 
-    publishers:
-      - jms-messaging:
-          provider-name: openci.activemq
-          msg-type: Custom
-          msg-props: |
-            type=$type
-            origin=$origin
-            scenario=$scenario
-          msg-content:
-            $eventBody
-
 - job-template:
     name: 'openci-opnfv-{scenario}-test-daily-{stream}'