diff --git a/.github/pre-req.sh b/.github/pre-req.sh index d7d7d69c..a69ac4db 100755 --- a/.github/pre-req.sh +++ b/.github/pre-req.sh @@ -10,8 +10,8 @@ sudo apt-get update sudo apt-get install apt-transport-https ca-certificates sudo apt-get install cf-cli #CF Login -API_PASSWORD_DEC=$(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_DEC +API_PASSWORD_DEC=$(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_DEC" #Create splunk-ci org and space if [ "`cf o | grep "splunk-ci-org"`" == "splunk-ci-org" ]; then @@ -26,10 +26,10 @@ else fi gem install cf-uaac -uaac target $API_UAA_ENDPOINT --skip-ssl-validation -API_CLIENT_PASSWORD_DEC=$(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_DEC +uaac target "$API_UAA_ENDPOINT" --skip-ssl-validation +API_CLIENT_PASSWORD_DEC=$(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_DEC" -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 +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 \ No newline at end of file diff --git a/.github/update_manifest.sh b/.github/update_manifest.sh index 9ad0be21..f144062f 100755 --- a/.github/update_manifest.sh +++ b/.github/update_manifest.sh @@ -2,7 +2,8 @@ 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) +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 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1f3818c6..5a1a4499 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -86,7 +86,7 @@ jobs: - name: Claim environment and wait run: | - echo ENV_ID="5092" >> "$GITHUB_ENV" + echo ENV_ID="$(./selfservice claimAndWait isv_ci_tas_srt_4_0 | jq -r '.id')" >> "$GITHUB_ENV" - name: Set up Go uses: actions/setup-go@v3 @@ -375,6 +375,6 @@ jobs: env: API_TOKEN: ${{ secrets.API_TOKEN }} -# - name: release environment -# run: | -# ./selfservice release $ENV_ID \ No newline at end of file + - name: release environment + run: | + ./selfservice release $ENV_ID \ No newline at end of file