From f1abe6a1e954123017acfc8206dbfdf9e1ef11b6 Mon Sep 17 00:00:00 2001 From: Tiago Castro Date: Mon, 8 Apr 2024 12:52:42 +0100 Subject: [PATCH 1/5] ci(helm/devel-rel): don't die when already in rel When we're already in the release branch, don't fail. On the other hand, do fail if on a different version. Signed-off-by: Tiago Castro --- scripts/helm/publish-chart-yaml.sh | 4 ++-- scripts/helm/test-publish-chart-yaml.sh | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/scripts/helm/publish-chart-yaml.sh b/scripts/helm/publish-chart-yaml.sh index 123b87b14..45be78796 100755 --- a/scripts/helm/publish-chart-yaml.sh +++ b/scripts/helm/publish-chart-yaml.sh @@ -395,8 +395,8 @@ if [ -n "$CHECK_BRANCH" ]; then elif [ -n "$DEVELOP_TO_REL" ]; then if [ "$CHART_VERSION" == "0.0.0" ]; then output_yaml "$APP_TAG" "$APP_TAG" "${CHECK_BRANCH////-}" "Always" - else - die "ERROR: source chart is not from develop branch" + elif [ "$CHART_VERSION" != "$APP_TAG" ]; then + die "ERROR: Already on $CHART_VERSION which does not match $APP_TAG" fi exit 0 fi diff --git a/scripts/helm/test-publish-chart-yaml.sh b/scripts/helm/test-publish-chart-yaml.sh index cc379c8e1..08008d19c 100755 --- a/scripts/helm/test-publish-chart-yaml.sh +++ b/scripts/helm/test-publish-chart-yaml.sh @@ -55,13 +55,21 @@ NEW_CHART_VERSION: $NEW_CHART_VERSION NEW_CHART_APP_VERSION: $NEW_CHART_APP_VERSION EOF elif [ -n "$DEVELOP_TO_REL" ]; then - cat < Date: Wed, 10 Apr 2024 10:02:30 +0100 Subject: [PATCH 2/5] ci(release/script): avoid unbound var access Ensure helm dep var is set before we use it (cleanup). Rename it to capitals to make clear its global. Signed-off-by: Tiago Castro --- scripts/release.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/scripts/release.sh b/scripts/release.sh index 9e6f909ab..fb767d257 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -8,7 +8,7 @@ CI=${CI-} set -euo pipefail -trap 'cleanup_and_exit "$?"' EXIT + # Test if the image already exists in dockerhub dockerhub_tag_exists() { curl --silent -f -lSL https://hub.docker.com/v2/repositories/$1/tags/$2 1>/dev/null 2>&1 @@ -34,7 +34,7 @@ cleanup_and_exit() { local -r status=${1} # Remove helm subcharts, if `helm dependency update` was run. - if [ "$_helm_dependencies_updated" = "true" ]; then + if [ "$HELM_DEPS_UPDATED" = "true" ]; then echo "Cleaning up helm chart dependencies..." for dep_chart in "$CHART_DIR"/charts/*; do if [ "$dep_chart" = "$CHART_DIR/charts/crds" ]; then @@ -99,6 +99,9 @@ DEFAULT_BINARIES="kubectl-plugin" BUILD_BINARIES= BIN_TARGET_PLAT="linux-musl" BINARY_OUT_LINK="." +# This variable will be used to flag if the helm chart dependencies have been +# been updated. +HELM_DEPS_UPDATED="false" # Check if all needed tools are installed curl --version >/dev/null @@ -192,6 +195,8 @@ while [ "$#" -gt 0 ]; do esac done +trap 'cleanup_and_exit "$?"' EXIT + cd $SCRIPTDIR/.. if [ -z "$IMAGES" ]; then @@ -243,9 +248,6 @@ if [ -n "$BUILD_BINARIES" ]; then done fi -# This variable will be used to flag if the helm chart dependencies have been -# been updated. -_helm_dependencies_updated="false" for name in $IMAGES; do image_basename=$($NIX_EVAL -f . images.$BUILD_TYPE.$name.imageName | xargs) image=$image_basename @@ -257,7 +259,7 @@ for name in $IMAGES; do fi fi - if [ "$_helm_dependencies_updated" = "false" ]; then + if [ "$HELM_DEPS_UPDATED" = "false" ]; then for helm_chart_user in ${IMAGES_THAT_REQUIRE_HELM_CHART[@]}; do if [ "$name" = "$helm_chart_user" ]; then echo "Updating helm chart dependencies..." @@ -276,7 +278,7 @@ for name in $IMAGES; do done # Set flag to true - _helm_dependencies_updated="true" + HELM_DEPS_UPDATED="true" break fi done From 047d89ff8bc1aa4484512e92e7c45d765a167215 Mon Sep 17 00:00:00 2001 From: Tiago Castro Date: Wed, 10 Apr 2024 10:25:47 +0100 Subject: [PATCH 3/5] ci: printenv before image build test Signed-off-by: Tiago Castro --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index f29a09d6b..501746a14 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -178,6 +178,7 @@ pipeline { } agent { label 'nixos-mayastor' } steps { + sh 'printenv' sh './scripts/nix/git-submodule-init.sh --force' sh './scripts/release.sh --skip-publish --debug --build-bins' } From e3e4bd514e259dc2bc086867c90dcb83937f750d Mon Sep 17 00:00:00 2001 From: Tiago Castro Date: Wed, 10 Apr 2024 13:30:22 +0100 Subject: [PATCH 4/5] fix(helm): unbound helm var access Signed-off-by: Tiago Castro --- chart/templates/_helpers.tpl | 4 ++-- chart/templates/mayastor/csi/csi-node-daemonset.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/chart/templates/_helpers.tpl b/chart/templates/_helpers.tpl index 536f96a50..53884eb31 100644 --- a/chart/templates/_helpers.tpl +++ b/chart/templates/_helpers.tpl @@ -66,7 +66,7 @@ Usage: {{ include "csi_node_init_containers" . }} */}} {{- define "csi_node_init_containers" -}} - {{- if .Values.csi.node.initContainers.enabled }} + {{- if (.Values.csi.node.initContainers).enabled }} {{- include "render" (dict "value" .Values.csi.node.initContainers.containers "context" $) | nindent 8 }} {{- end }} {{- end -}} @@ -250,4 +250,4 @@ Usage: {{ $param | quote }}: {{ $val | quote }} {{- end -}} {{- end -}} -{{- end -}} \ No newline at end of file +{{- end -}} diff --git a/chart/templates/mayastor/csi/csi-node-daemonset.yaml b/chart/templates/mayastor/csi/csi-node-daemonset.yaml index 74a398eef..681d3b324 100644 --- a/chart/templates/mayastor/csi/csi-node-daemonset.yaml +++ b/chart/templates/mayastor/csi/csi-node-daemonset.yaml @@ -77,7 +77,7 @@ spec: fieldPath: status.podIP - name: RUST_BACKTRACE value: "1" - {{- if .Values.csi.node.mkfs_args.xfs }} + {{- if (.Values.csi.node.mkfs_args).xfs }} - name: MKFS_XFS_ARGS value: {{ .Values.csi.node.mkfs_args.xfs | quote }} {{- end }} From 37283b1e1b174ad7b5ce158bf22c99448e2fe3e8 Mon Sep 17 00:00:00 2001 From: Tiago Castro Date: Wed, 10 Apr 2024 15:43:07 +0100 Subject: [PATCH 5/5] feat(helm): add var to disable partial rebuilds Signed-off-by: Tiago Castro --- .../templates/mayastor/agents/core/agent-core-deployment.yaml | 3 +++ chart/values.yaml | 2 ++ dependencies/control-plane | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/chart/templates/mayastor/agents/core/agent-core-deployment.yaml b/chart/templates/mayastor/agents/core/agent-core-deployment.yaml index 92b2bb930..dfa1e2ba5 100644 --- a/chart/templates/mayastor/agents/core/agent-core-deployment.yaml +++ b/chart/templates/mayastor/agents/core/agent-core-deployment.yaml @@ -63,6 +63,9 @@ spec: - "--ansi-colors={{ .Values.base.logging.color }}" - "--create-volume-limit={{ .Values.agents.core.maxCreateVolume }}"{{ if .Values.agents.core.maxRebuilds }} - "--max-rebuilds={{ .Values.agents.core.maxRebuilds }}"{{ end }} + {{- if .Values.agents.core.partialRebuildDisable }} + - "--disable-partial-rebuild" + {{- end }} ports: - containerPort: 50051 env: diff --git a/chart/values.yaml b/chart/values.yaml index 5fa62fd8a..15e8d6d16 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -183,6 +183,8 @@ agents: # faster depending on the log size. Otherwise, the replica will be fully rebuilt. # A blank value "" means internally derived value will be used. partialRebuildWaitPeriod: "" + # Set to true to disable partial rebuilds. + partialRebuildDisable: # The maximum number of system-wide rebuilds permitted at any given time. # If set to an empty string, there are no limits. maxRebuilds: "" diff --git a/dependencies/control-plane b/dependencies/control-plane index 0058585ee..85562edb5 160000 --- a/dependencies/control-plane +++ b/dependencies/control-plane @@ -1 +1 @@ -Subproject commit 0058585ee0f6b2bca1cab0a9869cc31ca2184f14 +Subproject commit 85562edb5fe4651ff554bc12310b2bffa6541ca4