Skip to content

Commit

Permalink
Merge pull request #373 from cloudfoundry-community/chore/setup-pcf-env
Browse files Browse the repository at this point in the history
chore: setup test env for pcf
  • Loading branch information
ajasnosz authored Jul 5, 2024
2 parents 3112d3f + f915c28 commit c20cd5b
Show file tree
Hide file tree
Showing 3 changed files with 185 additions and 56 deletions.
13 changes: 12 additions & 1 deletion .github/pre-req.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates
sudo apt-get install cf-cli
#CF Login
cf login --skip-ssl-validation -a $API_ENDPOINT -u $API_USER -p $API_PASSWORD -o system -s system
API_PASSWORD_DECRYPTED=$(echo "$API_PASSWORD" | openssl aes-256-cbc -d -pbkdf2 -a -pass pass:"$ENCRYPT_KEY")
cf login --skip-ssl-validation -a "$API_ENDPOINT" -u "$API_USER" -p "$API_PASSWORD_DECRYPTED"

#Create splunk-ci org and space
if [ "`cf o | grep "splunk-ci-org"`" == "splunk-ci-org" ]; then
echo "splunk-ci-org org already exists"
Expand All @@ -21,4 +23,13 @@ else
cf target -o splunk-ci-org
cf create-space splunk-ci-space
cf target -o "splunk-ci-org" -s "splunk-ci-space"
fi

gem install cf-uaac
uaac target "$API_UAA_ENDPOINT" --skip-ssl-validation
API_CLIENT_PASSWORD_DECRYPTED=$(echo "$API_CLIENT_PASSWORD" | openssl aes-256-cbc -d -pbkdf2 -a -pass pass:"$ENCRYPT_KEY")
uaac token client get "$API_USER" -s "$API_CLIENT_PASSWORD_DECRYPTED"

if [ $(uaac client get "$CLIENT_ID" | grep -woc "$CLIENT_ID") -eq 0 ]; then
uaac client add "$CLIENT_ID" --name splunk-firehose --secret "$CLIENT_SECRET" --authorized_grant_types client_credentials,refresh_token --authorities doppler.firehose,cloud_controller.admin_read_only
fi
4 changes: 3 additions & 1 deletion .github/update_manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
set -e
#Set below params in github env variable settings
# API_ENDPOINT, API_USER, API_PASSWORD, SPLUNK_TOKEN, SPLUNK_HOST, SPLUNK_INDEX, SPLUNK_METRIC_INDEX
API_PASSWORD_DEC=$(echo "$API_PASSWORD" | openssl aes-256-cbc -d -pbkdf2 -a -pass pass:"$ENCRYPT_KEY")
echo "$API_PASSWORD_DEC"
#Update manifest for deployment
sed -i 's@API_ENDPOINT:.*@'"API_ENDPOINT: $API_ENDPOINT"'@' scripts/ci_nozzle_manifest.yml
sed -i 's@API_USER:.*@'"API_USER: $API_USER"'@' scripts/ci_nozzle_manifest.yml
sed -i 's@API_PASSWORD:.*@'"API_PASSWORD: $API_PASSWORD"'@' scripts/ci_nozzle_manifest.yml
sed -i 's@API_PASSWORD:.*@'"API_PASSWORD: $API_PASSWORD_DEC"'@' scripts/ci_nozzle_manifest.yml
sed -i 's@CLIENT_ID:.*@'"CLIENT_ID: $CLIENT_ID"'@' scripts/ci_nozzle_manifest.yml
sed -i 's@CLIENT_SECRET:.*@'"CLIENT_SECRET: $CLIENT_SECRET"'@' scripts/ci_nozzle_manifest.yml
sed -i 's@SPLUNK_HOST:.*@'"SPLUNK_HOST: $SPLUNK_HOST"'@' scripts/ci_nozzle_manifest.yml
Expand Down
Loading

0 comments on commit c20cd5b

Please sign in to comment.