Skip to content

Commit

Permalink
Add image validation to mbr pipeline on build (#862)
Browse files Browse the repository at this point in the history
* Add image validation to mbr pipeline on build

Testing basic validation against Windows builds

* Json formatting fix

Think I have a wayward comma

* Add extra args back in

* Formatting fix

* Fix naming error in workflow def

Found this while looking at other issues

* Removing extra args

Not used in windows tests due to no ARM

* Testing validation on one liner else condition

Not sure if this broke it
  • Loading branch information
jjerger authored Oct 13, 2023
1 parent 45a6862 commit 8c7c760
Showing 1 changed file with 42 additions and 4 deletions.
46 changes: 42 additions & 4 deletions concourse/pipelines/windows-image-build-mbr.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,29 @@ local gcp_secret_manager = import '../templates/gcp-secret-manager.libsonnet';
local envs = ['testing'];
local underscore(input) = std.strReplace(input, '-', '_');

local imagetesttask = {
local task = self,

images:: error 'must set images in imagetesttask',

// Start of task
platform: 'windows',
image_resource: {
type: 'registry-image',
source: { repository: 'gcr.io/compute-image-tools/cloud-image-tests' },
},
run: {
path: '/manager',
args: [
'-project=gcp-guest',
'-zone=us-central1-a',
'-test_projects=compute-image-test-pool-002,compute-image-test-pool-003,compute-image-test-pool-004,compute-image-test-pool-005',
'-exclude=(oslogin)|(storageperf)|(networkperf)|(shapevalidation)',
'-images=' + task.images,
]
},
};

// Templates.
local imgbuildjob = {
local job = self,
Expand Down Expand Up @@ -156,6 +179,7 @@ local imgpublishjob = {
gcs:: 'gs://%s/%s' % [self.gcs_bucket, self.gcs_dir],
gcs_bucket:: common.prod_bucket,
topic:: common.prod_topic,
image_prefix:: self.image,

// Publish can proceed if build passes.
passed:: if job.env == 'testing' then
Expand All @@ -166,6 +190,9 @@ local imgpublishjob = {
// Builds are automatically pushed to testing.
trigger:: if job.env == 'testing' then true
else false,

runtests:: if job.env == 'testing' then true
else false,

// Start of job.
name: 'publish-to-%s-%s' % [job.env, job.image],
Expand Down Expand Up @@ -204,11 +231,22 @@ local imgpublishjob = {
source_gcs_path: job.gcs,
source_version: 'v((.:source-version))',
publish_version: '((.:publish-version))',
wf: job.workflow,
environment: if job.env == 'testing' then 'test' else job.env,
wf: job.workflow,
environment: if job.env == 'testing' then 'test' else job.env,
},
},
],
] +
if job.runtests then
[
{
task: 'image-test-' + job.image,
config: imagetesttask {
images: 'projects/bct-prod-images/global/images/%s-((.:publish-version))' % job.image_prefix,
},
attempts: 3,
},
]
else [],
};

local ImgBuildJob(image, iso_secret, updates_secret) = imgbuildjob {
Expand All @@ -223,7 +261,7 @@ local ImgPublishJob(image, env, workflow_dir, gcs_dir) = imgpublishjob {
env: env,
gcs_dir: gcs_dir,
passed:: 'build-' + image,
workflow: '%s/%s' % [workflow_dir, image + '-bios.publish.json'],
workflow: '%s/%s' % [workflow_dir, image + '.publish.json'],
};

local ImgGroup(name, images, environments) = {
Expand Down

0 comments on commit 8c7c760

Please sign in to comment.