| |
@@ -43,7 +43,29 @@
|
| |
// e.g. quay.io/factory2/waiverdb@sha256:35201c572fc8a137862b7a256476add8d7465fa5043d53d117f4132402f8ef6b
|
| |
env.IMAGE = "${params.SOURCE_CONTAINER_REPO}@${digest}"
|
| |
} else if (!params.IMAGE) {
|
| |
- error("This build is not started by a CI message. Only configurations were done.")
|
| |
+ // Triggred by CI_MESSAGE but it's empty - CID-5291
|
| |
+ if (!currentBuild.getBuildCauses('hudson.model.Cause$UserIdCause')) {
|
| |
+ def datagrepperdata = sh(returnStdout: true, script: "curl -k {{ c3i_datagrepper_url }}/raw?delta=300&topic=/topic/{{ c3i_messaging_greenwave_topic_virtualtopic_part }}&contains=${params.DECISION_CONTEXT_REGEX}")
|
| |
+ def messages = readJSON text: datagrepperdata
|
| |
+ messages.raw_messages.any {
|
| |
+ def msg = it.msg
|
| |
+ if ( msg?.decision_context.find(/${env.DECISION_CONTEXT_REGEX}/) &&
|
| |
+ msg?.subject_type == 'container-image' &&
|
| |
+ msg?.policies_satisfied == true &&
|
| |
+ msg?.subject_identifier.find(/${env.SUBJECT_IDENTIFIER_REGEX}/)
|
| |
+ ){
|
| |
+ def digest = (msg.subject_identifier =~ /@(sha256:\w+)$/)[0][1]
|
| |
+ env.IMAGE = "${params.SOURCE_CONTAINER_REPO}@${digest}"
|
| |
+ return true
|
| |
+ }
|
| |
+ }
|
| |
+ if (!env.IMAGE) {
|
| |
+ error('Triggered by CI_MESSAGE but message is empty and not found in datagrepper')
|
| |
+ }
|
| |
+ }
|
| |
+ else {
|
| |
+ error("This build is not started by a CI message. Only configurations were done.")
|
| |
+ }
|
| |
}
|
| |
echo "Starting promotion of image ${env.IMAGE} to ${env.PROMOTING_DESTINATION}:${params.TARGET_TAG}..."
|
| |
// Setting up registry credentials
|
| |
When job is not triggered by user and CI_MESSAGE is empty then get
message from datagrepper.