Skip to content

Commit

Permalink
[getArtifactInfo] Add support for modules
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Srb <[email protected]>
  • Loading branch information
msrb committed Feb 12, 2024
1 parent a9b16e7 commit 0b92b24
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions vars/getArtifactInfo.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.fedoraproject.jenkins.Utils
import org.fedoraproject.jenkins.koji.Koji
import org.fedoraproject.jenkins.mbs.Mbs


/**
Expand Down Expand Up @@ -31,17 +32,30 @@ def call(Map params = [:]) {
}

def koji = new Koji(env.KOJI_API_URL)
def mbs = new Mbs(env.FEDORA_CI_MBS_URL)
def taskId
def taskInfo
def moduleInfo
def artifactType
def artifactsInfo = [:]
artifactIds.each { a ->
artifactType = a.split(':')[0]
taskId = a.split(':')[1]
taskInfo = koji.getTaskInfo(taskId.toInteger())
artifactsInfo[a.toString()] = [
name: "${taskInfo.name}".toString(),
nvr: "${taskInfo.nvr}".toString(),
id: "${taskInfo.id}"
]
if (artifactType in ['koji-build', 'brew-build']) {
taskInfo = koji.getTaskInfo(taskId.toInteger())
artifactsInfo[a.toString()] = [
name: "${taskInfo.name}".toString(),
nvr: "${taskInfo.nvr}".toString(),
id: "${taskInfo.id}"
]
} else {
moduleInfo = mbs.getModuleBuildInfo(taskId)
artifactsInfo[a.toString()] = [
name: "${moduleInfo.name}".toString(),
nvr: "${mbs.getModuleNVR(moduleInfo)}".toString(),
id: "${moduleInfo.id}"
]
}
}

return artifactsInfo
Expand Down

0 comments on commit 0b92b24

Please sign in to comment.