Skip to content

Commit e2cb9c6

Browse files
authored
FIX: remove dependency on database connection (#68)
* DEL: delete file * ADD: prod configurations * UPD:cd workflow with variable names * UPD:remove workflow dependency on database connection
1 parent 36af6e0 commit e2cb9c6

File tree

3 files changed

+45
-76
lines changed

3 files changed

+45
-76
lines changed

.github/workflows/cd-workflow.yaml

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
21
name: Deploy backstage
2+
33
on:
4-
workflow_run:
5-
workflows:
6-
- CI Workflow
7-
types:
8-
- completed
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
910

1011
jobs:
1112
create-and-push-image:
@@ -21,27 +22,32 @@ jobs:
2122
steps:
2223
- name: Checkout
2324
uses: actions/checkout@v4
25+
2426
- id: 'setup-qemu'
2527
name: Set up QEMU
2628
uses: docker/setup-qemu-action@v3
29+
2730
- id: 'docker-buildx-setup'
2831
name: Set up Docker Buildx
2932
uses: docker/setup-buildx-action@v3
33+
3034
- name: 'Authenticate to Google Cloud'
3135
id: 'auth'
3236
uses: 'google-github-actions/auth@v2'
3337
with:
3438
create_credentials_file: true
3539
token_format: "access_token"
36-
workload_identity_provider: 'projects/1006240973223/locations/global/workloadIdentityPools/deploy-backstage/providers/github-actions'
37-
service_account: '[email protected]'
40+
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
41+
service_account: ${{ secrets.GCP_DEPLOY_SA }}
42+
3843
- name: "Login to GAR"
3944
id: 'login-gar'
4045
uses: docker/login-action@v3
4146
with:
42-
registry: europe-west10-docker.pkg.dev/code-idp/backstage-deploy
47+
registry: ${{ secrets.GCP_REGION }}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_GAR_REPO }}
4348
username: oauth2accesstoken
4449
password: ${{ steps.auth.outputs.access_token }}
50+
4551
- id: 'build-and-push'
4652
name: 'Build and Push docker Image'
4753
uses: docker/build-push-action@v5
@@ -50,46 +56,48 @@ jobs:
5056
context: .
5157
file: ./Dockerfile
5258
platforms: linux/amd64
53-
tags: europe-west10-docker.pkg.dev/code-idp/backstage-deploy/backstage-image:${{ github.sha }}
59+
tags: ${{ secrets.GCP_REGION }}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_GAR_REPO }}/backstage-image:${{ github.sha }}
5460
build-args: |
5561
APP_ENV=docker
62+
63+
5664
deploy-image:
5765
permissions:
5866
id-token: write
5967
contents: read
68+
6069
name: "Deploy image on cloud run"
6170
runs-on: ubuntu-latest
6271
defaults:
6372
run:
6473
shell: bash
6574
needs: create-and-push-image
75+
6676
steps:
6777
- name: Checkout
6878
uses: actions/checkout@v4
79+
6980
- id: 'auth'
7081
name: 'Authenticate to Google Cloud'
7182
uses: 'google-github-actions/auth@v2'
7283
with:
7384
create_credentials_file: true
74-
workload_identity_provider: 'projects/1006240973223/locations/global/workloadIdentityPools/deploy-backstage/providers/github-actions'
75-
service_account: '[email protected]'
76-
- id: 'deploy'
85+
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
86+
service_account: ${{ secrets.GCP_DEPLOY_SA }}
87+
88+
- name: Deploy to Cloud Run
89+
id: 'deploy'
7790
uses: 'google-github-actions/deploy-cloudrun@v2'
7891
with:
79-
service: 'backstage-deployment'
80-
image: 'europe-west10-docker.pkg.dev/code-idp/backstage-deploy/backstage-image:${{ github.sha }}'
81-
region: europe-west1
82-
flags: '--port=7007 --add-cloudsql-instances=code-idp:europe-west10:backstage-pg'
83-
env_vars: |
84-
POSTGRES_HOST=/cloudsql/code-idp:europe-west10:backstage-pg
85-
POSTGRES_PORT=5432
86-
POSTGRES_USER=postgres
87-
BASE_URL=https://backstage.foundations-software-engineering.com
92+
service: ${{ secrets.GCP_CLOUD_RUN_SERVICE }}
93+
image: ${{ secrets.GCP_REGION }}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_GAR_REPO }}/backstage-image:${{ github.sha }}
94+
region: ${{ secrets.GCP_REGION }}
95+
flags: '--platform managed --allow-unauthenticated --port=7007'
8896
secrets: |-
89-
POSTGRES_PASSWORD=postgres-password:latest
9097
GITHUB_TOKEN=github_token:latest
98+
GITLAB_TOKEN=gitlab_token:latest
9199
GOOGLE_CLIENT_ID=google_client_id:latest
92100
GOOGLE_CLIENT_SECRET=google_client_secret:latest
93-
GITHUB_CLIENT_SECRET=github_client_secret:latest
94-
GITHUB_CLIENT_ID=github_client_id:latest
101+
PROD_GITHUB_CLIENT_SECRET=github_client_secret:latest
102+
PROD_GITHUB_CLIENT_ID=github_client_id:latest
95103

.github/workflows/delete-old-branches.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

app-config.production.yaml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
app:
2-
baseUrl: prodlink
2+
baseUrl: https://backstage.code-idp.com
33

44
backend:
5-
baseUrl: prodlink
5+
baseUrl: https://backstage.code-idp.com
66
cors:
7-
origin: prodlink
7+
origin: https://backstage.code-idp.com
88
methods: [GET, HEAD, PATCH, POST, PUT, DELETE]
9-
credentials: true
9+
credentials: true
10+
11+
auth:
12+
environment: production
13+
providers:
14+
github:
15+
production:
16+
clientId: ${PROD_GITHUB_CLIENT_ID}
17+
clientSecret: ${PROD_GITHUB_CLIENT_SECRET}

0 commit comments

Comments
 (0)