Skip to content

Commit 82f9920

Browse files
authored
Merge branch 'main' into feature/setup-techdocs-and-monitoring
2 parents b43a167 + 678d874 commit 82f9920

File tree

6 files changed

+104
-115
lines changed

6 files changed

+104
-115
lines changed

.github/workflows/cd-workflow.yaml

Lines changed: 35 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,118 +1,77 @@
1-
name: Deploy Backstage
2-
1+
name: Deploy backstage
32
on:
4-
workflow_run:
5-
workflows: ["CI Workflow"]
6-
types:
7-
- completed
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
87

98
jobs:
109
create-and-push-image:
1110
permissions:
1211
id-token: write
13-
contents: read # Remove if not required
14-
15-
name: "Create and Push Docker Image to GAR"
12+
contents: read
13+
name: "Create and push the Docker image to GAR"
1614
runs-on: ubuntu-latest
1715
defaults:
1816
run:
1917
shell: bash
2018

2119
steps:
22-
- name: Checkout Repository
20+
- name: Checkout
2321
uses: actions/checkout@v4
24-
25-
- name: Set up QEMU
26-
id: setup-qemu
22+
- id: 'setup-qemu'
23+
name: Set up QEMU
2724
uses: docker/setup-qemu-action@v3
28-
29-
- name: Set up Docker Buildx
30-
id: docker-buildx-setup
25+
- id: 'docker-buildx-setup'
26+
name: Set up Docker Buildx
3127
uses: docker/setup-buildx-action@v3
32-
33-
- name: Authenticate to Google Cloud
34-
id: auth
35-
uses: google-github-actions/auth@v1
28+
- id: 'auth'
29+
name: 'Authenticate to Google Cloud'
30+
uses: 'google-github-actions/auth@v2'
3631
with:
37-
#create_credentials_file: true
32+
create_credentials_file: true
3833
token_format: access_token
39-
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
40-
service_account: ${{ secrets.GCP_DEPLOY_SA }}
41-
42-
- name: Set up GCP SDK
43-
uses: google-github-actions/setup-gcloud@v1
44-
with:
45-
version: "latest"
46-
project_id: ${{ secrets.GCP_PROJECT_ID }}
47-
48-
- name: Login to GAR
49-
id: login-gar
34+
workload_identity_provider: 'projects/1006240973223/locations/global/workloadIdentityPools/deploy-backstage/providers/github-actions'
35+
service_account: '[email protected]'
36+
- id: 'login-gar'
37+
name: "Login to GAR"
5038
uses: docker/login-action@v3
5139
with:
52-
registry: ${{ secrets.GCP_REGION }}-docker.pkg.dev
40+
registry: europe-west10-docker.pkg.dev/code-idp/backstage-deploy
5341
username: oauth2accesstoken
5442
password: ${{ steps.auth.outputs.access_token }}
55-
56-
- name: Configure Docker for Artifact Registry
57-
run: |
58-
gcloud auth configure-docker \
59-
${{ secrets.GCP_REGION }}-docker.pkg.dev
60-
61-
- name: Build and Push Docker Image
62-
id: build-and-push
43+
- id: 'build-and-push'
44+
name: 'Build and Push docker Image'
6345
uses: docker/build-push-action@v5
6446
with:
6547
push: true
6648
context: .
6749
file: ./Dockerfile
6850
platforms: linux/amd64
69-
tags: ${{ secrets.GCP_GAR_REPO }}/backstage-image:${{ github.sha }}
51+
tags: europe-west10-docker.pkg.dev/code-idp/backstage-deploy/backstage-image:${{ github.sha }}
7052
build-args: |
7153
APP_ENV=docker
72-
7354
deploy-image:
7455
permissions:
7556
id-token: write
76-
contents: read # Remove if not required
77-
78-
name: "Deploy Image on Cloud Run"
57+
contents: read
58+
name: "Deploy image on cloud run"
7959
runs-on: ubuntu-latest
80-
needs: create-and-push-image
8160
defaults:
8261
run:
8362
shell: bash
84-
63+
needs: create-and-push-image
8564
steps:
86-
- name: Checkout Repository
65+
- name: Checkout
8766
uses: actions/checkout@v4
88-
89-
- name: Authenticate to Google Cloud
90-
id: auth
91-
uses: google-github-actions/auth@v2
67+
- id: 'auth'
68+
name: 'Authenticate to Google Cloud'
69+
uses: 'google-github-actions/auth@v2'
9270
with:
9371
create_credentials_file: true
94-
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
95-
service_account: ${{ secrets.GCP_DEPLOY_SA }}
96-
97-
- name: Set up GCP SDK
98-
uses: google-github-actions/setup-gcloud@v1
99-
with:
100-
project_id: ${{ secrets.GCP_PROJECT_ID }}
101-
102-
103-
- name: Deploy to Cloud Run
104-
id: deploy
105-
uses: google-github-actions/deploy-cloudrun@v1
10672
with:
107-
project_id: ${{ secrets.GCP_PROJECT_ID }}
108-
service: ${{ secrets.GCP_CLOUD_RUN_SERVICE }}
109-
image: ${{ secrets.GCP_GAR_REPO }}/backstage-image:${{ github.sha }}
110-
region: ${{ secrets.GCP_REGION }}
111-
flags: >
112-
--allow-unauthenticated
73+
service: 'backstage-deployment'
74+
image: 'europe-west10-docker.pkg.dev/code-idp/backstage-deploy/backstage-image:${{ github.sha }}'
75+
region: europe-west10
76+
flags: |
11377
--port=7007
114-
--add-cloudsql-instances=${{ secrets.GCP_SQL_CONNECTION_NAME }}
115-
env_vars: |
116-
POSTGRES_HOST=${{ secrets.POSTGRES_HOST }}
117-
POSTGRES_PORT=5432
118-
BASE_URL=https://backstage.foundations-software-engineering.com

.github/workflows/techdocs-gcs.yml

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,13 @@ jobs:
1616
node-version: ['20.x']
1717

1818
env:
19-
TECHDOCS_BUCKET_NAME: ${{ secrets.TECHDOCS_BUCKET_NAME }}
20-
TECHDOCS_GCS_CREDENTIALS: ${{ secrets.TECHDOCS_GCS_CREDENTIALS }}
2119
ENTITY_NAMESPACE: 'default'
2220
ENTITY_KIND: 'Component'
2321
ENTITY_NAME: 'code-idp-docs'
2422

2523
steps:
2624
- name: Checkout code
2725
uses: actions/checkout@v4
28-
with:
29-
fetch-depth: 0
30-
31-
- name: Enable Corepack
32-
run: corepack enable
33-
34-
- name: Set Yarn Version
35-
run: corepack prepare [email protected] --activate
36-
37-
- name: Set up Node.js
38-
uses: actions/setup-node@v3
39-
with:
40-
node-version: ${{ matrix.node-version }}
41-
cache: 'yarn'
42-
43-
- name: Setup Python
44-
uses: actions/setup-python@v4
45-
with:
46-
python-version: '3.9'
47-
48-
- name: Install techdocs-cli
49-
run: yarn global add @techdocs/cli
50-
51-
- name: Install mkdocs and mkdocs-plugin
52-
run: python3 -m pip install mkdocs-techdocs-core==1.*
5326

5427
- name: Generate docs site
5528
run: techdocs-cli generate --no-docker --verbose

app-config.production.yaml

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,71 @@ backend:
88
methods: [GET, HEAD, PATCH, POST, PUT, DELETE]
99
credentials: true
1010

11+
database:
12+
client: pg
13+
connection:
14+
host: ${POSTGRES_HOST}
15+
port: ${POSTGRES_PORT}
16+
user: ${POSTGRES_USER}
17+
password: ${POSTGRES_PASSWORD}
18+
database: ${POSTGRES_DB}
19+
cache:
20+
store: memory
21+
22+
integrations:
23+
github:
24+
- host: github.com
25+
token: ${GITHUB_TOKEN}
26+
27+
gitlab:
28+
- host: gitlab.com
29+
token: ${GITLAB_TOKEN}
30+
31+
32+
techdocs:
33+
builder: 'external'
34+
generator:
35+
runIn: 'local'
36+
publisher:
37+
type: 'googleGcs'
38+
googleGcs:
39+
bucketName: 'backstage-codeidp-techdocs'
40+
projectId: code-idp
41+
credentials: ${TECHDOCS_GCS_CREDENTIALS}
42+
43+
# scaffolder:
44+
45+
46+
catalog:
47+
import:
48+
entityFilename: catalog-info.yaml
49+
pullRequestBranchName: backstage-integration
50+
rules:
51+
- allow: [Component, System, API, User, Group, Resource, Location, Domain]
52+
locations:
53+
- type: file
54+
target: ./examples/template/initiate-deployment.yaml
55+
rules:
56+
- allow: [Template]
57+
- type: file
58+
target: ./examples/template/register-component.yaml
59+
rules:
60+
- allow: [Template]
61+
- type: file
62+
target: ./examples/template/sample-document.yaml
63+
rules:
64+
- allow: [Template]
65+
66+
1167
auth:
1268
environment: production
1369
providers:
70+
google:
71+
development:
72+
clientId: ${GOOGLE_CLIENT_ID}
73+
clientSecret: ${GOOGLE_CLIENT_SECRET}
74+
1475
github:
15-
production:
16-
clientId: ${PROD_GITHUB_CLIENT_ID}
17-
clientSecret: ${PROD_GITHUB_CLIENT_SECRET}
76+
development:
77+
clientId: ${GITHUB_CLIENT_ID}
78+
clientSecret: ${GITHUB_CLIENT_SECRET}

app-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ backend:
2323
port: ${POSTGRES_PORT}
2424
user: ${POSTGRES_USER}
2525
password: ${POSTGRES_PASSWORD}
26+
database: ${POSTGRES_DB}
2627
cache:
2728
store: memory
2829

@@ -79,4 +80,4 @@ auth:
7980
development:
8081
clientId: ${GITHUB_CLIENT_ID}
8182
clientSecret: ${GITHUB_CLIENT_SECRET}
82-
83+

docs/how-to-register-a-component.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ metadata:
1919
description: Short description of your service
2020
spec:
2121
type: service
22-
lifecycle: development or production
22+
lifecycle: development or production or experimental
2323
owner: name_of_team or individual # Use an underscore to separate words for your team name
2424
```
2525
@@ -29,14 +29,14 @@ A minimal repository with an example can be found here:
2929
3030
### Register the component in Backstage
3131
32-
1. Click Create and then go to [Register an existing component]()
32+
1. Click Create and then go to [Register an existing component](https://backstage-deployment-1006240973223.europe-west10.run.app/catalog-import)
3333
section, paste the URL of the `catalog.yml` file in your repository
3434
(E.g. ``)
3535
1. Click **ANALYZE**, review and confirm the import with the button **IMPORT**.
3636
2. Your component configuration will be imported.
3737

3838

3939
!!! success
40-
Your component should be now available in the [Catalog home](https://).
40+
Your component should be now available in the [Catalog home](https://backstage-deployment-1006240973223.europe-west10.run.app/catalog).
4141

4242

mkdocs.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ nav:
55
- Overview:
66
- Introduction: 'index.md'
77
- Components:
8-
- Register Your Software Component: 'how-to-register-a-component.md'
9-
- Technical Documentation:
10-
- Publish Your Docs: 'how-to-publish-documentation.md'
11-
- Deployment:
12-
- How to Deploy Your App: 'how-to-deploy-your-app.md'
138
- CHANGELOG: 'CHANGELOG.md'
149

1510
plugins:

0 commit comments

Comments
 (0)