-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·70 lines (61 loc) · 2.31 KB
/
install
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
65
66
67
68
69
70
#!/bin/bash -eu
stdbuf --output=0 --error=0 echo "::group::Install gopass"
set -x
sudo chmod o+w /usr/local/bin/
curl --show-error --silent --location \
"https://github.com/gopasspw/gopass/releases/download/v${GOPASS_VERSION}/gopass-${GOPASS_VERSION}-linux-amd64.tar.gz" \
-o - | tar xz gopass -O > /usr/local/bin/gopass
chmod +x /usr/local/bin/gopass
set +x
stdbuf --output=0 --error=0 echo "::endgroup::"
stdbuf --output=0 --error=0 echo "::group::Install summon"
set -x
curl --show-error --silent --location \
"https://github.com/cyberark/summon/releases/download/v${SUMMON_VERSION}/summon-linux-amd64.tar.gz" \
-o - | tar xz summon -O > /usr/local/bin/summon
chmod +x /usr/local/bin/summon
set +x
stdbuf --output=0 --error=0 echo "::endgroup::"
stdbuf --output=0 --error=0 echo "::group::Install private key"
set -x
if [ "${CI_GPG_PRIVATE_KEY}" ]; then
echo "${CI_GPG_PRIVATE_KEY}" | gpg --import - || true
else
gpg --quiet --batch --yes --decrypt --passphrase="${LARGE_SECRET_PASSPHRASE}" --output CI.asc CI.asc.gpg
gpg --import CI.asc
rm --force CI.asc
fi
gpg --list-keys
set +x
stdbuf --output=0 --error=0 echo "::endgroup::"
stdbuf --output=0 --error=0 echo "::group::Init repository"
set -x
git config --global user.email || git config --global user.email "geospatial-bot@camptocamp.com"
git config --global user.name || git config --global user.name CI
GOPASS_DEBUG=true gopass init "${GPG_FINGERPRINT}"
gopass clone --check-keys=false "https://${GITHUB_GOPASS_CI_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" gs/ci --sync gitcli
{
echo '#!/bin/bash'
# shellcheck disable=SC2016
echo 'gopass show $(echo "${@}"|tr : \ )'
} > /usr/local/bin/gopass-wrapper
chmod +x /usr/local/bin/gopass-wrapper
export SUMMON_PROVIDER=/usr/local/bin/gopass-wrapper
echo "SUMMON_PROVIDER=${SUMMON_PROVIDER}" >> "${GITHUB_ENV}"
set +x
stdbuf --output=0 --error=0 echo "::endgroup::"
for pattern in ${PATTERNS}; do
stdbuf --output=0 --error=0 echo "::group::Use pattern ${pattern}"
set -x
ls "${HOME}/.local/share/gopass/stores/gs-ci/patterns/${pattern}"
(
cd "${HOME}/.local/share/gopass/stores/gs-ci/patterns/${pattern}"
./apply
)
set +x
stdbuf --output=0 --error=0 echo "::endgroup::"
done
cp "$(dirname "$0")/add-mask" /usr/local/bin/
/usr/local/bin/add-mask
# Test if the mask is working
gopass show "gs/ci/test-mask"