forked from opensearch-project/opensearch-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildYumRepo.groovy
28 lines (23 loc) · 941 Bytes
/
buildYumRepo.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
void call(Map args = [:]) {
lib = library(identifier: 'jenkins@20211123', retriever: legacySCM(scm))
def buildManifest = lib.jenkins.BuildManifest.new(readYaml(file: args.buildManifest))
echo "Create yum repo metadata and repo file ${args.buildManifest}"
def filename = buildManifest.build.getFilename()
def name = buildManifest.build.name
def version = buildManifest.build.version
def repoFilePath = "rpm/dist/${filename}"
sh([
'createrepo',
"\"${repoFilePath}\"",
].join(' '))
def repoFileContent = [
"[${filename}-${version}-${BUILD_NUMBER}-staging]",
"name=${name} ${version} ${BUILD_NUMBER} Staging",
"baseurl=${args.baseUrl}/${repoFilePath}/",
"enabled=1",
"gpgcheck=0",
"autorefresh=1",
"type=rpm-md"
].join('\n')
writeFile file: "${repoFilePath}/${filename}-${version}.staging.repo", text: repoFileContent
}