This repository was archived by the owner on May 21, 2026. It is now read-only.
Replace fixed CI waits with Kubernetes rollout-based deployment checks - #1485
Open
MerwinJoshwa wants to merge 2 commits into
Open
Replace fixed CI waits with Kubernetes rollout-based deployment checks#1485MerwinJoshwa wants to merge 2 commits into
MerwinJoshwa wants to merge 2 commits into
Conversation
Reviewer's GuideCI Kubernetes deployment script is updated to wait for actual rollout completion using kubectl rollout status with a bounded timeout and diagnostic output instead of relying on fixed time delays, reducing unnecessary CI blocking. Flow diagram for rollout-based deployment script logicflowchart TD
A[Start deploy_sh] --> B[Push Docker image fossasia/susi_server:TRAVIS_COMMIT]
B --> C[Run kubectl set image on deployment susi-server in namespace web]
C --> D[Initialize DEPLOYMENT, NAMESPACE, TIMEOUT, INTERVAL, SECONDS_WAITED=0]
D --> E{kubectl rollout status
deployment/$DEPLOYMENT -n $NAMESPACE
success?}
E -- Yes --> F[Echo Rollout successful]
F --> G[Exit 0]
E -- No --> H[Sleep INTERVAL
SECONDS_WAITED += INTERVAL]
H --> I{SECONDS_WAITED >= TIMEOUT?}
I -- No --> E
I -- Yes --> J[Echo Rollout timeout exceeded]
J --> K[kubectl get pods -n $NAMESPACE]
K --> L[kubectl describe deployment $DEPLOYMENT -n $NAMESPACE]
L --> M[Exit 1]
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The
kubectl set imageline appears malformed with stray backslashes and missing spacing (e.g.,\ --namespace=web \susi-server=...); consider simplifying it to a single line or using properly spaced line continuations so the command runs as intended. - You enable
set -eonly afterkubectl set image, so a failed image update would not stop the script; consider movingset -enear the top of the script so all deployment steps fail fast. - Since
kubectl rollout statussupports a--timeoutflag, you could potentially replace the custom sleep/loop logic with a singlekubectl rollout status deployment/$DEPLOYMENT -n $NAMESPACE --timeout=${TIMEOUT}sto simplify the rollout-wait logic while preserving a bounded wait.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `kubectl set image` line appears malformed with stray backslashes and missing spacing (e.g., `\ --namespace=web \susi-server=...`); consider simplifying it to a single line or using properly spaced line continuations so the command runs as intended.
- You enable `set -e` only after `kubectl set image`, so a failed image update would not stop the script; consider moving `set -e` near the top of the script so all deployment steps fail fast.
- Since `kubectl rollout status` supports a `--timeout` flag, you could potentially replace the custom sleep/loop logic with a single `kubectl rollout status deployment/$DEPLOYMENT -n $NAMESPACE --timeout=${TIMEOUT}s` to simplify the rollout-wait logic while preserving a bounded wait.
## Individual Comments
### Comment 1
<location> `kubernetes/travis/deploy.sh:41` </location>
<code_context>
echo ">>> Updating deployment"
-kubectl set image deployment/susi-server --namespace=web susi-server=fossasia/susi_server:$TRAVIS_COMMIT
+kubectl set image deployment/susi-server \ --namespace=web \susi-server=fossasia/susi_server:$TRAVIS_COMMIT
+
+echo ">>> Waiting for Kubernetes rollout to complete"
</code_context>
<issue_to_address>
**issue (bug_risk):** Fix line continuation and spacing in the `kubectl set image` command.
The added backslashes are incorrectly spaced: `deployment/susi-server \ --namespace=web \susi-server=...` will be parsed as a single line with a literal `\susi-server` token. Update either to a single line or to a proper multiline form, e.g.
```sh
kubectl set image deployment/susi-server \
--namespace=web \
susi-server=fossasia/susi_server:$TRAVIS_COMMIT
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Author
|
Addresses the root cause of prolonged Travis CI runtimes by replacing fixed wait-based deployment behavior with deterministic execution flow. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1470
Changes:
This change prevents Travis builds from being blocked while waiting for resources that are already handled by Kubernetes.
Summary by Sourcery
Enhancements: