Skip to content

Commit 1bdf5aa

Browse files
committed
Fix #5 skip man/doc install by default
- fix setupKeys warn - add emoji
1 parent c1d1bd5 commit 1bdf5aa

File tree

5 files changed

+72
-20
lines changed

5 files changed

+72
-20
lines changed

.github/workflows/integration-test.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ jobs:
2020
# Test local action
2121
- name: Test local action
2222
uses: ./
23-
23+
# for performance reason, by default MAN/DOC install are skipped, you could re-activate them with :
24+
# env:
25+
# MONGOTOOLS_KEEP_MAN: true
26+
2427
- name: Verify installation
2528
run: |
2629
# mongo-tools
@@ -32,13 +35,13 @@ jobs:
3235
3336
- name: Functional test
3437
run: |
35-
echo "💥 Create test user"
38+
echo " Create test user"
3639
mongosh admin --eval 'db.createUser({user:"testuser",pwd:"testpass",roles:[{role:"readWrite",db:"testdb"}]});'
3740
38-
echo "💥 Create testdb with testcollection and one doc"
41+
echo " Create testdb with testcollection and one doc"
3942
mongosh testdb --quiet --eval 'db.testcollection.insertOne({test: "data"});'
4043
41-
echo "💥 mongodump"
44+
echo " mongodump"
4245
mongodump --db testdb --out ./dump
4346
4447
echo "🔎 check dump exists"
@@ -47,10 +50,10 @@ jobs:
4750
exit 1
4851
fi
4952
50-
echo "💥 Drop db"
53+
echo " Drop db"
5154
mongosh testdb --eval 'db.dropDatabase();'
5255
53-
echo "💥 Restore it"
56+
echo " Restore it"
5457
mongorestore ./dump
5558
5659
echo "🔎 check restored data"

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ Example that will install `mongosh` only
2323
```
2424
NB: `true` is default value for parameters so could be omitted.
2525

26-
Another working sample: cf. [examples](./.github/workflows/)
26+
Another working sample: cf. [examples](./.github/workflows/).
27+
28+
For install performance reason, man/doc are not unpack by default. You can override this by keeping them with
29+
```
30+
env:
31+
MONGOTOOLS_KEEP_MAN: true
32+
```
2733
2834
# contributing
2935
PRs extending the functionality are welcome and will be reviewed.

setupMongoKeys.sh

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
#!/bin/bash
2-
echo "setup Mongo keys"
3-
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
4-
sudo apt-get install gnupg
5-
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
6-
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
2+
echo "⚙️ Setup Mongo keys"
73

8-
echo "aptitude update"
4+
# Install gnupg if not present
5+
sudo apt-get install -y gnupg
6+
7+
# Create the directory for keyrings if it doesn't exist
8+
sudo install -m 0755 -d /etc/apt/keyrings
9+
10+
# Download and install the MongoDB public GPG key into the keyring
11+
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo gpg --dearmor -o /etc/apt/keyrings/mongodb-6.0.gpg
12+
13+
# Set correct permissions
14+
sudo chmod 644 /etc/apt/keyrings/mongodb-6.0.gpg
15+
16+
# Add the MongoDB repository using the new signed-by option
17+
echo "deb [arch=amd64,arm64 signed-by=/etc/apt/keyrings/mongodb-6.0.gpg] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
18+
19+
echo "⚙️ Aptitude update"
920
sudo apt-get update
1021

1122
touch .setupMongoKeys

setupMongoShell.sh

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
11
#!/bin/bash
22
# Setup mongosh - src: https://www.mongodb.com/docs/mongodb-shell/install/
33
if [ ! -f ./.setupMongoKeys ]; then
4-
$(dirname "$0")/setupMongoKeys.sh
4+
"$(dirname "$0")"/setupMongoKeys.sh
55
fi
66

7-
echo "aptitude install mongodb-mongosh"
7+
if [ "$MONGOTOOLS_KEEP_MAN" = "true" ]; then
8+
echo "ℹ️ Keeping man/doc pages as MONGOTOOLS_KEEP_MAN=true"
9+
else
10+
echo "⚙️ Disable man/doc before apt install"
11+
sudo tee /etc/dpkg/dpkg.cfg.d/01_nodoc <<'EOF'
12+
path-exclude=/usr/share/man/*
13+
path-exclude=/usr/share/doc/*
14+
EOF
15+
fi
16+
17+
echo "⚙️ Aptitude install mongodb-mongosh"
818
sudo apt-get install -y mongodb-mongosh
919

10-
echo "show current version"
20+
if [ "$MONGOTOOLS_KEEP_MAN" != "true" ]; then
21+
echo "⚙️ Re-enable man/doc for following steps"
22+
rm /etc/dpkg/dpkg.cfg.d/01_nodoc
23+
fi
24+
25+
echo "🔎 Show current version"
1126
mongosh --version

setupMongoTools.sh

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,28 @@
11
#!/bin/bash
22
# Setup mongoDB Tools - src: https://www.mongodb.com/docs/database-tools/installation/installation-linux/
33
if [ ! -f ./.setupMongoKeys ]; then
4-
$(dirname "$0")//setupMongoKeys.sh
4+
"$(dirname "$0")"/setupMongoKeys.sh
55
fi
66

7-
echo "aptitude install mongodb-database-tools"
7+
if [ "$MONGOTOOLS_KEEP_MAN" = "true" ]; then
8+
echo "ℹ️ Keeping man/doc pages as MONGOTOOLS_KEEP_MAN=true"
9+
else
10+
echo "⚙️ Disable man/doc before apt install"
11+
sudo tee /etc/dpkg/dpkg.cfg.d/01_nodoc <<'EOF'
12+
path-exclude=/usr/share/man/*
13+
path-exclude=/usr/share/doc/*
14+
EOF
15+
fi
16+
17+
echo "⚙️ aptitude install mongodb-database-tools"
818
sudo apt install mongodb-database-tools
919

10-
echo "mongodump --version"
11-
mongodump --version
20+
if [ "$MONGOTOOLS_KEEP_MAN" != "true" ]; then
21+
echo "⚙️ Re-enable man/doc for following steps"
22+
rm /etc/dpkg/dpkg.cfg.d/01_nodoc
23+
fi
24+
25+
echo "🔎 Show mongodump and mongorestore current version"
26+
mongodump --version
27+
mongorestore --version
28+

0 commit comments

Comments
 (0)