Skip to content

Commit

Permalink
Merge pull request #2962 from Cray-HPE/CRAYSAT-1767-customize-sat-ver…
Browse files Browse the repository at this point in the history
…sion

CRAYSAT-1767: Set cray-sat version in csm-config
  • Loading branch information
heemstra authored Oct 26, 2023
2 parents da641b7 + 446d10b commit 89b1ec6
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 12 deletions.
3 changes: 0 additions & 3 deletions build/images/inspect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ function resolve_mirror() {
if [[ "$image" == artifactory.algol60.net/csm-docker/stable/* ]]; then
# nothing needs to be changed
echo "${image}"
elif [[ "$image" == artifactory.algol60.net/sat-docker/stable/* ]]; then
# nothing needs to be changed
echo "${image}"
else
# docker.io/library/alpine:latest > artifactory.algol60.net/csm-docker/stable/docker.io/library/alpine:latest
# quay.io/skopeo/stable:v1.4.1 > artifactory.algol60.net/csm-docker/stable/quay.io/skopeo/stable:v1.4.1
Expand Down
15 changes: 10 additions & 5 deletions docker/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
artifactory.algol60.net/sat-docker/stable:
images:
cray-sat:
- 3.25.6

artifactory.algol60.net/csm-docker/stable:
images:
canu:
- 1.7.6

# cray-sat is not included in any Helm charts
cray-sat:
- 3.26.0

# XXX update-uas v1.4.0 should include these
cray-uai-sles15sp3:
- 1.4.0
Expand Down Expand Up @@ -99,6 +99,11 @@ artifactory.algol60.net/csm-docker/stable:
docker.io/istio/kubectl:
- 1.5.4

# This image is used in an init container specified in the loftsman manifest
# for the csm-config import job.
docker.io/library/alpine:
- 3

# Openjdk is used during install procedures to generate keystores
docker.io/library/openjdk:
- 11-jre-slim
Expand Down
12 changes: 9 additions & 3 deletions lib/setup-nexus.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# Copyright 2021 Hewlett Packard Enterprise Development LP
# Copyright 2021-2023 Hewlett Packard Enterprise Development LP

set -exo pipefail

Expand Down Expand Up @@ -59,9 +59,15 @@ nexus-setup repositories "${ROOTDIR}/nexus-repositories.yaml"
skopeo-sync "${ROOTDIR}/docker"

# Tag SAT image as csm-latest
sat_image="artifactory.algol60.net/sat-docker/stable/cray-sat"
sat_version="3.25.6"
sat_image="artifactory.algol60.net/csm-docker/stable/cray-sat"
# This value is replaced by release.sh at CSM release distribution build time
sat_version="@SAT_VERSION@"
# This csm-latest tag is being phased out, but still used as a default
skopeo-copy "${sat_image}:${sat_version}" "${sat_image}:csm-latest"
# Bootstrap sat by writing the sat version to the file used by the sat-podman
# wrapper script. This is later written by the CSM layer of the CFS config.
mkdir -p /opt/cray/etc/sat
echo "${sat_version}" > /opt/cray/etc/sat/version

nexus-upload helm "${ROOTDIR}/helm" "${CHARTS_REPO:-"charts"}"

Expand Down
23 changes: 22 additions & 1 deletion manifests/sysmgmt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,34 @@ spec:
namespace: services
- name: csm-config
source: csm-algol60
version: 1.16.22
version: 1.17.0
namespace: services
values:
cray-import-config:
catalog:
image:
tag: 1.8.12
import_job:
initContainers:
# This init container will write the desired cray-sat version to vars/main.yml
# in the csm.ncn.sat role. This allows the loftsman manifest to specify the
# cray-sat container image version, which means the CSM build can set it to match
# the version of the container image it packages in the CSM release.
- name: set-sat-version
# release.sh sets image at CSM distribution build time
image: "artifactory.algol60.net/csm-docker/stable/docker.io/library/alpine:3.18"
volumeMounts:
- mountPath: /shared
name: config-overlay
env:
- name: CRAY_SAT_VERSION
# release.sh sets value at CSM release distribution build time
value: "csm-latest"
command: ['/bin/sh']
args:
- -c
- mkdir -p /shared/roles/csm.ncn.sat/vars/ && echo "sat_container_image_version: $CRAY_SAT_VERSION" > /shared/roles/csm.ncn.sat/vars/main.yml

- name: csm-ssh-keys
source: csm-algol60
version: 1.5.6
Expand Down
24 changes: 24 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,30 @@ yq e "(.spec.charts[] | select(.name == \"cray-csm-barebones-recipe-install\") |
yq e "(.spec.charts[] | select(.name == \"cray-csm-barebones-recipe-install\") | .values.cray-import-kiwi-recipe-image.import_job.PRODUCT_NAME) = \"${RELEASE_NAME}\"" -i "${BUILDDIR}/manifests/sysmgmt.yaml"
yq e "(.spec.charts[] | select(.name == \"cray-csm-barebones-recipe-install\") | .values.cray-import-kiwi-recipe-image.import_job.name) = \"${RELEASE_NAME}-image-recipe-import-${RELEASE_VERSION}\"" -i "${BUILDDIR}/manifests/sysmgmt.yaml"

# Get the version of the cray-sat container image in this CSM build. There should
# only be one version, but if there is more than one, take the latest.
CRAY_SAT_VERSION="$(yq '."artifactory.algol60.net/csm-docker/stable".images.cray-sat[]' ${ROOTDIR}/docker/index.yaml | sort -Vr | head -n 1)"

# Set cray-sat tag in csm-config Helm chart via the Loftsman manifest
yq e "(.spec.charts[] | select(.name == \"csm-config\") |
.values.cray-import-config.import_job.initContainers[] |
select(.name == \"set-sat-version\") | .env[] |
select(.name == \"CRAY_SAT_VERSION\") | .value) = \"${CRAY_SAT_VERSION}\"" \
-i "${BUILDDIR}/manifests/sysmgmt.yaml"

# Get Alpine Linux image tag from docker/index.yaml
ALPINE_LINUX_TAG="$(yq '."artifactory.algol60.net/csm-docker/stable".images."docker.io/library/alpine"[]' ${ROOTDIR}/docker/index.yaml | sort -Vr | head -n 1)"

# Set Alpine Linux image in csm-config Helm chart via the Loftsman manifest
yq e "(.spec.charts[] | select(.name == \"csm-config\") |
.values.cray-import-config.import_job.initContainers[] |
select(.name == \"set-sat-version\") | .image)
= \"artifactory.algol60.net/csm-docker/stable/docker.io/library/alpine:${ALPINE_LINUX_TAG}\"" \
-i "${BUILDDIR}/manifests/sysmgmt.yaml"

# Replace @SAT_VERSION@ in script run during installations
sed -i "s/@SAT_VERSION@/${CRAY_SAT_VERSION}/" "${BUILDDIR}/lib/setup-nexus.sh"

# Generate Nexus blob store configuration
generate-nexus-config blobstore <"${ROOTDIR}/nexus-blobstores.yaml" >"${BUILDDIR}/nexus-blobstores.yaml"

Expand Down

0 comments on commit 89b1ec6

Please sign in to comment.