Skip to content

Commit 7abfdb2

Browse files
authored
UPD: update initial-deployment.yml template to contain update option in addition to create.
UPD: update the initial-deployment.yml template to contain an update option in addition to creating.
1 parent a00ccd4 commit 7abfdb2

File tree

2 files changed

+58
-6
lines changed

2 files changed

+58
-6
lines changed

app-config.yaml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ backend:
1919
client: pg
2020
connection:
2121
host: ${POSTGRES_HOST}
22-
port: ${POSTGRES_PORT}
23-
user: ${POSTGRES_USER}
22+
port: ${POSTGRES_PORT}
23+
user: ${POSTGRES_USER}
2424
password: ${POSTGRES_PASSWORD}
2525

2626
integrations:
@@ -35,7 +35,6 @@ techdocs:
3535
publisher:
3636
type: 'local' # Alternatives - 'googleGcs' or 'awsS3'. Read documentation for using alternatives.
3737

38-
3938
catalog:
4039
import:
4140
entityFilename: catalog-info.yaml
@@ -64,13 +63,18 @@ catalog:
6463
rules:
6564
- allow: [Template]
6665

66+
- type: file
67+
target: ../../packages/backend/src/templates/initiate-deployment.yaml
68+
rules:
69+
- allow: [Template]
70+
6771
auth:
6872
# see https://backstage.io/docs/auth/ to learn about auth providers
6973
environment: development
70-
providers:
74+
providers:
7175
github:
7276
development:
73-
clientId: ${GITHUB_CLIENT_ID}
77+
clientId: ${GITHUB_CLIENT_ID}
7478
clientSecret: ${GITHUB_CLIENT_SECRET}
7579

7680
kubernetes:
@@ -80,7 +84,7 @@ kubernetes:
8084
- type: config
8185
clusters:
8286
- url: ${K8S_URL}
83-
name: "k8s"
87+
name: 'k8s'
8488
authProvider: serviceAccount
8589
skipTLSVerify: false
8690
skipMetricsLookup: true
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
apiVersion: scaffolder.backstage.io/v1beta3
2+
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-template
3+
kind: Template
4+
metadata:
5+
name: GKE-cluster
6+
title: Initiate Deployment.
7+
description: Deploy application to google cloud for the first time or update an existing deployment.
8+
spec:
9+
owner: user:guest
10+
type: service
11+
12+
# These parameters are used to generate the input form in the frontend, and are
13+
# used to gather input data for the execution of the template.
14+
parameters:
15+
- title: Public github repo link to deploy
16+
required:
17+
- repoUrl
18+
properties:
19+
repoUrl:
20+
title: Public github Repo to deploy
21+
description: Provide the github repository link in the following format <https://github.com/your_user_name/your_repository_name>
22+
pattern: ^https:\/\/github\.com\/[a-zA-Z0-9_-]+\/[a-zA-Z0-9_-]
23+
type: string
24+
ui:options:
25+
allowedHosts:
26+
- github.com
27+
action:
28+
title: Action
29+
default: create
30+
# Note changing these paramters will lead to not triggering the github actions, it must be create or update.
31+
description: Action to perform (create new deployment for application/Update for updating an already deployed application)
32+
enum:
33+
- create
34+
- update
35+
36+
# These steps are executed in the scaffolder backend, using data that we gathered
37+
# via the parameters above.
38+
steps:
39+
# Start a github Action to build a GKE cluster with Terraform
40+
- id: github-action
41+
name: Trigger Github Action
42+
action: github:actions:dispatch
43+
input:
44+
workflowId: ${{parameters.action}}-image.yml
45+
repoUrl: 'github.com?repo=idp-hosted-projects&owner=codeuniversity'
46+
branchOrTagName: 'main'
47+
workflowInputs:
48+
githubRepo: ${{ parameters.repoUrl }}

0 commit comments

Comments
 (0)