Skip to content

Commit

Permalink
ADD: create pipeline and adjust app-config.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
AGiljanovic committed May 21, 2024
1 parent 2150f12 commit cd83465
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 21 deletions.
81 changes: 78 additions & 3 deletions .github/workflows/cd-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,84 @@ on:


jobs:
placeholder-job:
create-and-push-image:
permissions:
id-token: write
contents: read
name: "Create and push the Docker image to GAR"
runs-on: ubuntu-latest
defaults:
run:
shell: bash

steps:
- name: hello world
run: echo "Hello World"
- name: Checkout
uses: actions/checkout@v4
- id: 'setup-qemu'
name: Set up QEMU
uses: docker/setup-qemu-action@v3
- id: 'docker-buildx-setup'
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v2'
with:
create_credentials_file: true
token_format: access_token
workload_identity_provider: 'projects/1006240973223/locations/global/workloadIdentityPools/deploy-backstage/providers/github-actions'
service_account: '[email protected]'
- id: 'login-gar'
name: "Login to GAR"
uses: docker/login-action@v3
with:
registry: europe-west10-docker.pgk.dev
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
- id: 'build-and-push'
name: 'Build and Push docker Image'
uses: docker/build-push-action@v5
with:
push: true
context: .
file: ./Dockerfile
platforms: linux/amd64
tags: europe-west10-docker.pgk.dev/code-idp/backstage-deploy/backstage-image:${{ github.sha }}
build-args: |
APP_ENV=docker
deploy-image:
permissions:
id-token: write
contents: read
name: "Create and push the Docker image to GAR"
runs-on: ubuntu-latest
defaults:
run:
shell: bash

steps:
- name: Checkout
uses: actions/checkout@v4
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v2'
with:
create_credentials_file: true
workload_identity_provider: 'projects/1006240973223/locations/global/workloadIdentityPools/deploy-backstage/providers/github-actions'
service_account: '[email protected]'
- id: 'deploy'
uses: 'google-github-actions/deploy-cloudrun@v2'
with:
service: 'backstage-deployment'
image: 'europe-west10-docker.pgk.dev/code-idp/backstage-deploy/backstage-image:${{ github.sha }}'
env_vars: |
key=value
POSTGRES_HOST=code-idp:europe-west10-backstage-pg
POSTGRES_PORT=5432
POSTGRES_USER=postgres
BASE_URL=https://example.com #needs to be fixed
secrets: |-
POSTGRES_PASSWORD=postgres-password:latest
GITHUB_TOKEN=GITHUB_TOKEN
GOOGLE_CLIENT_ID=aslkdjf
GOOGLE_CLIENT_SECRET=fkajsdlf
14 changes: 9 additions & 5 deletions app-config.docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ catalog:
- type: file
target: minikube/catalog-info.yaml


auth:
environment: production
providers:
# see https://backstage.io/docs/auth/ to learn about auth providers
environment: development
providers:
github:
production:
clientId: ${GITHUB_CLIENT_ID}
development:
clientId: ${GITHUB_CLIENT_ID}
clientSecret: ${GITHUB_CLIENT_SECRET}
google:
development:
clientId: ${GOOGLE_CLIENT_ID}
clientSecret: ${GOOGLE_CLIENT_SECRET}
26 changes: 13 additions & 13 deletions app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,16 @@ auth:
clientId: ${GOOGLE_CLIENT_ID}
clientSecret: ${GOOGLE_CLIENT_SECRET}

kubernetes:
serviceLocatorMethod:
type: multiTenant
clusterLocatorMethods:
- type: config
clusters:
- url: ${K8S_URL}
name: 'k8s'
authProvider: serviceAccount
skipTLSVerify: false
skipMetricsLookup: true
serviceAccountToken: ${K8S_ACCOUNT_TOKEN}
caData: ${K8S_CA_DATA}
# kubernetes:
# serviceLocatorMethod:
# type: multiTenant
# clusterLocatorMethods:
# - type: config
# clusters:
# - url: ${K8S_URL}
# name: 'k8s'
# authProvider: serviceAccount
# skipTLSVerify: false
# skipMetricsLookup: true
# serviceAccountToken: ${K8S_ACCOUNT_TOKEN}
# caData: ${K8S_CA_DATA}

0 comments on commit cd83465

Please sign in to comment.