Skip to content

Commit 7283d4b

Browse files
authored
Merge pull request #601 from cloudfoundry/merge-jammy
Merge jammy
2 parents 64ba966 + 6f0c8a8 commit 7283d4b

5 files changed

Lines changed: 269 additions & 75 deletions

File tree

ci/pipelines/builder.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ groups:
4444
- name: docker
4545
jobs:
4646
- build-os-image-stemcell-builder
47+
- name: infrastructure
48+
jobs:
49+
- ensure-integration-network
4750

4851
#@yaml/text-templated-strings
4952
jobs:
@@ -89,6 +92,25 @@ jobs:
8992
get_params:
9093
skip_download: true
9194

95+
#! Manually triggered job that idempotently ensures the GCP subnetwork and
96+
#! firewall rule consumed by deploy-director / cleanup-bats-vms / prepare-bats
97+
#! in the test-stemcells-ipv4 and bats jobs below exist. GCP is the source of
98+
#! truth — no state file is required.
99+
- name: ensure-integration-network
100+
serial: true
101+
plan:
102+
- get: bosh-stemcells-ci
103+
- get: bosh-integration-image
104+
- task: ensure-integration-network
105+
file: bosh-stemcells-ci/ci/tasks/gcp/ensure-integration-network.yml
106+
image: bosh-integration-image
107+
params:
108+
GCP_JSON_KEY: ((gcp_json_key))
109+
GCP_PROJECT_ID: ((gcp_project_id))
110+
GCP_REGION: europe-north2
111+
GCP_NETWORK_NAME: bosh-concourse
112+
SUBNET_INT: (@= data.values.stemcell_details.subnet_int @)
113+
92114
- name: process-high-critical-cves
93115
serial_groups: [log-cves]
94116
plan:
@@ -885,7 +907,6 @@ resource_types:
885907
type: registry-image
886908
source:
887909
repository: frodenas/gcs-resource
888-
889910
#@yaml/text-templated-strings
890911
resources:
891912
- name: daily

ci/pipelines/publisher.yml

Lines changed: 80 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -480,68 +480,86 @@ jobs:
480480
path: /bin/bash
481481
args:
482482
- -ce
483-
- tar xvf ../candidate-(@= data.values.stemcell_details.os_name @)-stemcell-(@= str(data.values.stemcell_details.major_version) @)/bosh-stemcell-*-warden-boshlite-(@= data.values.stemcell_details.os_name @)*.tgz image
483+
- |
484+
tar xvf ../candidate-(@= data.values.stemcell_details.os_name @)-stemcell-(@= str(data.values.stemcell_details.major_version) @)/bosh-stemcell-*-warden-boshlite-(@= data.values.stemcell_details.os_name @)*.tgz image
485+
printf 'FROM scratch\nADD image /\n' > Dockerfile
486+
- task: build-stemcell-oci-image
487+
privileged: true
488+
config:
489+
platform: linux
490+
image_resource:
491+
type: registry-image
492+
source:
493+
repository: concourse/oci-build-task
494+
inputs:
495+
- name: stemcell-image
496+
outputs:
497+
- name: image
498+
params:
499+
CONTEXT: stemcell-image
500+
run:
501+
path: build
484502
- put: github-container-registry-(@= data.values.stemcell_details.os_name @)-stemcell
485503
params:
486-
import_file: stemcell-image/image
487-
tag_file: candidate-(@= data.values.stemcell_details.os_name @)-stemcell-(@= str(data.values.stemcell_details.major_version) @)/.resource/version
488-
tag_as_latest: true
489-
- put: published-(@= data.values.stemcell_details.os_name @)-stemcell-(@= str(data.values.stemcell_details.major_version) @)
490-
params:
491-
files:
492-
- candidate-(@= data.values.stemcell_details.os_name @)-stemcell-(@= str(data.values.stemcell_details.major_version) @)/*.tgz
493-
options:
494-
author_email: *ci_bot_email
495-
author_name: *ci_bot_name
496-
message: 'publish (heavy): (@= data.values.stemcell_details.os_name @)/(@= str(data.values.stemcell_details.major_version) @).x'
497-
rename: '{{.Version}}/stemcells.meta4'
498-
version: candidate-(@= data.values.stemcell_details.os_name @)-stemcell-(@= str(data.values.stemcell_details.major_version) @)/.resource/version
499-
#@ if len(data.values.stemcell_details.include_fips_iaas) > 0 :
500-
- put: published-(@= data.values.stemcell_details.os_name @)-fips-stemcell-(@= str(data.values.stemcell_details.major_version) @)
501-
params:
502-
files:
503-
- candidate-(@= data.values.stemcell_details.os_name @)-fips-stemcell-(@= str(data.values.stemcell_details.major_version) @)/*.tgz
504-
options:
505-
author_email: *ci_bot_email
506-
author_name: *ci_bot_name
507-
message: 'publish (heavy): (@= data.values.stemcell_details.os_name @)-fips/(@= str(data.values.stemcell_details.major_version) @).x'
508-
rename: '{{.Version}}/stemcells.meta4'
509-
version: candidate-(@= data.values.stemcell_details.os_name @)-fips-stemcell-(@= str(data.values.stemcell_details.major_version) @)/.resource/version
510-
#@ end
511-
- params:
512-
files:
513-
- candidate-aws-light-stemcell/*.tgz
514-
options:
515-
author_email: *ci_bot_email
516-
author_name: *ci_bot_name
517-
message: 'publish (light aws): (@= data.values.stemcell_details.os_name @)/(@= str(data.values.stemcell_details.major_version) @).x'
518-
rename: '{{.Version}}/stemcells.aws.meta4'
519-
version: candidate-aws-light-stemcell/.resource/version
520-
put: published-aws-light-(@= data.values.stemcell_details.os_name @)-stemcell-(@= str(data.values.stemcell_details.major_version) @)
521-
522-
#! once we release all regions with the same account, we can unify these again
523-
- file: bosh-stemcells-ci/ci/tasks/light-aws/tag-aws-ami-light.yml
524-
image: bosh-ecosystem-concourse-registry-image
525-
task: tag-published-aws-ami-light-stemcells
526-
params:
527-
AWS_PAGER:
528-
AWS_ACCESS_KEY_ID: ((aws_publish_us_access_key))
529-
AWS_SECRET_ACCESS_KEY: ((aws_publish_us_secret_key))
530-
GREP_PATTERN: grep -v 'gov-\|cn-'
531-
- file: bosh-stemcells-ci/ci/tasks/light-aws/tag-aws-ami-light.yml
532-
image: bosh-ecosystem-concourse-registry-image
533-
task: tag-gov-published-aws-ami-light-stemcells
534-
params:
535-
AWS_PAGER:
536-
AWS_ACCESS_KEY_ID: ((aws_publish_us-gov_access_key))
537-
AWS_SECRET_ACCESS_KEY: ((aws_publish_us-gov_secret_key))
538-
GREP_PATTERN: grep 'gov-'
539-
#! - file: bosh-stemcells-ci/ci/tasks/light-aws/tag-aws-ami-light.yml
540-
#! task: tag-china-published-aws-ami-light-stemcells
541-
#! params:
542-
#! AWS_ACCESS_KEY_ID: ((aws_publish_cn_access_key))
543-
#! AWS_SECRET_ACCESS_KEY: ((aws_publish_cn_secret_key))
544-
#! GREP_PATTERN: grep 'cn-'
504+
image: image/image.tar
505+
additional_tags: candidate-(@= data.values.stemcell_details.os_name @)-stemcell-(@= str(data.values.stemcell_details.major_version) @)/.resource/version
506+
- in_parallel:
507+
- put: published-(@= data.values.stemcell_details.os_name @)-stemcell-(@= str(data.values.stemcell_details.major_version) @)
508+
params:
509+
files:
510+
- candidate-(@= data.values.stemcell_details.os_name @)-stemcell-(@= str(data.values.stemcell_details.major_version) @)/*.tgz
511+
options:
512+
author_email: *ci_bot_email
513+
author_name: *ci_bot_name
514+
message: 'publish (heavy): (@= data.values.stemcell_details.os_name @)/(@= str(data.values.stemcell_details.major_version) @).x'
515+
rename: '{{.Version}}/stemcells.meta4'
516+
version: candidate-(@= data.values.stemcell_details.os_name @)-stemcell-(@= str(data.values.stemcell_details.major_version) @)/.resource/version
517+
#@ if len(data.values.stemcell_details.include_fips_iaas) > 0 :
518+
- put: published-(@= data.values.stemcell_details.os_name @)-fips-stemcell-(@= str(data.values.stemcell_details.major_version) @)
519+
params:
520+
files:
521+
- candidate-(@= data.values.stemcell_details.os_name @)-fips-stemcell-(@= str(data.values.stemcell_details.major_version) @)/*.tgz
522+
options:
523+
author_email: *ci_bot_email
524+
author_name: *ci_bot_name
525+
message: 'publish (heavy): (@= data.values.stemcell_details.os_name @)-fips/(@= str(data.values.stemcell_details.major_version) @).x'
526+
rename: '{{.Version}}/stemcells.meta4'
527+
version: candidate-(@= data.values.stemcell_details.os_name @)-fips-stemcell-(@= str(data.values.stemcell_details.major_version) @)/.resource/version
528+
#@ end
529+
- params:
530+
files:
531+
- candidate-aws-light-stemcell/*.tgz
532+
options:
533+
author_email: *ci_bot_email
534+
author_name: *ci_bot_name
535+
message: 'publish (light aws): (@= data.values.stemcell_details.os_name @)/(@= str(data.values.stemcell_details.major_version) @).x'
536+
rename: '{{.Version}}/stemcells.aws.meta4'
537+
version: candidate-aws-light-stemcell/.resource/version
538+
put: published-aws-light-(@= data.values.stemcell_details.os_name @)-stemcell-(@= str(data.values.stemcell_details.major_version) @)
539+
540+
#! once we release all regions with the same account, we can unify these again
541+
- file: bosh-stemcells-ci/ci/tasks/light-aws/tag-aws-ami-light.yml
542+
image: bosh-ecosystem-concourse-registry-image
543+
task: tag-published-aws-ami-light-stemcells
544+
params:
545+
AWS_PAGER:
546+
AWS_ACCESS_KEY_ID: ((aws_publish_us_access_key))
547+
AWS_SECRET_ACCESS_KEY: ((aws_publish_us_secret_key))
548+
GREP_PATTERN: grep -v 'gov-\|cn-'
549+
- file: bosh-stemcells-ci/ci/tasks/light-aws/tag-aws-ami-light.yml
550+
image: bosh-ecosystem-concourse-registry-image
551+
task: tag-gov-published-aws-ami-light-stemcells
552+
params:
553+
AWS_PAGER:
554+
AWS_ACCESS_KEY_ID: ((aws_publish_us-gov_access_key))
555+
AWS_SECRET_ACCESS_KEY: ((aws_publish_us-gov_secret_key))
556+
GREP_PATTERN: grep 'gov-'
557+
#! - file: bosh-stemcells-ci/ci/tasks/light-aws/tag-aws-ami-light.yml
558+
#! task: tag-china-published-aws-ami-light-stemcells
559+
#! params:
560+
#! AWS_ACCESS_KEY_ID: ((aws_publish_cn_access_key))
561+
#! AWS_SECRET_ACCESS_KEY: ((aws_publish_cn_secret_key))
562+
#! GREP_PATTERN: grep 'cn-'
545563
- params:
546564
files:
547565
- candidate-google-light-(@= data.values.stemcell_details.os_name @)-stemcell-(@= str(data.values.stemcell_details.major_version) @)/*.tgz
@@ -838,11 +856,12 @@ resources:
838856
#@ end
839857

840858
- name: github-container-registry-(@= data.values.stemcell_details.os_name @)-stemcell
841-
type: docker-image
859+
type: registry-image
842860
source:
843861
repository: ghcr.io/cloudfoundry/(@= data.values.stemcell_details.os_name @)-stemcell
844862
username: ((github_read_write_packages.username))
845863
password: ((github_read_write_packages.password))
864+
tag: latest
846865

847866
- name: bosh-integration-registry-image
848867
type: registry-image
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
#!/usr/bin/env bash
2+
set -eu -o pipefail
3+
4+
: "${GCP_JSON_KEY:?}"
5+
: "${GCP_PROJECT_ID:?}"
6+
: "${GCP_REGION:?}"
7+
: "${GCP_NETWORK_NAME:?}"
8+
: "${SUBNET_INT:?}"
9+
10+
echo "${GCP_JSON_KEY}" | gcloud auth activate-service-account --key-file - --project "${GCP_PROJECT_ID}"
11+
12+
SUBNET_NAME="stemcell-builder-integration-${SUBNET_INT}"
13+
SUBNET_CIDR="10.100.${SUBNET_INT}.0/24"
14+
15+
# 'bat' => BATS created VM tag
16+
# 'test-stemcells-bats' => director, and compilation VM tag
17+
FIREWALL_TAGS="bat,test-stemcells-bats"
18+
19+
gcloud_stderr="$(mktemp)"
20+
trap 'rm -f "${gcloud_stderr}"' EXIT
21+
22+
echo "Checking for subnet '${SUBNET_NAME}' in region '${GCP_REGION}'..."
23+
existing_subnet_name="$(gcloud compute networks subnets list \
24+
--regions="${GCP_REGION}" \
25+
--project="${GCP_PROJECT_ID}" \
26+
--filter="name=('${SUBNET_NAME}')" \
27+
--format='value(name)' \
28+
2>"${gcloud_stderr}")" && subnet_lookup_ok=true || subnet_lookup_ok=false
29+
30+
if ${subnet_lookup_ok}; then
31+
if [[ -n "${existing_subnet_name}" ]]; then
32+
current_subnet="$(gcloud compute networks subnets describe "${SUBNET_NAME}" \
33+
--region="${GCP_REGION}" \
34+
--project="${GCP_PROJECT_ID}" \
35+
--format='csv[no-heading](network.basename(),ipCidrRange,privateIpGoogleAccess,stackType)' \
36+
2>"${gcloud_stderr}")"
37+
expected_subnet="${GCP_NETWORK_NAME},${SUBNET_CIDR},True,IPV4_ONLY"
38+
if [[ "${current_subnet}" != "${expected_subnet}" ]]; then
39+
echo "ERROR: Subnet '${SUBNET_NAME}' exists but is misconfigured."
40+
echo " Expected: ${expected_subnet}"
41+
echo " Actual: ${current_subnet}"
42+
exit 1
43+
fi
44+
echo "Subnet '${SUBNET_NAME}' already exists and matches expected configuration."
45+
else
46+
echo "Creating subnet '${SUBNET_NAME}'..."
47+
gcloud compute networks subnets create "${SUBNET_NAME}" \
48+
--network="${GCP_NETWORK_NAME}" \
49+
--region="${GCP_REGION}" \
50+
--range="${SUBNET_CIDR}" \
51+
--enable-private-ip-google-access \
52+
--stack-type=IPV4_ONLY \
53+
--project="${GCP_PROJECT_ID}"
54+
echo "Subnet '${SUBNET_NAME}' created."
55+
fi
56+
else
57+
echo "ERROR: gcloud subnet lookup failed for subnet '${SUBNET_NAME}':"
58+
cat "${gcloud_stderr}" >&2
59+
exit 1
60+
fi
61+
62+
echo "Checking for firewall rule '${SUBNET_NAME}'..."
63+
existing_fw_name="$(gcloud compute firewall-rules list \
64+
--project="${GCP_PROJECT_ID}" \
65+
--filter="name=('${SUBNET_NAME}')" \
66+
--format='value(name)' \
67+
2>"${gcloud_stderr}")" && fw_lookup_ok=true || fw_lookup_ok=false
68+
69+
if ${fw_lookup_ok}; then
70+
if [[ -n "${existing_fw_name}" ]]; then
71+
current_fw_json="$(gcloud compute firewall-rules describe "${SUBNET_NAME}" \
72+
--project="${GCP_PROJECT_ID}" \
73+
--format=json \
74+
2>"${gcloud_stderr}")"
75+
76+
# Validate network, direction, disabled
77+
actual_network="$(echo "${current_fw_json}" | jq -r '.network | split("/") | last')"
78+
actual_direction="$(echo "${current_fw_json}" | jq -r '.direction')"
79+
actual_disabled="$(echo "${current_fw_json}" | jq -r '.disabled')"
80+
81+
if [[ "${actual_network}" != "${GCP_NETWORK_NAME}" ]] || \
82+
[[ "${actual_direction}" != "INGRESS" ]] || \
83+
[[ "${actual_disabled}" != "false" ]]; then
84+
echo "ERROR: Firewall rule '${SUBNET_NAME}' exists but is misconfigured."
85+
echo " Expected network=${GCP_NETWORK_NAME}, direction=INGRESS, disabled=false"
86+
echo " Actual network=${actual_network}, direction=${actual_direction}, disabled=${actual_disabled}"
87+
exit 1
88+
fi
89+
90+
# Validate allowed (should be exactly [{IPProtocol: "all"}])
91+
actual_allowed="$(echo "${current_fw_json}" | jq -c '[.allowed[] | {protocol: .IPProtocol, ports: (.ports // [])}] | sort_by(.protocol)')"
92+
expected_allowed='[{"protocol":"all","ports":[]}]'
93+
if [[ "${actual_allowed}" != "${expected_allowed}" ]]; then
94+
echo "ERROR: Firewall rule '${SUBNET_NAME}' has wrong allowed configuration."
95+
echo " Expected: ${expected_allowed}"
96+
echo " Actual: ${actual_allowed}"
97+
exit 1
98+
fi
99+
100+
# Validate sourceRanges (should be exactly the subnet CIDR)
101+
actual_ranges="$(echo "${current_fw_json}" | jq -c '(.sourceRanges // []) | sort')"
102+
expected_ranges="$(printf '["%s"]' "${SUBNET_CIDR}")"
103+
if [[ "${actual_ranges}" != "${expected_ranges}" ]]; then
104+
echo "ERROR: Firewall rule '${SUBNET_NAME}' has wrong source ranges."
105+
echo " Expected: ${expected_ranges}"
106+
echo " Actual: ${actual_ranges}"
107+
exit 1
108+
fi
109+
110+
# Validate targetTags (order-insensitive)
111+
actual_tags="$(echo "${current_fw_json}" | jq -c '(.targetTags // []) | sort')"
112+
expected_tags="$(printf '%s\n' ${FIREWALL_TAGS//,/ } | jq -R . | jq -sc 'sort')"
113+
if [[ "${actual_tags}" != "${expected_tags}" ]]; then
114+
echo "ERROR: Firewall rule '${SUBNET_NAME}' has wrong target tags."
115+
echo " Expected: ${expected_tags}"
116+
echo " Actual: ${actual_tags}"
117+
exit 1
118+
fi
119+
120+
echo "Firewall rule '${SUBNET_NAME}' already exists and matches expected configuration."
121+
else
122+
echo "Creating firewall rule '${SUBNET_NAME}'..."
123+
gcloud compute firewall-rules create "${SUBNET_NAME}" \
124+
--network="${GCP_NETWORK_NAME}" \
125+
--project="${GCP_PROJECT_ID}" \
126+
--direction=INGRESS \
127+
--priority=1000 \
128+
--allow=all \
129+
--source-ranges="${SUBNET_CIDR}" \
130+
--target-tags="${FIREWALL_TAGS}"
131+
echo "Firewall rule '${SUBNET_NAME}' created."
132+
fi
133+
else
134+
echo "ERROR: gcloud firewall-rules lookup failed for '${SUBNET_NAME}':"
135+
cat "${gcloud_stderr}" >&2
136+
exit 1
137+
fi
138+
139+
echo "Integration network '${SUBNET_NAME}' is ready."
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
platform: linux
3+
4+
inputs:
5+
- name: bosh-stemcells-ci
6+
7+
params:
8+
GCP_JSON_KEY:
9+
GCP_PROJECT_ID:
10+
GCP_REGION:
11+
GCP_NETWORK_NAME:
12+
SUBNET_INT:
13+
14+
run:
15+
path: bosh-stemcells-ci/ci/tasks/gcp/ensure-integration-network.sh
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
<metalink xmlns="urn:ietf:params:xml:ns:metalink">
22
<file name="ubuntu-jammy.tgz">
3-
<hash type="sha-512">697fa6d41f390657587788d83bd61bf152d2a2db047b12ce1ef0bdd185bc21ed529a169048d43d6a89d87f007c1fe7b78732fe158f75916ab2704fd7b5bc6344</hash>
4-
<hash type="sha-256">14c59687ceca0e7e06ee1f134ce84dae2f201c7483bc36abe53a680ee46c23b7</hash>
5-
<hash type="sha-1">a2428dfb78cd307e64112f4003512e3fce12db5d</hash>
6-
<hash type="md5">36f4ce5ace7260cc2d98ca5c00b25251</hash>
7-
<size>434910636</size>
3+
<hash type="sha-512">262476bd0328ed6f9932491230f129109ab66b6cea92c659eee3056a79f3fef0364760dcc886676fb321eea50439b531ed2c9f3cb0b0571488240573d5ac37ce</hash>
4+
<hash type="sha-256">d700a8d194f00f1d1628aad3072a4c0a0075fe38fba0cc7b7cf8f57514d4c0ec</hash>
5+
<hash type="sha-1">0da23b76f051ecda06ea42e9f2f477c8e6ae625e</hash>
6+
<hash type="md5">18fd61818309c296c1810045b214df1a</hash>
7+
<size>435051911</size>
88
<url>https://storage.googleapis.com/bosh-os-images/ubuntu-jammy/ubuntu-jammy.tgz</url>
9-
<version>1052.0.0</version>
9+
<version>1064.0.0</version>
1010
</file>
1111
<file name="usn-log.json">
12-
<hash type="sha-512">d9378b3a430af3ce967861b570ad77af08528260c4812231ff56329936c66a52c64b1c2876caae3ce5775713312dd9e26632d0252468553c1c25d0146c5d8645</hash>
13-
<hash type="sha-256">da3273890d484f72fb935f72976b752943acd99f562128ccc4759d2559f6a0ec</hash>
14-
<hash type="sha-1">8218d84e4ae3bc7831f015388ec02f43323895e1</hash>
15-
<hash type="md5">f2d841b3ccbd4dc7386e7e7b59fb72ce</hash>
16-
<size>7477</size>
12+
<hash type="sha-512">1be299e68905259454e88adc4a919b0721a5ada64606a6012d3cd46abe992604c1709224b5580f41105eedfe15353e2bcac3c56b4ae6369682f62b6b6304e7f6</hash>
13+
<hash type="sha-256">3949a7b939998804e55805449a9e2507cf40dfb7084067124c9aaa95c08b8857</hash>
14+
<hash type="sha-1">4e87bb595d36f602b27c33dd9f7ce7e3e5b80af4</hash>
15+
<hash type="md5">d70271e3719efa31f7f8f0dcb1d81ed5</hash>
16+
<size>75875</size>
1717
<url>https://storage.googleapis.com/bosh-os-images/ubuntu-jammy/usn-log.json</url>
18-
<version>1052.0.0</version>
18+
<version>1064.0.0</version>
1919
</file>
2020
<generator>metalink-repository-resource/0.0.0</generator>
21-
<published>2026-05-08T18:01:53.5253407Z</published>
21+
<published>2026-05-27T02:55:40.91564987Z</published>
2222
</metalink>

0 commit comments

Comments
 (0)