Skip to content

Commit

Permalink
release: Merge brew job with release job
Browse files Browse the repository at this point in the history
 - We decided to add brew into the release job,
since make sense to upload the metadata to brew everytime
we release something;

 - Delete jobs/upload-brew.Jenkinsfile.
  • Loading branch information
ravanelli committed Jul 12, 2023
1 parent f467156 commit 23c0927
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 137 deletions.
43 changes: 41 additions & 2 deletions jobs/release.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ node {
libcloud = load("libcloud.groovy")
}

def brew_principal = pipecfg.brew.principal
def brew_profile = pipecfg.brew.profile

properties([
pipelineTriggers([]),
parameters([
Expand Down Expand Up @@ -84,7 +87,10 @@ currentBuild.description = "${build_description} Waiting"
def locks = basearches.collect{[resource: "release-${params.VERSION}-${it}"]}
lock(resource: "release-${params.STREAM}", extra: locks) {
cosaPod(cpu: "1", memory: "1Gi", image: cosa_img,
serviceAccount: "jenkins") {
serviceAccount: "jenkins",
secrets: ["brew-keytab", "brew-ca:ca.crt:/etc/pki/ca.crt",
"koji-conf:koji.conf:/etc/koji.conf",
"krb5-conf:krb5.conf:/etc/krb5.conf"]) {
try {

currentBuild.description = "${build_description} Running"
Expand All @@ -101,7 +107,8 @@ lock(resource: "release-${params.STREAM}", extra: locks) {
cosa init --branch ${ref} ${variant} ${pipecfg.source_config.url}
cosa buildfetch --build=${params.VERSION} \
--arch=all --url=s3://${s3_stream_dir}/builds \
--aws-config-file \${AWS_BUILD_UPLOAD_CONFIG}
--aws-config-file \${AWS_BUILD_UPLOAD_CONFIG} \
--file "coreos-assembler-config-git.json"
""")
}

Expand Down Expand Up @@ -275,6 +282,38 @@ lock(resource: "release-${params.STREAM}", extra: locks) {
}
}

if (brew_profile) {
stage('Brew Upload') {
def tag = pipecfg.streams[params.STREAM].brew_tag
for (arch in basearches) {
def state = false
def nvr = "rhcos-${arch}-${params.VERSION}-0"
state = shwrapCapture("""
coreos-assembler koji-upload search \
--nvr ${nvr} \
--keytab "/run/kubernetes/secrets/brew-keytab/brew.keytab" \
--owner ${brew_principal} \
--profile ${brew_profile}
""")
// Check if no Brew upload was done yet
// State 1 means brew build complete
if (state != "1") {
shwrap("""
coreos-assembler koji-upload \
upload --reserve-id \
--keytab "/run/kubernetes/secrets/brew-keytab/brew.keytab" \
--build ${params.VERSION} \
--retry-attempts 6 \
--buildroot builds \
--owner ${brew_principal} \
--profile ${brew_profile} \
--tag ${tag} \
--arch ${arch}
""")
}
}
}
}
stage('Publish') {
pipeutils.withAWSBuildUploadCredentials() {
// Since some of the earlier operations (like AWS replication) only modify
Expand Down
135 changes: 0 additions & 135 deletions jobs/upload-brew.Jenkinsfile

This file was deleted.

0 comments on commit 23c0927

Please sign in to comment.