Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promote min and bundle artifacts to release-candidate after every bundle build #1378

Merged
merged 20 commits into from
Jan 12, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/jenkins/BuildManifest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ class BuildManifest implements Serializable {
this.getArtifactRoot(jobName, buildNumber)
].join('/')
}

gaiksaya marked this conversation as resolved.
Show resolved Hide resolved
public String getPackageName(String productName) {
String packagePrefix = [
productName,
this.build.version,
this.build.platform,
this.build.architecture,
].join('/')
return packagePrefix + '.tar.gz'
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the name with version, platform, architecture and distribution from here?

}


13 changes: 11 additions & 2 deletions vars/uploadArtifacts.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ void call(Map args = [:]) {
def lib = library(identifier: 'jenkins@20211123', retriever: legacySCM(scm))

def buildManifest = lib.jenkins.BuildManifest.new(readYaml(file: args.manifest))
def yamlFile = readYaml(file: args.manifest)
def fileLocation = yamlFile.components.artifacts.dist[0]
def productName = buildManifest.build.getFilename()
gaiksaya marked this conversation as resolved.
Show resolved Hide resolved
def fileName = buildManifest.getPackageName("${productName}")
gaiksaya marked this conversation as resolved.
Show resolved Hide resolved

def artifactPath = buildManifest.getArtifactRoot("${JOB_NAME}", "${BUILD_NUMBER}")
echo "Uploading to s3://${ARTIFACT_BUCKET_NAME}/${artifactPath}"
Expand All @@ -11,10 +15,15 @@ void call(Map args = [:]) {
s3Upload(file: 'dist', bucket: "${ARTIFACT_BUCKET_NAME}", path: "${artifactPath}/dist")
}

withAWS(role: "${ARTIFACT_PROMOTION_ROLE_NAME}", roleAccount: "${AWS_ACCOUNT_PUBLIC_REAL}", duration: 900, roleSessionName: 'jenkins-session') {
s3Upload(file: "builds/test-release-candidates/core/${productName}/${buildManifest.build.version}", bucket: "${ARTIFACT_PUBLIC_BUCKET_NAME}", path: "${artifactPath}/builds/${productName}/${fileLocation}")
gaiksaya marked this conversation as resolved.
Show resolved Hide resolved
s3Upload(file: "builds/test-release-candidates/bundle/${productName}/${buildManifest.build.version}", bucket: "${ARTIFACT_PUBLIC_BUCKET_NAME}", path: "${artifactPath}/dist/${productName}/${fileName}")
gaiksaya marked this conversation as resolved.
Show resolved Hide resolved
}

def baseUrl = buildManifest.getArtifactRootUrl("${PUBLIC_ARTIFACT_URL}", "${JOB_NAME}", "${BUILD_NUMBER}")
lib.jenkins.Messages.new(this).add("${STAGE_NAME}", [
"${baseUrl}/builds/${buildManifest.build.getFilename()}/manifest.yml",
"${baseUrl}/dist/${buildManifest.build.getFilename()}/manifest.yml"
"${baseUrl}/builds/${productName}/manifest.yml",
"${baseUrl}/dist/${productName}/manifest.yml"
].join('\n')
)
}