Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions on-prem-installers/onprem/onprem_orch_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ reset_runtime_variables() {
fi

# Check if line is a runtime variable
if [[ "$line" =~ ^export\ (SRE_TLS_ENABLED|SRE_DEST_CA_CERT|SMTP_SKIP_VERIFY|DISABLE_CO_PROFILE|DISABLE_AO_PROFILE|DISABLE_O11Y_PROFILE)= ]]; then
if [[ "$line" =~ ^export\ (SRE_TLS_ENABLED|SRE_DEST_CA_CERT|SMTP_SKIP_VERIFY|DISABLE_CO_PROFILE|DISABLE_AO_PROFILE|DISABLE_O11Y_PROFILE|SINGLE_TENANCY_PROFILE)= ]]; then
# Check if it's multi-line (opening quote without closing quote on same line)
if [[ "$line" =~ =[\'\"]. ]] && ! [[ "$line" =~ =[\'\"].*[\'\"][[:space:]]*$ ]]; then
in_multiline=1
Expand All @@ -215,7 +215,7 @@ reset_runtime_variables() {

# Unset variables in current shell
unset SRE_TLS_ENABLED SRE_DEST_CA_CERT SMTP_SKIP_VERIFY
unset DISABLE_CO_PROFILE DISABLE_AO_PROFILE DISABLE_O11Y_PROFILE
unset DISABLE_CO_PROFILE DISABLE_AO_PROFILE DISABLE_O11Y_PROFILE SINGLE_TENANCY_PROFILE
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we also added UI and kyverno disbale flag also


echo "Runtime variables cleaned successfully."
}
Expand Down
44 changes: 44 additions & 0 deletions on-prem-installers/onprem/onprem_upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,44 @@ set_artifacts_version() {

export GIT_REPOS=$cwd/$git_arch_name
export ONPREM_UPGRADE_SYNC="${ONPREM_UPGRADE_SYNC:-true}"

reset_runtime_variables() {
local config_file="$cwd/onprem.env"

echo "Cleaning up runtime variables from previous runs..."

local temp_file="${config_file}.tmp"
local in_multiline=0

while IFS= read -r line || [[ -n "$line" ]]; do
# Skip lines while inside a multi-line variable
if [[ $in_multiline -eq 1 ]]; then
[[ "$line" =~ [\'\"][[:space:]]*$ ]] && in_multiline=0
continue
fi

# Check if line is a runtime variable
if [[ "$line" =~ ^export\ (SRE_TLS_ENABLED|SRE_DEST_CA_CERT|SMTP_SKIP_VERIFY|DISABLE_CO_PROFILE|DISABLE_AO_PROFILE|DISABLE_O11Y_PROFILE|SINGLE_TENANCY_PROFILE)= ]]; then
# Check if it's multi-line (opening quote without closing quote on same line)
if [[ "$line" =~ =[\'\"]. ]] && ! [[ "$line" =~ =[\'\"].*[\'\"]\ *$ ]]; then
in_multiline=1
fi
continue
fi

# Keep non-runtime variable lines
echo "$line" >> "$temp_file"
done < "$config_file"

mv "$temp_file" "$config_file"

# Unset variables in current shell
unset SRE_TLS_ENABLED SRE_DEST_CA_CERT SMTP_SKIP_VERIFY
unset DISABLE_CO_PROFILE DISABLE_AO_PROFILE DISABLE_O11Y_PROFILE SINGLE_TENANCY_PROFILE

echo "Runtime variables cleaned successfully."
}

retrieve_and_update_config() {
local config_file="$cwd/onprem.env"

Expand Down Expand Up @@ -716,6 +754,12 @@ if [[ ! -f postgres_secret.yaml ]]; then

fi

# Remove runtime variables from previous runs, then retrieve fresh config
reset_runtime_variables
# Re-source the config file after cleanup to get fresh values
# shellcheck disable=SC1091
source "$(dirname "${0}")/onprem.env"

# Retrieve/Apply config that was set during onprem installation and apply it to orch-configs
#retrieve_and_apply_config
retrieve_and_update_config
Expand Down
Loading