-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
88b8ef3
commit 51091ca
Showing
3 changed files
with
43 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,7 +78,7 @@ jobs: | |
|
||
#TODO: add editor config for dotnet | ||
- name: PyLint | ||
working-directory: ${{ inputs.code_directory }} | ||
working-directory: ${{ vars.code_directory }} | ||
run: | | ||
pip install -r requirements.txt | ||
pip install pylint | ||
|
@@ -98,7 +98,7 @@ jobs: | |
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ '${{ inputs.language }}' ] #TODO: add csharp | ||
language: [ '${{ vars.language }}' ] #TODO: add csharp | ||
|
||
steps: | ||
- name: Checkout repository | ||
|
@@ -109,7 +109,7 @@ jobs: | |
uses: github/codeql-action/init@v2 | ||
with: | ||
languages: ${{ matrix.language }} | ||
source-root: ${{ inputs.code_directory }} | ||
source-root: ${{ vars.code_directory }} | ||
|
||
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). | ||
# If this step fails, then you should remove it and run the build manually (see below) | ||
|
@@ -126,7 +126,7 @@ jobs: | |
if: contains(fromJSON('["develop", "main"]'), github.ref_name) | ||
name: "Image Build & Push" | ||
runs-on: ubuntu-latest | ||
environment: ${{ inputs.environment }} | ||
environment: ${{ vars.environment }} | ||
permissions: | ||
id-token: write | ||
contents: read | ||
|
@@ -149,30 +149,30 @@ jobs: | |
with: | ||
username: 'oauth2accesstoken' | ||
password: '${{ steps.auth.outputs.access_token }}' | ||
registry: '${{ inputs.region }}-docker.pkg.dev' | ||
registry: '${{ vars.region }}-docker.pkg.dev' | ||
|
||
- name: Build and Tag | ||
id: build-image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: ${{ inputs.code_directory }} | ||
context: ${{ vars.code_directory }} | ||
push: true | ||
tags: | | ||
${{ inputs.region }}-docker.pkg.dev/${{ inputs.gcp_project_id }}/${{ inputs.artifact_registry_repo }}/${{ inputs.service_name }}:${{ inputs.ref }} | ||
${{ inputs.region }}-docker.pkg.dev/${{ inputs.gcp_project_id }}/${{ inputs.artifact_registry_repo }}/${{ inputs.service_name }}:latest | ||
${{ vars.region }}-docker.pkg.dev/${{ vars.gcp_project_id }}/${{ vars.artifact_registry_repo }}/${{ vars.service_name }}:${{ github.ref }} | ||
${{ vars.region }}-docker.pkg.dev/${{ vars.gcp_project_id }}/${{ vars.artifact_registry_repo }}/${{ vars.service_name }}:latest | ||
#TODO: push fromo QA to PROD, build once | ||
- name: Docker Push | ||
shell: bash | ||
run: |- | ||
docker push "${{ inputs.region }}-docker.pkg.dev/${{ inputs.gcp_project_id }}/${{ inputs.artifact_registry_repo }}/${{ inputs.service_name }}:${{ inputs.ref }}" | ||
docker push "${{ inputs.region }}-docker.pkg.dev/${{ inputs.gcp_project_id }}/${{ inputs.artifact_registry_repo }}/${{ inputs.service_name }}:latest" | ||
docker push "${{ vars.region }}-docker.pkg.dev/${{ vars.gcp_project_id }}/${{ vars.artifact_registry_repo }}/${{ vars.service_name }}:${{ github.ref }}" | ||
docker push "${{ vars.region }}-docker.pkg.dev/${{ vars.gcp_project_id }}/${{ vars.artifact_registry_repo }}/${{ vars.service_name }}:latest" | ||
deploy: | ||
if: contains(fromJSON('["develop", "main"]'), github.ref_name) && ${{ inputs.environment }} != "prod" | ||
if: contains(fromJSON('["develop", "main"]'), github.ref_name) && ${{ vars.environment }} != "prod" | ||
name: "Cloud Run Deployment" | ||
runs-on: ubuntu-latest | ||
environment: ${{ inputs.environment }} | ||
environment: ${{ vars.environment }} | ||
needs: [image-build-push] | ||
permissions: | ||
id-token: write | ||
|
@@ -189,28 +189,28 @@ jobs: | |
workload_identity_provider: '${{ secrets.WIF_PROVIDER }}' # e.g. - projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider | ||
service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}' # e.g. - [email protected] | ||
|
||
- name: Create Service ${{ inputs.environment }} Declaration | ||
- name: Create Service ${{ vars.environment }} Declaration | ||
run: |- | ||
export CONTAINER_IMAGE="${{ inputs.region }}-docker.pkg.dev/${{ inputs.gcp_project_id }}/${{ inputs.artifact_registry_repo }}/${{ inputs.service_name }}:${{ inputs.ref }}" | ||
export SERVICE_NAME="${{ inputs.service_name }}" | ||
export PROJECT_ID="${{ inputs.gcp_project_id }}" | ||
export REVISION_TAG="${{ inputs.ref }}" | ||
export CLOUD_RUN_SA="${{ inputs.cloud_run_sa }}" | ||
export REGION="${{ inputs.region }}" | ||
export APP_CODE="${{ inputs.app_code }}" | ||
export CLASSIFICATION="${{ inputs.classification }}" | ||
export COST_ID="${{ inputs.cost_id }}" | ||
export DEPARTMENT_ID="${{ inputs.department_id }}" | ||
export HCA_PROJECT_ID="${{ inputs.hca_project_id }}" | ||
export TCO_ID="${{ inputs.tco_id }}" | ||
export ENVIRONMENT="${{ inputs.environment }}" | ||
envsubst < ./service-yaml/container-${{ inputs.environment }}.yaml > container-${{ inputs.environment }}.yaml | ||
export CONTAINER_IMAGE="${{ vars.region }}-docker.pkg.dev/${{ vars.gcp_project_id }}/${{ vars.artifact_registry_repo }}/${{ vars.service_name }}:${{ github.ref }}" | ||
export SERVICE_NAME="${{ vars.service_name }}" | ||
export PROJECT_ID="${{ vars.gcp_project_id }}" | ||
export REVISION_TAG="${{ github.ref }}" | ||
export CLOUD_RUN_SA="${{ vars.cloud_run_sa }}" | ||
export REGION="${{ vars.region }}" | ||
export APP_CODE="${{ vars.app_code }}" | ||
export CLASSIFICATION="${{ vars.classification }}" | ||
export COST_ID="${{ vars.cost_id }}" | ||
export DEPARTMENT_ID="${{ vars.department_id }}" | ||
export HCA_PROJECT_ID="${{ vars.hca_project_id }}" | ||
export TCO_ID="${{ vars.tco_id }}" | ||
export ENVIRONMENT="${{ vars.environment }}" | ||
envsubst < ./service-yaml/container-${{ vars.environment }}.yaml > container-${{ vars.environment }}.yaml | ||
- name: Deploy to ${{ inputs.environment }} Cloud Run | ||
- name: Deploy to ${{ vars.environment }} Cloud Run | ||
id: deploy-dev-qa | ||
uses: google-github-actions/deploy-cloudrun@v0 | ||
with: | ||
project_id: ${{ inputs.gcp_project_id }} | ||
service: ${{ inputs.service_name }} | ||
region: ${{ inputs.region }} | ||
metadata: container-${{ inputs.environment }}.yaml | ||
project_id: ${{ vars.gcp_project_id }} | ||
service: ${{ vars.service_name }} | ||
region: ${{ vars.region }} | ||
metadata: container-${{ vars.environment }}.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters