Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UPD: pull changes from main #31

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@ POSTGRES_PASSWORD="admin"

BASE_URL="http://localhost:7007"

GITHUB_CLIENT_ID="your-id"
GITHUB_CLIENT_SECRET="your-secret"

GITHUB_TOKEN="your-token"

K8S_URL="k8s-url"
K8S_ACCOUNT_TOKEN="k8s-account-token"
K8S_CA_DATA="k8s-ca-data"
K8S_CA_FILE="k8s-ca-file"
GOOGLE_CLIENT_ID="your-id"
GOOGLE_CLIENT_SECRET="your-secret"
91 changes: 91 additions & 0 deletions .github/workflows/cd-workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@

name: Deploy backstage
on:
workflow_dispatch:
push:
branches:
- main

jobs:
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: 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.pkg.dev/code-idp/backstage-deploy
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.pkg.dev/code-idp/backstage-deploy/backstage-image:${{ github.sha }}
build-args: |
APP_ENV=docker
deploy-image:
permissions:
id-token: write
contents: read
name: "Deploy image on cloud run"
runs-on: ubuntu-latest
defaults:
run:
shell: bash
needs: create-and-push-image
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.pkg.dev/code-idp/backstage-deploy/backstage-image:${{ github.sha }}'
region: europe-west1
flags: '--port=7007 --add-cloudsql-instances=code-idp:europe-west10:backstage-pg'
env_vars: |
POSTGRES_HOST=/cloudsql/code-idp:europe-west10:backstage-pg
POSTGRES_PORT=5432
POSTGRES_USER=postgres
BASE_URL=https://backstage.foundations-software-engineering.com
secrets: |-
POSTGRES_PASSWORD=postgres-password:latest
GITHUB_TOKEN=github_token:latest
GOOGLE_CLIENT_ID=google_client_id:latest
GOOGLE_CLIENT_SECRET=google_client_secret:latest
16 changes: 7 additions & 9 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Test and E2E tests
run-name: Run tests and E2E tests

name: Test and E2E tests on PR
run-name: Run tests and E2E tests on PR
on:
push:
pull_request:
branches:
- main
Expand All @@ -21,18 +19,18 @@ jobs:
run-e2e-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4 #chekcout te repository
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3 #setup node version 20
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Install dependencies #install dependencies
- name: Install dependencies
run: yarn install

- name: Run E2E tests
env:
PLAYWRIGHT_URL: http://localhost:3000 # set the URL of the app to test with playwright
CI: # unset CI because it is set by default in Github actions
PLAYWRIGHT_URL: http://localhost:3000
CI:
run: |
yarn test:e2e
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ RUN --mount=type=cache,target=/home/node/.cache/yarn,sharing=locked,uid=1000,gid

# Copy the built packages from the build stage
COPY --from=build --chown=node:node /app/packages/backend/dist/bundle/ ./
COPY --from=build --chown=node:node /app/minikube ./minikube/

ARG APP_ENV

Expand Down
Loading
Loading