diff --git a/.github/pre-req.sh b/.github/pre-req.sh index a69ac4db..4692815e 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_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 @@ -27,8 +27,8 @@ 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" +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 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5a1a4499..912a9931 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,6 +7,10 @@ on: workflow_dispatch: +env: + GO_VERSION: '1.18.1' + RUBY_VERSION: '3.3' + jobs: workflow_approval: name: Approve workflow @@ -91,7 +95,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: '1.18.1' + go-version: ${{ env.GO_VERSION }} - name: Set up Brew uses: Homebrew/actions/setup-homebrew@master @@ -112,11 +116,11 @@ jobs: echo API_ENDPOINT="https://api.$(jq -r '.sys_domain' ./env.json)" >> "$GITHUB_OUTPUT" echo API_UAA_ENDPOINT="https://uaa.$(jq -r '.sys_domain' ./env.json)" >> "$GITHUB_OUTPUT" API_PASSWORD="$(hammer -t ./env.json om credentials -- -p cf -t json -c .uaa.admin_credentials | jq -r '.password')" - API_PASSWORD_ENC="$(echo $API_PASSWORD | openssl aes-256-cbc -a -pbkdf2 -salt -pass pass:$ENCRYPT_KEY)" - echo API_PASSWORD=$API_PASSWORD_ENC >> "$GITHUB_OUTPUT" + API_PASSWORD_ENCRYPTED="$(echo $API_PASSWORD | openssl aes-256-cbc -a -pbkdf2 -salt -pass pass:$ENCRYPT_KEY)" + echo API_PASSWORD=$API_PASSWORD_ENCRYPTED >> "$GITHUB_OUTPUT" API_CLIENT_PASSWORD="$(hammer -t ./env.json om credentials -- -p cf -t json -c .uaa.admin_client_credentials | jq -r '.password')" - API_CLIENT_PASSWORD_ENC="$(echo $API_CLIENT_PASSWORD | openssl aes-256-cbc -a -pbkdf2 -salt -pass pass:$ENCRYPT_KEY)" - echo API_CLIENT_PASSWORD=$API_CLIENT_PASSWORD_ENC >> "$GITHUB_OUTPUT" + API_CLIENT_PASSWORD_ENCRYPTED="$(echo $API_CLIENT_PASSWORD | openssl aes-256-cbc -a -pbkdf2 -salt -pass pass:$ENCRYPT_KEY)" + echo API_CLIENT_PASSWORD=$API_CLIENT_PASSWORD_ENCRYPTED >> "$GITHUB_OUTPUT" echo ENV_ID=$ENV_ID >> "$GITHUB_OUTPUT" env: ENCRYPT_KEY: ${{ secrets.ENCRYPT_KEY }} @@ -135,7 +139,7 @@ jobs: repository: ${{github.event.pull_request.head.repo.full_name}} - uses: actions/setup-go@v3 with: - go-version: '1.18.1' + go-version: ${{ env.GO_VERSION }} - run: go version # Install Dependencies @@ -186,12 +190,12 @@ jobs: - uses: actions/setup-go@v3 with: - go-version: '1.18.1' + go-version: ${{ env.GO_VERSION }} - run: go version - uses: ruby/setup-ruby@v1 with: - ruby-version: '3.3' + ruby-version: ${{ env.RUBY_VERSION }} - run: ruby -v - uses: actions/download-artifact@v3 @@ -246,7 +250,7 @@ jobs: - uses: actions/setup-go@v3 with: - go-version: '1.18.1' + go-version: ${{ env.GO_VERSION }} - run: go version - uses: actions/download-artifact@v3 @@ -300,12 +304,12 @@ jobs: - uses: actions/setup-go@v3 with: - go-version: '1.18.1' + go-version: ${{ env.GO_VERSION }} - run: go version - uses: ruby/setup-ruby@v1 with: - ruby-version: '3.3' + ruby-version: ${{ env.RUBY_VERSION }} - run: ruby -v - uses: actions/download-artifact@v3 @@ -359,7 +363,7 @@ jobs: needs: - create-env - execute_tests - if: ${{ always() }} + if: always() env: ENV_ID: ${{ needs.create-env.outputs.ENV_ID }} steps: