File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
2-
2+ set -eo pipefail
33set -e
44
55echo " Obtaining release vector variables..."
@@ -8,8 +8,21 @@ yq_shell() {
88 docker run --rm -i -v ${PWD} :/workdir mikefarah/yq:3 /bin/sh -c " $@ "
99}
1010
11+ download_oci_release_vector () {
12+ local image=" $1 "
13+ local tag=" $2 "
14+
15+ local token=$( curl -s " https://ghcr.io/token?scope=repository:$IMAGE :pull&service=ghcr.io" | jq -r .token)
16+
17+ local manifest=$( curl -s -L -H " Accept: application/vnd.oci.image.manifest.v1+json" -H " Authorization: Bearer $token " https://ghcr.io/v2/$image /manifests/$tag )
18+ local digst=$( echo " $manifest " | jq -r ' .layers[] | select(.mediaType == "application/vnd.metal-stack.release-vector.v1.tar+gzip") | .digest' )
19+
20+ RELEASE_YAML=" $( curl -s -L -H " Authorization: Bearer $token " " https://ghcr.io/v2/$image /blobs/$digst " | tar xzO release.yaml) "
21+ }
22+
1123METAL_STACK_RELEASE_VERSION=$( yq_shell " yq r inventories/group_vars/all/release_vector.yaml 'metal_stack_release_version'" )
12- RELEASE_YAML=$( curl -s https://raw.githubusercontent.com/metal-stack/releases/${METAL_STACK_RELEASE_VERSION} /release.yaml)
24+ download_oci_release_vector metal-stack/releases $METAL_STACK_RELEASE_VERSION
25+
1326METALCTL_IMAGE_TAG=$( yq_shell " echo \" ${RELEASE_YAML} \" | yq r - docker-images.metal-stack.control-plane.metalctl.tag" )
1427DEPLOYMENT_BASE_IMAGE_TAG=$( yq_shell " echo \" ${RELEASE_YAML} \" | yq r - docker-images.metal-stack.generic.deployment-base.tag" )
1528
You can’t perform that action at this time.
0 commit comments