Skip to content

Commit 3965a96

Browse files
committed
jobs/cloud-replicate: fetch ostree artifact if building winli AMI
The AWS ore wrapper relies on information from image.json. Buildfetch the ostree artifact before creating and replicating the AWS Windows License Included (winli) image to be consistent and use the same values as the original AMI. Also, remove the hack in libcloud.groovy to get around buildfetch'ing the vmdk image since the build artifact is no longer required in the winli build case. See: coreos/coreos-assembler#4315
1 parent baef03e commit 3965a96

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

jobs/cloud-replicate.Jenkinsfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,19 @@ lock(resource: "cloud-replicate-${params.VERSION}") {
9898
--arch=all --url=s3://${s3_stream_dir}/builds \
9999
--aws-config-file \${AWS_BUILD_UPLOAD_CONFIG}
100100
""")
101+
// If we're creating the Windows License Included (winli) AMI, we need to
102+
// buildfetch the ostree artifact because the AWS ore wrapper relies on
103+
// information stored in image.json. This ensures consistency with the
104+
// original AMI values. We only buildfetch for x86_64 to avoid fetching
105+
// unnecessary artifacts for other architectures.
106+
if (stream_info.create_and_replicate_winli_ami) {
107+
pipeutils.shwrapWithAWSBuildUploadCredentials("""
108+
cosa buildfetch --build=${params.VERSION} \
109+
--arch=x86_64 --artifact=ostree \
110+
--url=s3://${s3_stream_dir}/builds \
111+
--aws-config-file \${AWS_BUILD_UPLOAD_CONFIG}
112+
""")
113+
}
101114
}
102115

103116
def builtarches = shwrapCapture("""

libcloud.groovy

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,11 @@ def replicate_to_clouds(pipecfg, basearch, buildID, stream) {
5252
// all regions, if the option is set for the current stream. `cosa aws-replicate`
5353
// will handle both traditional AMIs and aws-winli AMIs if present in the metadata.
5454
// aws-winli is only supported on x86_64.
55-
def awsWinLIBuildClosure = { config, aws_image_name, credentialId ->
55+
def awsWinLIBuildClosure = { config, credentialId ->
5656
def creds = [file(variable: "AWS_CONFIG_FILE", credentialsId: credentialId)]
5757
withCredentials(creds) {
5858
utils.syncCredentialsIfInRemoteSession(["AWS_CONFIG_FILE"])
5959
def c = config
60-
61-
// Since we are not uploading anything, let's just touch the vmdk image
62-
// file to satisfy the cosa ore wrapper, which still requires the file
63-
// in the cosa working dir.
64-
def aws_image_path = "builds/${buildID}/${basearch}/${aws_image_name}"
65-
shwrap("""
66-
touch ${aws_image_path}
67-
""")
68-
6960
def extraArgs = []
7061
if (c.grant_users) {
7162
extraArgs += c.grant_users.collect{"--grant-user=${it}"}
@@ -101,15 +92,10 @@ def replicate_to_clouds(pipecfg, basearch, buildID, stream) {
10192
if (pipecfg.clouds?.aws &&
10293
utils.credentialsExist(credentials)) {
10394

104-
// grab the aws vmdk image name from the metadata to pass to the winli closure.
105-
// the cosa ore wrapper still requires the image to exist, but we dont upload
106-
// anything so we'll just touch the file in the cosa working dir.
107-
def aws_image_name = meta.images.aws.path
10895
// aws-winli is only supported on x86_64
10996
if ((basearch == "x86_64") && (stream_info.create_and_replicate_winli_ami)) {
11097
builders["☁️ 🔨:aws-winli"] = {
111-
awsWinLIBuildClosure.call(pipecfg.clouds.aws, aws_image_name,
112-
"aws-build-upload-config")
98+
awsWinLIBuildClosure.call(pipecfg.clouds.aws, "aws-build-upload-config")
11399
}
114100
}
115101
replicators["☁️ 🔄:aws"] = {

0 commit comments

Comments
 (0)