-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.docker.sh
executable file
·64 lines (52 loc) · 1.75 KB
/
test.docker.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env bash
# following commands should work without the GITHUB_TOKEN needing to be set.
echo "************** help *****************"
# test handling of single parameter
docker run --rm \
-v ./dummy:/app/dummy \
-w /app \
-e DEBUG \
github-commit-sign:latest "--help"
echo "************** version *****************"
# test handling of single parameter
docker run --rm \
-v ./dummy:/app/dummy \
-w /app \
-e DEBUG \
github-commit-sign:latest "-v"
# commands below need GITHUB_TOKEN to be set.
if [[ -f .env.sh ]]; then
echo "Sourcing .env.sh file"
source .env.sh
elif [[ ! -z "$GITHUB_TOKEN" ]]; then
echo "No .env.sh file set, reading GITHUB_TOKEN from environment"
else
echo "GITHUB_TOKEN not set and .env.sh does not exist. Exiting..."
exit 1
fi
echo "************ branch arg missing *******************"
# test handling of multiple parameters
docker run --rm \
-v ./dummy:/app/dummy \
-w /app \
-e GITHUB_TOKEN \
-e DEBUG \
github-commit-sign:latest commit -o pirafrank -r 'test-repo' -c dummy/file1.txt -m 'this is a commit msg'
echo "************** all separated *****************"
# test handling of multiple parameters
docker run --rm \
-v ./dummy:/app/dummy \
-w /app \
-e GITHUB_TOKEN \
-e DEBUG \
github-commit-sign:latest commit -o pirafrank -r 'test-repo' -b main -c dummy/file1.txt -m onewordcommitmsg
echo "************** all as one arg *****************"
# test multiple parameters surrounded by double quotes
# this is to test if the entrypoint.sh script can handle double quotes,
# because GitHub Actions will pass arguments as a single string.
docker run --rm \
-v ./dummy:/app/dummy \
-w /app \
-e GITHUB_TOKEN \
-e DEBUG \
github-commit-sign:latest "commit -o pirafrank -r "test-repo" -b main -c dummy/file1.txt -m 'this is a commit msg'"