Skip to content

Commit

Permalink
added gcp auth testing
Browse files Browse the repository at this point in the history
  • Loading branch information
kcs-bandihareesh committed Oct 7, 2024
1 parent fddb463 commit 796e7dd
Showing 1 changed file with 29 additions and 14 deletions.
43 changes: 29 additions & 14 deletions .github/workflows/database-goodies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
project_id: 'som-rit-infrastructure-prod'
workload_identity_provider: 'projects/294515190965/locations/global/workloadIdentityPools/github/providers/susom-github'
create_credentials_file: true
export_environment_variables: true

- name: Set up Oracle JDK 8
uses: actions/setup-java@v3
with:
Expand All @@ -42,18 +34,34 @@ jobs:
run: |
sed -i "s/-SNAPSHOT/-build-${{ github.run_number }}/" pom.xml
- name: Disable SourceClear except for cron jobs
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
project_id: 'som-rit-infrastructure-prod'
workload_identity_provider: 'projects/294515190965/locations/global/workloadIdentityPools/github/providers/susom-github'
create_credentials_file: true
export_environment_variables: true
cleanup_credentials: true

- name: Test authentication with GCP
run: |
if [ "${{ github.event_name }}" != "schedule" ]; then
export NOSCAN=1
fi
gcloud auth print-access-token
gcloud config set project som-rit-infrastructure-prod
gcloud auth list
- name: Install PostgreSQL 14
run: |
sudo apt-get update
sudo apt-get install -y postgresql-14 postgresql-contrib
- name: Set up PostgreSQL 14
- name: Configure PostgreSQL to use md5 authentication
run: |
sudo sed -i "s/^#\(local.*all.*all.*\)peer/\1md5/" /etc/postgresql/14/main/pg_hba.conf
sudo sed -i "s/^#\(host.*all.*all.*127.0.0.1\/32.*\)scram-sha-256/\1md5/" /etc/postgresql/14/main/pg_hba.conf
sudo sed -i "s/^#\(host.*all.*all.*::1\/128.*\)scram-sha-256/\1md5/" /etc/postgresql/14/main/pg_hba.conf
sudo service postgresql restart
- name: Set up PostgreSQL
run: |
sudo service postgresql start
sudo -u postgres psql -c "create user test with password 'test';"
Expand Down Expand Up @@ -83,6 +91,13 @@ jobs:
workload_identity_provider: 'projects/294515190965/locations/global/workloadIdentityPools/github/providers/susom-github'
create_credentials_file: true
export_environment_variables: true
cleanup_credentials: true

- name: Test authentication with GCP
run: |
gcloud auth print-access-token
gcloud config set project som-rit-infrastructure-prod
gcloud auth list
- name: Set up Oracle JDK 8
uses: actions/setup-java@v3
Expand All @@ -102,4 +117,4 @@ jobs:
- name: Deploy snapshots
run: |
mvn --batch-mode -e -DskipTests=true deploy
mvn --batch-mode -e -X -DskipTests=true deploy

0 comments on commit 796e7dd

Please sign in to comment.