From ce1323938cdaf911a2a755eac4c5e7d192b216ad Mon Sep 17 00:00:00 2001 From: Hamideh Amini Khezrabad Date: Mon, 27 Apr 2026 13:50:31 +0200 Subject: [PATCH] Support STEMCELL_OPS_PATH in update-stemcell-ops task Allow callers to specify the BOSH ops path used when updating a stemcell ops file. Defaults to /stemcells/- (append) for backwards compatibility. When set (e.g. /stemcells/alias=default), uses replace-by-alias semantics and handles migration from the old /stemcells/- format on first run. --- tasks/update-stemcell-ops/task | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tasks/update-stemcell-ops/task b/tasks/update-stemcell-ops/task index 871b739b1..028fdf2e0 100755 --- a/tasks/update-stemcell-ops/task +++ b/tasks/update-stemcell-ops/task @@ -8,18 +8,20 @@ function update_stemcell_opsfile() { local stemcell_version stemcell_version=$(cat stemcell/version) + local stemcell_ops_path="${STEMCELL_OPS_PATH:-/stemcells/-}" + local stemcell_alias - stemcell_alias="$(bosh int "ops-files/${ORIGINAL_OPS_FILE_PATH}" --path=/path=~1stemcells~1-/value/alias)" + stemcell_alias="$(bosh int "ops-files/${ORIGINAL_OPS_FILE_PATH}" --path=/path=${stemcell_ops_path//\//~1}/value/alias)" update_stemcell_ops_file=$(mktemp) ( cat << EOF --- - type: replace - path: /path=~1stemcells~1- + path: /path=${stemcell_ops_path//\//~1} value: type: replace - path: /stemcells/- + path: ${stemcell_ops_path} value: alias: "${stemcell_alias}" os: "${STEMCELL_STACK}" @@ -31,8 +33,10 @@ EOF } function generate_commit_message() { + local stemcell_ops_path="${STEMCELL_OPS_PATH:-/stemcells/-}" + local current_stemcell_version - current_stemcell_version="$(bosh interpolate "ops-files/${ORIGINAL_OPS_FILE_PATH}" --path=/path=~1stemcells~1-/value/version)" + current_stemcell_version="$(bosh interpolate "ops-files/${ORIGINAL_OPS_FILE_PATH}" --path=/path=${stemcell_ops_path//\//~1}/value/version)" local stemcell_version stemcell_version=$(cat stemcell/version)