Skip to content

Commit

Permalink
chore: rename variables
Browse files Browse the repository at this point in the history
  • Loading branch information
ajasnosz committed Jun 25, 2024
1 parent 114057d commit 0aa2e5e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
8 changes: 4 additions & 4 deletions .github/pre-req.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
28 changes: 16 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:

workflow_dispatch:

env:
GO_VERSION: '1.18.1'
RUBY_VERSION: '3.3'

jobs:
workflow_approval:
name: Approve workflow
Expand Down Expand Up @@ -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
Expand All @@ -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 }}
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -359,7 +363,7 @@ jobs:
needs:
- create-env
- execute_tests
if: ${{ always() }}
if: always()
env:
ENV_ID: ${{ needs.create-env.outputs.ENV_ID }}
steps:
Expand Down

0 comments on commit 0aa2e5e

Please sign in to comment.