-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CLIENT-3017] CI/CD: Wait for Aerospike server Docker container to be…
… ready using asinfo instead of a time delay (#642) - Fix dev-workflow-p1.yml not skipping server release tests when running manually and setting input to false
- Loading branch information
1 parent
0305eeb
commit 07cd6bb
Showing
8 changed files
with
98 additions
and
41 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
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,25 @@ | ||
name: 'Wait for Aerospike server to start' | ||
description: Only tested on Linux and macOS | ||
inputs: | ||
container-name: | ||
required: true | ||
is-security-enabled: | ||
required: false | ||
default: 'false' | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: 'macOS: install timeout command' | ||
if: ${{ runner.os == 'macOS' }} | ||
run: brew install coreutils | ||
shell: bash | ||
|
||
# Composite actions doesn't support step-level timeout-minutes | ||
# Use timeout command and store polling logic in file to make it easier to read | ||
# Call bash shell explicitly since timeout uses "sh" shell by default, for some reason | ||
# Also, we don't want to fail if we timeout in case the server *did* finish starting up but the script couldn't detect it due to a bug | ||
# Effectively, this composite action is like calling "sleep" that is optimized to exit early when it detects an ok from the server | ||
- name: Wait for EE server to start | ||
run: timeout 5 bash ./.github/workflows/wait-for-as-server-to-start.bash ${{ inputs.container-name }} ${{ inputs.is-security-enabled }} || true | ||
shell: bash |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
set -x | ||
# Makes sure that if the "docker exec" command fails, it is not ignored | ||
set -o pipefail | ||
|
||
container_name=$1 | ||
is_security_enabled=$2 | ||
|
||
while true; do | ||
if [[ $is_security_enabled == true ]]; then | ||
# We need to pass credentials to asinfo if server requires it | ||
# TODO: passing in hardcoded credentials since I can't figure out how to use --instance with global astools.conf | ||
user_credentials="--user=admin --password=admin" | ||
fi | ||
|
||
# An unset variable will have a default empty value | ||
# Intermediate step is to print docker exec command's output in case it fails | ||
# Sometimes, errors only appear in stdout and not stderr, like if asinfo throws an error because of no credentials | ||
# (This is a bug in asinfo since all error messages should be sent to stderr) | ||
# But piping and passing stdin to grep will hide the first command's stdout. | ||
# grep doesn't have a way to print all lines passed as input. | ||
# ack does have an option but it doesn't come installed by default | ||
# shellcheck disable=SC2086 # The flags in user credentials should be separate anyways. Not one string | ||
if docker exec "$container_name" asinfo $user_credentials -v status | tee >(cat) | grep -qE "^ok"; then | ||
# Server is ready when asinfo returns ok | ||
break | ||
fi | ||
done |