Skip to content

Instantly share code, notes, and snippets.

@vfreex
Created February 12, 2019 09:57
Show Gist options
  • Save vfreex/9f757eac6434bbba576b36f4bcc9e4a6 to your computer and use it in GitHub Desktop.
Save vfreex/9f757eac6434bbba576b36f4bcc9e4a6 to your computer and use it in GitHub Desktop.
Jenkins jobs to receive and send a VirtualTopic.eng.repotracker.container.tag.updated CI message
node('master') {
// Wait for message and store message content in variable
def msgContent = waitForCIMessage \
providerName: 'Red Hat UMB (test)', \
overrides: [topic: 'VirtualTopic.eng.repotracker.container.tag.updated'], \
selector: "repo='quay.io/factory2/waiverdb'"
echo "msgContent = " + msgContent
}
pipeline {
agent {
label 'master'
}
stages {
stage('msg') {
steps {
script{
def sendResult = sendCIMessage \
providerName: 'Red Hat UMB (test)', \
overrides: [topic: 'VirtualTopic.eng.repotracker.container.tag.updated'], \
messageType: 'Custom', \
messageProperties: """
old_digest=sha256:153f9e66b88293a00afc9388ec31c46560a39b694b25ad6469c0a4490352c83b
repo=quay.io/factory2/waiverdb
os=linux
tag=test
action=updated
arch=amd64
digest=sha256:1cfe125643ee70f024da9b9143af242cc0a918937d4cc4ddc32213b6361ebb39
reponame=waiverdb
""", \
messageContent: """
{
"old_digest": "sha256:153f9e66b88293a00afc9388ec31c46560a39b694b25ad6469c0a4490352c83b",
"created": "2019-02-12T07:26:07.146254097Z",
"os": "linux",
"labels": {
"io.openshift.build.commit.author": "Yuxiang Zhu \\[email protected]\\u003e",
"description": "WaiverDB application",
"license": "GPLv2+",
"io.openshift.build.commit.ref": "ci-cd",
"io.openshift.build.source-location": "https://pagure.io/forks/rayson/waiverdb.git",
"io.openshift.build.commit.message": "use test UMB",
"vendor": "WaiverDB developers",
"io.openshift.build.commit.date": "Thu Jan 10 10:24:10 2019 +0800",
"io.openshift.build.name": "waiverdb-container-build-111-1",
"io.openshift.build.commit.id": "99c1be1629b6485de397efb4dc43c991ab221287",
"maintainer": "WaiverDB developers",
"io.openshift.build.namespace": "waiverdb-test",
"name": "waiverdb"
},
"repo": "quay.io/factory2/waiverdb",
"tag": "test",
"reponame": "waiverdb",
"action": "updated",
"arch": "amd64",
"digest": "sha256:1cfe125643ee70f024da9b9143af242cc0a918937d4cc4ddc32213b6361ebb39"
}
"""
// echo sent message id and content
echo sendResult.getMessageId()
echo sendResult.getMessageContent()
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment