-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The "Migrate" GitHub action was failing intermittently due to a timing issue. Essentially, it takes some time after the controllers/models/ machines are deployed for them to be ready to migrate. There was previously a hardcoded wait of 20 seconds, but this is not always enough. The fix is to wait for everything deployed to reach a steady state before we begin the migration. As `juju wait-for` appears to have been removed in 4.0, I added a Bash script `.github/waitfor.sh` that allows us to wait on `juju status` to reach a certain state (defined by a jq query). We have to wait on: - the source machine to become "started" - the ubuntu/0 unit to become "idle" - the target controller machine to become "running" Drive-bys: - Now that the "Generate" action is required, it must run on every single PR, so I've removed the path filters. - Remove the azure provider import from the provisioner facade, and build juju with BUILD_TAGS='minimal provider_lxd' in the migrate workflow. This shaves 3-4 minutes off the build time. - Add a debug info step to the migrate workflow, so that if there are future failures, we can have a baseline to debug them.
- Loading branch information
1 parent
c8d9d37
commit d4cf31f
Showing
4 changed files
with
104 additions
and
30 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Wait for something in 'juju status' to reach a given state | ||
# relevant env vars: | ||
# - MODEL: model to call 'juju status' in | ||
# - QUERY: jq query to run on the output of 'juju status' | ||
# - EXPECTED: what you are expecting the jq query to return | ||
# - JUJU_CLIENT: path to Juju client to use (default 'juju') | ||
# - MAX_ATTEMPTS: how many times to try (default 20) | ||
# - DELAY: delay between status calls in seconds (default 5) | ||
|
||
JUJU_CLIENT=${JUJU_CLIENT:-juju} | ||
MAX_ATTEMPTS=${MAX_ATTEMPTS:-20} | ||
DELAY=${DELAY:-5} | ||
|
||
attempt=0 | ||
while true; do | ||
JUJU_STATUS_CALL="$JUJU_CLIENT status --format json" | ||
if [[ -n $MODEL ]]; then | ||
JUJU_STATUS_CALL="$JUJU_STATUS_CALL -m $MODEL" | ||
fi | ||
|
||
STATUS=$($JUJU_STATUS_CALL | jq -r "$QUERY") | ||
if [[ $STATUS == "$EXPECTED" ]]; then | ||
break | ||
fi | ||
|
||
attempt=$((attempt+1)) | ||
if [[ "$attempt" -ge $MAX_ATTEMPTS ]]; then | ||
echo "$QUERY failed" | ||
exit 1 | ||
fi | ||
|
||
echo "waiting for $QUERY == $EXPECTED" | ||
sleep $DELAY | ||
done |
This file contains 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
This file contains 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
This file contains 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