Skip to content

Commit

Permalink
chore(bors): merge pull request #470
Browse files Browse the repository at this point in the history
470: Add partial rebuild disable and various fixes r=tiagolobocastro a=tiagolobocastro

    feat(helm): add var to disable partial rebuilds
    
    Signed-off-by: Tiago Castro <[email protected]>



Co-authored-by: Tiago Castro <[email protected]>
  • Loading branch information
mayastor-bors and tiagolobocastro committed Apr 10, 2024
2 parents 6423ebc + 37283b1 commit f62faa6
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 14 deletions.
1 change: 1 addition & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand Down
4 changes: 2 additions & 2 deletions chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}
Expand Down Expand Up @@ -250,4 +250,4 @@ Usage:
{{ $param | quote }}: {{ $val | quote }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion chart/templates/mayastor/csi/csi-node-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 2 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,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: ""
Expand Down
4 changes: 2 additions & 2 deletions scripts/helm/publish-chart-yaml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 16 additions & 1 deletion scripts/helm/test-publish-chart-yaml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF
if [ -n "$NEW_CHART_VERSION" ]; then
cat <<EOF
APP_TAG: $APP_TAG
CHART_VERSION: $CHART_VERSION
CHART_APP_VERSION: $CHART_APP_VERSION
NEW_CHART_VERSION: $NEW_CHART_VERSION
NEW_CHART_APP_VERSION: $NEW_CHART_APP_VERSION
EOF
else
cat <<EOF
APP_TAG: $APP_TAG
CHART_VERSION: $CHART_VERSION
CHART_APP_VERSION: $CHART_APP_VERSION
EOF
fi
else
cat <<EOF
APP_TAG: $APP_TAG
Expand Down Expand Up @@ -267,6 +275,13 @@ NEW_CHART_VERSION=2.0.1
NEW_CHART_APP_VERSION=2.0.1
test_one "Upgrade from develop to release"

CHECK_BRANCH=release/2.0.1
DEVELOP_TO_REL=1
APP_TAG=2.0.1
CHART_VERSION=2.0.1
CHART_APP_VERSION=2.0.1
test_one "Already on release, no new version"

APP_TAG=2.0.0-a.0
CHART_VERSION=2.0.0
CHART_APP_VERSION=2.0.0
Expand Down
16 changes: 9 additions & 7 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -192,6 +195,8 @@ while [ "$#" -gt 0 ]; do
esac
done

trap 'cleanup_and_exit "$?"' EXIT

cd $SCRIPTDIR/..

if [ -z "$IMAGES" ]; then
Expand Down Expand Up @@ -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
Expand All @@ -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..."
Expand All @@ -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
Expand Down

0 comments on commit f62faa6

Please sign in to comment.