Skip to content

Failure recovery for OpenStack deployment#2400

Merged
cb-github-robot merged 1 commit intocloud-barista:mainfrom
seokho-son:main
Apr 1, 2026
Merged

Failure recovery for OpenStack deployment#2400
cb-github-robot merged 1 commit intocloud-barista:mainfrom
seokho-son:main

Conversation

@seokho-son
Copy link
Copy Markdown
Member

No description provided.

Signed-off-by: Seokho Son <shsongist@gmail.com>
@seokho-son seokho-son requested a review from yunkon-kim as a code owner April 1, 2026 13:28
Copilot AI review requested due to automatic review settings April 1, 2026 13:28
@seokho-son
Copy link
Copy Markdown
Member Author

/approve

@github-actions github-actions bot added the approved This PR is approved and will be merged soon. label Apr 1, 2026
@cb-github-robot cb-github-robot merged commit ca40955 into cloud-barista:main Apr 1, 2026
3 of 4 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves resilience of the OpenStack DevStack deployment script by adding retry behavior for transient network/package failures and by tuning git settings to reduce clone/pull failures on large repos.

Changes:

  • Added a generic retry() helper and wrapped apt update/upgrade/install steps with retries.
  • Added stack-user git configuration (HTTP/1.1, buffers, low-speed thresholds) to reduce GnuTLS/transfer failures.
  • Reworked the DevStack clone/update block to run under retry.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

sudo apt-get update -qq
sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade -y -qq \
retry sudo apt-get update -qq
retry sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade -y -qq \
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

retry sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade ... relies on sudo VAR=value ... environment injection, which is often blocked by sudoers unless SETENV is enabled. Since this script already aims for unattended installs, make the environment passing explicit (e.g., run sudo env DEBIAN_FRONTEND=noninteractive ... apt-get upgrade ... or sudo -E with appropriate env_keep) so the command behaves consistently across hosts.

Suggested change
retry sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade -y -qq \
retry sudo env DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a NEEDRESTART_SUSPEND=1 apt-get upgrade -y -qq \

Copilot uses AI. Check for mistakes.
Comment on lines +188 to +196
retry sudo -u stack bash -c "OPENSTACK_BRANCH='$OPENSTACK_BRANCH'
cd /opt/stack
if [ -d devstack ]; then
echo 'DevStack directory exists, pulling latest...'
cd devstack && git checkout "$OPENSTACK_BRANCH" && git pull
cd devstack && git checkout \"\$OPENSTACK_BRANCH\" && git pull
else
git clone https://opendev.org/openstack/devstack -b "$OPENSTACK_BRANCH"
git clone https://opendev.org/openstack/devstack -b \"\$OPENSTACK_BRANCH\"
fi
DEVSTACK_CLONE
"
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

The new sudo -u stack bash -c "OPENSTACK_BRANCH='$OPENSTACK_BRANCH' ..." embeds the user-provided --branch value into a shell string. If the branch contains a single-quote or newline, it can break quoting and inject extra shell commands. Prefer passing the branch via sudo -u stack env OPENSTACK_BRANCH="$OPENSTACK_BRANCH" bash -c '...' (or revert to the quoted heredoc pattern) to avoid injection and reduce brittle escaping (e.g., \"\$OPENSTACK_BRANCH\").

Copilot uses AI. Check for mistakes.
Comment on lines +95 to +100
while [ $attempt -le $max_attempts ]; do
if "$@"; then
return 0
fi
echo "Attempt $attempt/$max_attempts failed. Retrying in ${delay}s..."
sleep $delay
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

In retry(), the test and sleep arguments are unquoted ([ $attempt -le $max_attempts ], sleep $delay). While these locals are currently always set, quoting them (and using [[ ... ]]) avoids word-splitting/globbing pitfalls and makes the helper safer to reuse if values ever become empty or non-numeric.

Suggested change
while [ $attempt -le $max_attempts ]; do
if "$@"; then
return 0
fi
echo "Attempt $attempt/$max_attempts failed. Retrying in ${delay}s..."
sleep $delay
while [[ "$attempt" -le "$max_attempts" ]]; do
if "$@"; then
return 0
fi
echo "Attempt $attempt/$max_attempts failed. Retrying in ${delay}s..."
sleep "$delay"

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved This PR is approved and will be merged soon.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants