Skip to content

Commit f9e11a5

Browse files
author
QuadStingray
committed
feat: use different mongo shell commands
1 parent eb2b906 commit f9e11a5

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

.gitpod.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# This configuration file was automatically generated by Gitpod.
2+
# Please adjust to your needs (see https://www.gitpod.io/docs/config-gitpod-file)
3+
# and commit this file to your remote git repository to share the goodness with others.
4+
5+
jetbrains:
6+
intellij:
7+
plugins:
8+
- zielu.gittoolbox
9+
- com.github.lppedd.idea-conventional-commit
10+
prebuilds:
11+
version: stable

entrypoint.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,29 @@ MONGODB_PORT=$3
66
MONGODB_USERNAME=$4
77
MONGODB_PWD=$5
88

9-
109
echo "Starting MongoDb"
1110
echo "* port [$MONGODB_PORT]"
1211
echo "* version [$MONGODB_VERSION]"
1312
echo "* replica_set [$MONGODB_REPLICA_SET]"
1413
echo "* credentials [$MONGODB_USERNAME:$MONGODB_PWD]"
1514
docker run --name mongodb --publish $MONGODB_PORT:27017 -e MONGO_ROOT_USERNAME=$MONGODB_USERNAME -e MONGO_ROOT_PWD=$MONGODB_PWD -e MONGO_REPLICA_SET_NAME=$MONGODB_REPLICA_SET --detach mongocamp/mongodb:$MONGODB_VERSION
1615

16+
MONGO_SHELL_COMMAND="mongosh"
17+
if ! docker exec --tty mongodb /bin/bash -c "command -v $MONGO_SHELL_COMMAND &> /dev/null"
18+
then
19+
echo "<mongosh> could not be found use mongo"
20+
MONGO_SHELL_COMMAND=mongo
21+
fi
22+
23+
if [[ ${MONGO_SHELL_COMMAND} != 'mongosh' ]]; then
24+
MONGO_SHELL_COMMAND="${MONGO_SHELL_COMMAND} --quiet"
25+
fi
26+
1727
echo "Waiting for MongoDB to accept connections"
1828
sleep 1
1929
TIMER=0
2030

21-
until docker exec --tty mongodb mongo --port 27017 --eval "db.serverStatus()" # &> /dev/null
31+
until docker exec --tty mongodb /bin/bash -c ""$MONGO_SHELL_COMMAND --port 27017 --eval "db.serverStatus() &> /dev/null"
2232
do
2333
sleep 1
2434
echo "."

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@mongocamp/mongodb-github-action",
33
"description": "MongoDB GitHub Action",
4-
"version": "1.1.0",
4+
"version": "1.2.0",
55
"author": "QuadStingray <[email protected]>",
66
"bugs": {
77
"url": "https://github.com/MongoCamp/mongodb-github-action/issues"

0 commit comments

Comments
 (0)