Skip to content

Commit

Permalink
Escaped password (#198)
Browse files Browse the repository at this point in the history
* deal with escape characters in password
  • Loading branch information
sbSteveK authored Jun 12, 2024
1 parent 7ff1dfd commit 8dbe18e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion codebuild/cd/promote-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ phases:
- aws --query "SecretString" secretsmanager get-secret-value --secret-id Sonatype/JIRA/token/V1 > sonatype_secret
- jq fromjson sonatype_secret > sonatype_json
- export ST_PASSWORD=$(jq -r '.password' sonatype_json)
- export ESCAPED_PASSWORD=$(printf '%s\n' "$ST_PASSWORD" | sed 's:[\\/&]:\\&:g')
- export ST_USERNAME=$(jq -r '.username' sonatype_json)
- aws --query "SecretString" secretsmanager get-secret-value --secret-id gpg/IoT/JAVA/V1 > gpg_secret
- jq fromjson gpg_secret > gpg_json
- export GPG_PRINCIPAL=$(jq -r '.username' gpg_json)
- export GPG_CREDENTIAL=$(jq -r '.password' gpg_json)
# Use the password from secret manager to update the settings
- sed -i 's/sonatype_Principal/'"$ST_USERNAME"'/g' $HOME/.m2/settings.xml
- sed -i 's/sonatype_Credential/'"$ST_PASSWORD"'/g' $HOME/.m2/settings.xml
- sed -i 's/sonatype_Credential/'"$ESCAPED_PASSWORD"'/g' $HOME/.m2/settings.xml
- sed -i 's/gpg_Principal/'"$GPG_PRINCIPAL"'/g' $HOME/.m2/settings.xml
- sed -i 's/gpg_Credential/'"$GPG_CREDENTIAL"'/g' $HOME/.m2/settings.xml

Expand Down

0 comments on commit 8dbe18e

Please sign in to comment.