### Metalink File Structure Example Source: https://context7.com/cloudfoundry/bosh-io-stemcells-cpi-index/llms.txt This XML structure defines metadata for a BOSH stemcell, including its name, hashes, size, download URL, and version. ```xml b2b3f39968037a6ffdb931cca96677ccdf7fea6b108567ae20d4b289a838dc196bcfb47a6402b82da52ec8d4ef854fb69e5eb048b79f2de4abba2298adc789cb f05fbaccc598c6e67d92cf5faf196de7694e4f904ac09d65d9c823de67dc1cd6 06ff14560d00d4d23923add9eaa07ee566630300 0f7ce552bda06e02e0bcd2efb2604056 13387329 https://storage.googleapis.com/bosh-aws-light-stemcells/1.1123/light-bosh-stemcell-1.1123-aws-xen-hvm-ubuntu-jammy-go_agent.tgz 1.1123 metalink-repository-resource/0.0.0 2026-03-26T21:49:11.072901164Z ``` -------------------------------- ### Extracting Metadata from Metalink Files using xmllint Source: https://context7.com/cloudfoundry/bosh-io-stemcells-cpi-index/llms.txt These commands demonstrate how to use xmllint to extract specific metadata like download URL, SHA-256 hash, version, and file size from Metalink files. ```bash # Extract download URL from metalink file xmlint --xpath "//*[local-name()='url']/text()" \ published/ubuntu-jammy/1.1123/stemcells.aws.meta4 # Output: https://storage.googleapis.com/bosh-aws-light-stemcells/1.1123/light-bosh-stemcell-1.1123-aws-xen-hvm-ubuntu-jammy-go_agent.tgz # Extract SHA-256 hash xmlint --xpath "//*[local-name()='hash'][@type='sha-256']/text()" \ published/ubuntu-jammy/1.1123/stemcells.aws.meta4 # Output: f05fbaccc598c6e67d92cf5faf196de7694e4f904ac09d65d9c823de67dc1cd6 # Extract version number xmlint --xpath "//*[local-name()='version']/text()" \ published/ubuntu-jammy/1.1123/stemcells.gcp.meta4 # Output: 1.1123 # Extract file size xmlint --xpath "//*[local-name()='size']/text()" \ published/ubuntu-jammy/1.1123/stemcells.aws.meta4 # Output: 13387329 ``` -------------------------------- ### Parse and Download Stemcells with Python Source: https://context7.com/cloudfoundry/bosh-io-stemcells-cpi-index/llms.txt Uses ElementTree to parse .meta4 files and requests to download and verify stemcell integrity via SHA-256. ```python import xml.etree.ElementTree as ET import hashlib import requests from pathlib import Path def parse_metalink(meta4_path): """Parse a metalink file and return stemcell metadata.""" tree = ET.parse(meta4_path) root = tree.getroot() ns = {'ml': 'urn:ietf:params:xml:ns:metalink'} file_elem = root.find('.//ml:file', ns) return { 'filename': file_elem.get('name'), 'url': file_elem.find('ml:url', ns).text, 'version': file_elem.find('ml:version', ns).text, 'size': int(file_elem.find('ml:size', ns).text), 'sha256': next( (h.text for h in file_elem.findall('ml:hash', ns) if h.get('type') == 'sha-256'), None ), 'sha1': next( (h.text for h in file_elem.findall('ml:hash', ns) if h.get('type') == 'sha-1'), None ) } def download_and_verify(metadata, output_dir='.'): """Download stemcell and verify checksum.""" output_path = Path(output_dir) / metadata['filename'] print(f"Downloading {metadata['filename']}...") response = requests.get(metadata['url'], stream=True) response.raise_for_status() sha256 = hashlib.sha256() with open(output_path, 'wb') as f: for chunk in response.iter_content(chunk_size=8192): f.write(chunk) sha256.update(chunk) if metadata['sha256'] and sha256.hexdigest() != metadata['sha256']: raise ValueError(f"SHA-256 mismatch: expected {metadata['sha256']}") print(f"Downloaded and verified: {output_path}") return output_path # Usage meta = parse_metalink('published/ubuntu-jammy/1.1123/stemcells.aws.meta4') print(f"Stemcell: {meta['filename']}") print(f"Version: {meta['version']}") print(f"Size: {meta['size']} bytes") print(f"URL: {meta['url']}") # Output: # Stemcell: light-bosh-stemcell-1.1123-aws-xen-hvm-ubuntu-jammy-go_agent.tgz # Version: 1.1123 # Size: 13387329 bytes # URL: https://storage.googleapis.com/bosh-aws-light-stemcells/1.1123/... download_and_verify(meta, output_dir='/tmp') ``` -------------------------------- ### Download and Verify GCP Ubuntu Jammy Stemcell Source: https://context7.com/cloudfoundry/bosh-io-stemcells-cpi-index/llms.txt Download the GCP Ubuntu Jammy stemcell using curl and verify its integrity with sha512sum and md5sum. ```bash # Download Ubuntu Jammy stemcell for GCP curl -L -o gcp-stemcell.tgz \ "https://storage.googleapis.com/bosh-gce-light-stemcells/1.1123/light-bosh-stemcell-1.1123-google-kvm-ubuntu-jammy-go_agent.tgz" # Verify SHA-512 checksum echo "ea88913670fee89055f4a66e84dff6d1c53b8a02bfb79b576acb4355b433d11bf921d1f6cdaa60f89258aff8a0d3b12de61b84cde3fcf1ce6d372428d58652d2 gcp-stemcell.tgz" | sha512sum -c - # Expected output: gcp-stemcell.tgz: OK # Verify MD5 hash echo "af798d91705a89f427b0bce2bf6185b0 gcp-stemcell.tgz" | md5sum -c - ``` -------------------------------- ### BOSH CLI Stemcell Management Source: https://context7.com/cloudfoundry/bosh-io-stemcells-cpi-index/llms.txt Commands for uploading stemcells to a BOSH director and configuring them in a deployment manifest. ```bash # Upload Ubuntu Jammy stemcell to BOSH director bosh upload-stemcell \ "https://storage.googleapis.com/bosh-aws-light-stemcells/1.1123/light-bosh-stemcell-1.1123-aws-xen-hvm-ubuntu-jammy-go_agent.tgz" \ --sha1 06ff14560d00d4d23923add9eaa07ee566630300 # Upload GCP stemcell bosh upload-stemcell \ "https://storage.googleapis.com/bosh-gce-light-stemcells/1.1123/light-bosh-stemcell-1.1123-google-kvm-ubuntu-jammy-go_agent.tgz" \ --sha1 6e19870a8015cbdbd4e19a8bbe8210fdd2fc3d79 # Reference in BOSH deployment manifest cat < stemcell.yml stemcells: - alias: default os: ubuntu-jammy version: "1.1123" EOF # List uploaded stemcells bosh stemcells ``` -------------------------------- ### Download and Verify AWS Ubuntu Noble Stemcell Source: https://context7.com/cloudfoundry/bosh-io-stemcells-cpi-index/llms.txt Download the AWS Ubuntu Noble stemcell using curl and verify its integrity with sha1sum. ```bash # Download Ubuntu Noble stemcell for AWS curl -L -o noble-stemcell.tgz \ "https://storage.googleapis.com/bosh-aws-light-stemcells/1.305/light-bosh-stemcell-1.305-aws-xen-hvm-ubuntu-noble.tgz" # Verify with SHA-1 echo "4ad384ccb691e203d27c5813a2779e0688676f8c noble-stemcell.tgz" | sha1sum -c - ``` -------------------------------- ### Download and Verify AWS Ubuntu Jammy Stemcell Source: https://context7.com/cloudfoundry/bosh-io-stemcells-cpi-index/llms.txt Use curl to download the AWS Ubuntu Jammy stemcell and sha256sum to verify its integrity. ```bash # Download Ubuntu Jammy stemcell for AWS curl -L -o stemcell.tgz \ "https://storage.googleapis.com/bosh-aws-light-stemcells/1.1123/light-bosh-stemcell-1.1123-aws-xen-hvm-ubuntu-jammy-go_agent.tgz" # Verify SHA-256 checksum echo "f05fbaccc598c6e67d92cf5faf196de7694e4f904ac09d65d9c823de67dc1cd6 stemcell.tgz" | sha256sum -c - # Expected output: stemcell.tgz: OK ``` -------------------------------- ### Repository Directory Structure Source: https://context7.com/cloudfoundry/bosh-io-stemcells-cpi-index/llms.txt Visual representation of the hierarchical organization of stemcell metadata files. ```text published/ ├── centos-7/ │ ├── 3468.11/ │ │ └── stemcells.meta4 │ ├── 3468.12/ │ │ └── stemcells.aws.meta4 │ └── 3541.37/ │ └── stemcells.aws.meta4 ├── ubuntu-bionic/ │ └── 1.204/ │ ├── stemcells.aws.meta4 │ └── stemcells.gcp.meta4 ├── ubuntu-jammy/ │ └── 1.1123/ │ ├── stemcells.aws.meta4 │ └── stemcells.gcp.meta4 ├── ubuntu-noble/ │ └── 1.305/ │ ├── stemcells.aws.meta4 │ └── stemcells.gcp.meta4 ├── ubuntu-trusty/ │ └── 3586.100/ │ └── stemcells.meta4 └── ubuntu-xenial/ └── 621.125/ └── stemcells.aws.meta4 ``` -------------------------------- ### Find Latest Stemcell Versions via CLI Source: https://context7.com/cloudfoundry/bosh-io-stemcells-cpi-index/llms.txt Uses standard shell utilities to sort and identify the most recent stemcell versions within the directory structure. ```bash # List all Ubuntu Jammy versions (sorted) ls published/ubuntu-jammy/ | sort -V | tail -5 # Output: # 1.1065 # 1.1089 # 1.1091 # 1.1107 # 1.1123 # Get latest Ubuntu Noble version LATEST_NOBLE=$(ls published/ubuntu-noble/ | sort -V | tail -1) echo "Latest Ubuntu Noble: $LATEST_NOBLE" # Output: Latest Ubuntu Noble: 1.305 # Get latest CentOS 7 version LATEST_CENTOS=$(ls published/centos-7/ | sort -V | tail -1) echo "Latest CentOS 7: $LATEST_CENTOS" # Output: Latest CentOS 7: 3541.37 # Find all stemcells for a specific version find published -path "*/$LATEST_NOBLE/*" -name "*.meta4" # Output: # published/ubuntu-noble/1.305/stemcells.aws.meta4 # published/ubuntu-noble/1.305/stemcells.gcp.meta4 ``` -------------------------------- ### Configure Concourse CI for Stemcell Tracking Source: https://context7.com/cloudfoundry/bosh-io-stemcells-cpi-index/llms.txt Defines a metalink-repository resource to track stemcell versions and a job to upload them to BOSH. ```yaml resources: - name: stemcell type: metalink-repository source: uri: https://github.com/cloudfoundry/stemcells-cpi-index branch: main path: published/ubuntu-jammy mirror_files: - destination: s3://my-bucket/stemcells/{{.Version}}/{{.Name}} env: AWS_ACCESS_KEY_ID: ((aws_access_key)) AWS_SECRET_ACCESS_KEY: ((aws_secret_key)) version: version_constraint: ">= 1.1000" jobs: - name: upload-stemcell plan: - get: stemcell trigger: true - task: upload-to-bosh config: platform: linux inputs: - name: stemcell run: path: bash args: - -c - | STEMCELL_URL=$(cat stemcell/url) STEMCELL_SHA1=$(cat stemcell/sha1) bosh upload-stemcell "$STEMCELL_URL" --sha1 "$STEMCELL_SHA1" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.