Skip to content

Fix invalid regexp in base-oss-google-ubuntu-stemcell GCS resource (ubuntu-jammy branch) #661

Description

@coderabbitai

Summary

The base-oss-google-ubuntu-stemcell GCS resource in ci/pipeline-template.yml uses an invalid regexp pattern that will fail to match uploaded raw stemcell artifacts.

Problem

- name: base-oss-google-ubuntu-stemcell
  source:
    bucket: bosh-gce-raw-stemcells-new
    json_key: ((gcp_json_key))
    regexp: bosh-stemcell-([0-9\.]+)-google-kvm-ubuntu-*-raw.tar.gz
  type: gcs-resource

In regex syntax, ubuntu-* means "the literal string ubuntu followed by zero or more hyphens". It does not act as a glob wildcard. Artifacts uploaded by the pipeline look like bosh-stemcell-1.2-google-kvm-ubuntu-jammy-raw.tar.gz (or ubuntu-noble-raw.tar.gz), which this pattern cannot match, breaking GCS version extraction.

Additionally, [0-9\.] is redundant since . inside a character class is a literal dot, but using [0-9.] is more conventional.

Suggested Fix

Replace the pattern with a proper regex that matches the OS codename:

-    regexp: bosh-stemcell-([0-9\.]+)-google-kvm-ubuntu-*-raw.tar.gz
+    regexp: bosh-stemcell-([0-9.]+)-google-kvm-ubuntu-[a-z]+-raw\.tar\.gz

Or, if ytt template variables are available at this point in the file, use the existing data.values.stemcell_details.os_name variable for consistency with the rest of the pipeline:

-    regexp: bosh-stemcell-([0-9\.]+)-google-kvm-ubuntu-*-raw.tar.gz
+    regexp: bosh-stemcell-([0-9.]+)-google-kvm-(@= data.values.stemcell_details.os_name @)-raw\.tar\.gz

References

Branch

This fix should be applied to the ubuntu-jammy branch (and merged forward as appropriate).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions