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

Bump main from dev #24

Merged
merged 4 commits into from
Sep 24, 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
26 changes: 18 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ jobs:
name: Install Dependencies
command: |
npm install node-forge
npm install --global yarn

- run:
name: Create Decryption Script
Expand Down Expand Up @@ -122,15 +123,24 @@ jobs:
name: Decode secrets and environment variables
command: |
if [ -n "<< pipeline.parameters.SECRETS >>" ]; then
echo "Decoding secrets..."
DECRYPTED_JSON=$(node ~/project/decrypt.js '<< pipeline.parameters.SECRETS >>')
if [[ $DECRYPTED_JSON == {* ]]; then
echo "$DECRYPTED_JSON" | jq -r 'to_entries | map("export \(.key)=\(.value|@sh)") | .[]' > ~/project/decrypted_secrets.txt
else
echo "export DECRYPTED_SECRET=$DECRYPTED_JSON" > ~/project/decrypted_secrets.txt
fi
echo "Downloading and decoding secrets..."

# Configure AWS CLI
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
aws configure set default.region $AWS_REGION

# Download secrets file from S3
aws s3 cp << pipeline.parameters.SECRETS >> ~/project/encrypted_secrets.json

# Decrypt the secrets
DECRYPTED_JSON=$(node ~/project/decrypt.js "$(cat ~/project/encrypted_secrets.json)")

echo "$DECRYPTED_JSON" | jq -r 'to_entries | map("export \(.key)=\(.value|@sh)") | .[]' > ~/project/decrypted_secrets.txt
source ~/project/decrypted_secrets.txt
cat ~/project/decrypted_secrets.txt

# Clean up
rm ~/project/encrypted_secrets.json
fi

if [ -n "<< pipeline.parameters.ENVIRONMENT_VARIABLES >>" ]; then
Expand Down
Loading