-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpipe.sh
More file actions
executable file
·29 lines (22 loc) · 752 Bytes
/
pipe.sh
File metadata and controls
executable file
·29 lines (22 loc) · 752 Bytes
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
#!/bin/sh
# Check for the presence of the SECRETS_KEY environment variable
if [ -z "$SECRETS_KEY" ]; then
echo "SECRETS_KEY environment variable is missing."
exit 1
fi
git config --global --add safe.directory /repo
git config --global --add safe.directory /opt/atlassian/pipelines/agent/build
git config --global --add safe.directory ${PWD}
if [ $GIT_STASH = "true" ]; then
echo "Stashing changes"
git stash
fi
echo "$SECRETS_KEY" | base64 -d > /tmp/secrets.key
echo "Wrote secrets key to /tmp/secrets.key"
git-crypt unlock /tmp/secrets.key
rm -f /tmp/secrets.key
echo "Decrypted git-crypt files"
if [ "$GIT_STASH" = "true" ] && [ "$(git stash list | wc -l)" -gt 0 ]; then
echo "Applying stashed changes"
git stash pop
fi