Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(garasign): use env file #213

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions packages/signing-utils/src/garasign.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,17 @@ if [ -z ${artifactory_password+omitted} ]; then echo "artifactory_password is un
if [ -z ${method+omitted} ]; then echo "method must either be gpg, rpm_gpg or jsign" && exit 1; fi

ARTIFACTORY_HOST="artifactory.corp.mongodb.com"
ENV_FILE="signing-envfile"

logout_artifactory() {
echo "GRS_CONFIG_USER1_USERNAME=${username}" >> "${ENV_FILE}"
echo "GRS_CONFIG_USER1_PASSWORD=${password}" >> "${ENV_FILE}"

cleanup() {
docker logout "${ARTIFACTORY_HOST}" > /dev/null 2>&1
rm -r "${ENV_FILE}" || true
echo "Logged out from artifactory"
}
trap logout_artifactory EXIT
trap cleanup EXIT

echo "Logging into docker artifactory"
echo "${artifactory_password}" | docker login --password-stdin --username ${artifactory_username} ${ARTIFACTORY_HOST} > /dev/null 2>&1
Expand All @@ -37,8 +42,7 @@ echo "Working directory: $directory"

gpg_sign() {
docker run \
-e GRS_CONFIG_USER1_USERNAME="${garasign_username}" \
-e GRS_CONFIG_USER1_PASSWORD="${garasign_password}" \
--env-file="${ENV_FILE}" \
--rm \
-v $directory:$directory \
-w $directory \
Expand All @@ -48,8 +52,7 @@ gpg_sign() {

jsign_sign() {
docker run \
-e GRS_CONFIG_USER1_USERNAME="${garasign_username}" \
-e GRS_CONFIG_USER1_PASSWORD="${garasign_password}" \
--env-file="${ENV_FILE}" \
--rm \
-v $directory:$directory \
-w $directory \
Expand All @@ -63,8 +66,7 @@ rpm_gpg_sign() {
# to be used for signing. The rpm signing command is copied from:
# https://github.com/mongodb-devprod-infrastructure/barque/blob/3c03fe0b6a5a0d0221a78d688de6015f546fc495/sign/rpm.go#L21
docker run \
-e GRS_CONFIG_USER1_USERNAME="${garasign_username}" \
-e GRS_CONFIG_USER1_PASSWORD="${garasign_password}" \
--env-file="${ENV_FILE}" \
--rm \
-v $directory:$directory \
-w $directory \
Expand Down
Loading