Skip to content

Commit 2085f4f

Browse files
authored
Use vars.PROJECT_ID as project for running CICD (#43)
1 parent d838d0b commit 2085f4f

File tree

6 files changed

+46
-51
lines changed

6 files changed

+46
-51
lines changed

.github/workflows/deployment_gke_dev.yaml

+8-7
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ on:
1111
workflow_dispatch:
1212

1313
env:
14-
PROJECT_ID: core-solution-services-develop
15-
SKAFFOLD_DEFAULT_REPO: gcr.io/core-solution-services-develop
14+
PROJECT_ID: "${{ vars.PROJECT_ID }}"
15+
SKAFFOLD_DEFAULT_REPO: gcr.io/gcp-mira-demo
1616
SKAFFOLD_NAMESPACE: default
1717
GKE_CLUSTER: main-cluster
1818
GKE_REGION: us-central1
1919
KUSTOMIZE_VERSION: 5.0.0
2020
SKAFFOLD_VERSION: 2.4.0
21-
SKAFFOLD_CACHE_GCS: gs://core-solution-services-develop.appspot.com/skaffold/cache
21+
SKAFFOLD_CACHE_GCS: gs://artifacts.gcp-mira-demo.appspot.com/skaffold/cache
2222

2323
# copier:raw
2424
jobs:
@@ -29,18 +29,19 @@ jobs:
2929
- name: Check out repository
3030
uses: actions/checkout@v3
3131

32-
# https://github.com/google-github-actions/auth
33-
- id: "auth"
32+
- id: auth
3433
name: Auth with Service Account
35-
uses: "google-github-actions/auth@v1"
34+
uses: google-github-actions/auth@v1
3635
with:
3736
credentials_json: "${{ secrets.GCP_CREDENTIALS }}"
3837
# FIXME: Use workload identity instead of service account key.
3938
# workload_identity_provider: ''
4039
# service_account: 'deployment-dev@${{ env.PROJECT_ID }}.iam.gserviceaccount.com'
4140

4241
- name: Set up Cloud SDK
43-
uses: "google-github-actions/setup-gcloud@v1"
42+
uses: google-github-actions/setup-gcloud@v1
43+
with:
44+
install_components: gke-gcloud-auth-plugin
4445

4546
- name: Connect to cluster
4647
run: |

.github/workflows/e2e_gke_api_test.yaml

+10-6
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ on:
1616
- ".github/workflows/e2e_gke_api_test.yaml"
1717
workflow_dispatch:
1818
env:
19-
PROJECT_ID: core-solution-services-develop
20-
SKAFFOLD_DEFAULT_REPO: gcr.io/core-solution-services-develop
19+
PROJECT_ID: "${{ vars.PROJECT_ID }}"
20+
SKAFFOLD_DEFAULT_REPO: gcr.io/gcp-mira-demo
2121
SKAFFOLD_NAMESPACE: default
2222
GKE_CLUSTER: main-cluster
2323
GKE_ZONE: us-central1
2424
KUSTOMIZE_VERSION: 5.0.0
2525
SKAFFOLD_VERSION: 2.4.0
26-
SKAFFOLD_CACHE_GCS: gs://core-solution-services-develop.appspot.com/skaffold/cache
26+
SKAFFOLD_CACHE_GCS: gs://artifacts.gcp-mira-demo.appspot.com/skaffold/cache
2727

2828
# copier:raw
2929
jobs:
@@ -34,12 +34,16 @@ jobs:
3434
- name: Check out repository
3535
uses: actions/checkout@v3
3636

37+
- id: auth
38+
name: Authenticate to Google Cloud
39+
uses: google-github-actions/auth@v1
40+
with:
41+
credentials_json: ${{ secrets.DEPLOYMENT_SA_KEY }}
42+
3743
- name: Install gcloud
3844
uses: google-github-actions/setup-gcloud@v1
3945
with:
40-
project_id: ${{env.PROJECT_ID}}
41-
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
42-
export_default_credentials: true
46+
install_components: gke-gcloud-auth-plugin
4347

4448
- name: Connect to cluster
4549
run: |

.github/workflows/unit_test_linter.yaml

+9-13
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
workflow_dispatch:
1414

1515
env:
16-
PROJECT_ID: "${{ secrets.PROJECT_ID }}"
16+
PROJECT_ID: "${{ vars.PROJECT_ID }}"
1717

1818
# copier:raw
1919
jobs:
@@ -33,24 +33,20 @@ jobs:
3333
steps:
3434
- uses: actions/checkout@v3
3535

36-
# https://github.com/google-github-actions/auth
37-
- id: "auth"
36+
- id: auth
3837
name: Auth with Service Account
39-
uses: "google-github-actions/auth@v1"
38+
uses: google-github-actions/auth@v1
4039
with:
4140
credentials_json: "${{ secrets.GCP_CREDENTIALS }}"
42-
# workload_identity_provider: "${{ secrets.WI_PROVIDER }}"
43-
# service_account: "deployment@${{ env.PROJECT_ID }}.iam.gserviceaccount.com"
4441

4542
- name: Set up Cloud SDK
46-
uses: "google-github-actions/setup-gcloud@v1"
43+
uses: google-github-actions/setup-gcloud@v1
44+
with:
45+
install_components: gke-gcloud-auth-plugin
4746

48-
- name: Install Firebase CLI
47+
- name: Install Firebase CLI and emulator
4948
run: |
5049
curl -sL https://firebase.tools | bash
51-
52-
- name: Download Firestore emulator
53-
run: |
5450
firebase setup:emulators:firestore
5551
5652
- name: Set up Python ${{ matrix.python-version }}
@@ -61,11 +57,11 @@ jobs:
6157
- name: Install dependencies
6258
run: |
6359
BASE_DIR=$(pwd)
64-
cd ${{ matrix.target-folder }}
6560
python -m pip install --upgrade pip
61+
if [ -f $BASE_DIR/components/common/requirements.txt ]; then pip install -r $BASE_DIR/components/common/requirements.txt; fi
62+
cd ${{ matrix.target-folder }}
6663
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
6764
if [ -f requirements-test.txt ]; then pip install -r requirements-test.txt; fi
68-
if [ -f $BASE_DIR/components/common/requirements.txt ]; then pip install -r $BASE_DIR/components/common/requirements.txt; fi
6965
7066
- name: Run pytest with coverage
7167
run: |

.github/workflows/unit_test_linter_llm_service.yaml

+9-13
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ on:
1414
workflow_dispatch:
1515

1616
env:
17-
PROJECT_ID: "${{ secrets.PROJECT_ID }}"
17+
PROJECT_ID: "${{ vars.PROJECT_ID }}"
1818

19-
# copoier:raw
19+
# copier:raw
2020
jobs:
2121
unit-test:
2222
runs-on: ubuntu-latest
@@ -28,24 +28,20 @@ jobs:
2828
steps:
2929
- uses: actions/checkout@v3
3030

31-
# https://github.com/google-github-actions/auth
32-
- id: "auth"
31+
- id: auth
3332
name: Auth with Service Account
34-
uses: "google-github-actions/auth@v1"
33+
uses: google-github-actions/auth@v1
3534
with:
3635
credentials_json: "${{ secrets.GCP_CREDENTIALS }}"
37-
# workload_identity_provider: "${{ secrets.WI_PROVIDER }}"
38-
# service_account: "deployment@${{ env.PROJECT_ID }}.iam.gserviceaccount.com"
3936

4037
- name: Set up Cloud SDK
41-
uses: "google-github-actions/setup-gcloud@v1"
38+
uses: google-github-actions/setup-gcloud@v1
39+
with:
40+
install_components: gke-gcloud-auth-plugin
4241

43-
- name: Install Firebase CLI
42+
- name: Install Firebase CLI and emulator
4443
run: |
4544
curl -sL https://firebase.tools | bash
46-
47-
- name: Download Firestore emulator
48-
run: |
4945
firebase setup:emulators:firestore
5046
5147
- name: Set up Python ${{ matrix.python-version }}
@@ -96,4 +92,4 @@ jobs:
9692
cd ${{ matrix.target-folder }}/src
9793
python -m pylint $(git ls-files '*.py') --rcfile=$BASE_DIR/.pylintrc
9894
99-
# copoier:endraw
95+
# copier:endraw

.github/workflows/unit_test_linter_rules_engine.yaml

+9-11
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
- ".pylintrc"
1313
workflow_dispatch:
1414
env:
15-
PROJECT_ID: gcp-mira-demo
15+
PROJECT_ID: "${{ vars.PROJECT_ID }}"
1616

1717
jobs:
1818
unit-test:
@@ -29,25 +29,23 @@ jobs:
2929
steps:
3030
- uses: actions/checkout@v3
3131

32-
# https://github.com/google-github-actions/auth
33-
- id: "auth"
32+
- id: auth
3433
name: Auth with Service Account
35-
uses: "google-github-actions/auth@v1"
34+
uses: google-github-actions/auth@v1
3635
with:
3736
credentials_json: "${{ secrets.GCP_CREDENTIALS }}"
3837
# FIXME: Use workload identity instead of service account key.
3938
# workload_identity_provider: ''
4039
# service_account: 'deployment-dev@${{ env.PROJECT_ID }}.iam.gserviceaccount.com'
4140

4241
- name: Set up Cloud SDK
43-
uses: "google-github-actions/setup-gcloud@v1"
42+
uses: google-github-actions/setup-gcloud@v1
43+
with:
44+
install_components: gke-gcloud-auth-plugin
4445

45-
- name: Install Firebase CLI
46+
- name: Install Firebase CLI and emulator
4647
run: |
4748
curl -sL https://firebase.tools | bash
48-
49-
- name: Download Firestore emulator
50-
run: |
5149
firebase setup:emulators:firestore
5250
5351
- name: Set up Python ${{ matrix.python-version }}
@@ -58,12 +56,12 @@ jobs:
5856
- name: Install dependencies
5957
run: |
6058
BASE_DIR=$(pwd)
61-
cd ${{ matrix.target-folder }}
6259
python -m pip install --upgrade pip
6360
python -m pip install pytest pytest-custom_exit_code pytest-cov pylint pytest-mock mock
61+
if [ -f $BASE_DIR/common/requirements.txt ]; then pip install -r $BASE_DIR/common/requirements.txt; fi
62+
cd ${{ matrix.target-folder }}
6463
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
6564
if [ -f requirements-test.txt ]; then pip install -r requirements-test.txt; fi
66-
if [ -f $BASE_DIR/common/requirements.txt ]; then pip install -r $BASE_DIR/common/requirements.txt; fi
6765
6866
- name: Run pytest with coverage
6967
run: |

components/user_management/src/routes/association_group_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# pylint: disable=unused-argument,redefined-outer-name,unused-import
2222
from fastapi import FastAPI
2323
from fastapi.testclient import TestClient
24-
from src.routes.association_group import router
24+
from routes.association_group import router
2525
from testing.test_config import API_URL
2626
from schemas.schema_examples import ( BASIC_ASSOCIATION_GROUP_EXAMPLE,
2727
ASSOCIATION_GROUP_EXAMPLE,

0 commit comments

Comments
 (0)