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

Disable deployment for now #172

Closed
wants to merge 1 commit into from
Closed
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
136 changes: 68 additions & 68 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,83 +1,83 @@
name: Backstage Deploy
# name: Backstage Deploy

on:
push:
branches: main
# on:
# push:
# branches: main

concurrency: ${{ github.ref }}
# concurrency: ${{ github.ref }}

env:
IMAGE: "northamerica-northeast1-docker.pkg.dev/frontside-backstage/frontside-artifacts/backstage"
CLUSTER: "backstage-cluster"
ZONE: "northamerica-northeast1-a"
# env:
# IMAGE: "northamerica-northeast1-docker.pkg.dev/frontside-backstage/frontside-artifacts/backstage"
# CLUSTER: "backstage-cluster"
# ZONE: "northamerica-northeast1-a"

jobs:
deploy:
name: Cloud Build & Deploy
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
steps:
- uses: actions/checkout@v2
# jobs:
# deploy:
# name: Cloud Build & Deploy
# runs-on: ubuntu-latest
# permissions:
# contents: 'read'
# id-token: 'write'
# steps:
# - uses: actions/checkout@v2

- name: Google Cloud Workload Identity Federation
uses: google-github-actions/auth@v0
with:
workload_identity_provider: ${{ secrets.CLOUD_WORKLOAD_PROVIDER}}
service_account: ${{ secrets.CLOUD_SERVICE_ACCOUNT }}
# - name: Google Cloud Workload Identity Federation
# uses: google-github-actions/auth@v0
# with:
# workload_identity_provider: ${{ secrets.CLOUD_WORKLOAD_PROVIDER}}
# service_account: ${{ secrets.CLOUD_SERVICE_ACCOUNT }}

- name: Setup Google Cloud SDK
uses: google-github-actions/setup-gcloud@v0
# - name: Setup Google Cloud SDK
# uses: google-github-actions/setup-gcloud@v0

- name: Install/Build Backstage
run: yarn && yarn tsc && yarn build
# - name: Install/Build Backstage
# run: yarn && yarn tsc && yarn build

- name: Set Tag with SHA
run: echo "TAG=`echo $GITHUB_SHA | cut -c 1-6`" >> $GITHUB_ENV
# - name: Set Tag with SHA
# run: echo "TAG=`echo $GITHUB_SHA | cut -c 1-6`" >> $GITHUB_ENV

- name: Cloud Build & Push to Artifacts Registry
run: gcloud builds submit . --config=cloudbuild.yaml --substitutions=_IMAGE="$IMAGE:$TAG"
# - name: Cloud Build & Push to Artifacts Registry
# run: gcloud builds submit . --config=cloudbuild.yaml --substitutions=_IMAGE="$IMAGE:$TAG"

- name: Inform Humanitec
run: |-
curl \
--request POST 'https://api.humanitec.io/orgs/${{ secrets.HUMANITEC_ORG_ID }}/images/backstage/builds' \
--header 'Authorization: Bearer ${{ secrets.HUMANITEC_TOKEN }}' \
--header 'Content-Type: application/json' \
--data-raw '{
"branch": "'$GITHUB_REF_NAME'",
"commit": "'$GITHUB_SHA'",
"image": "'$IMAGE:$TAG'",
"tags": ["'$TAG'"]
}'
# - name: Inform Humanitec
# run: |-
# curl \
# --request POST 'https://api.humanitec.io/orgs/${{ secrets.HUMANITEC_ORG_ID }}/images/backstage/builds' \
# --header 'Authorization: Bearer ${{ secrets.HUMANITEC_TOKEN }}' \
# --header 'Content-Type: application/json' \
# --data-raw '{
# "branch": "'$GITHUB_REF_NAME'",
# "commit": "'$GITHUB_SHA'",
# "image": "'$IMAGE:$TAG'",
# "tags": ["'$TAG'"]
# }'

- name: Authenticate to GKE Cluster
run: gcloud container clusters get-credentials $CLUSTER --zone $ZONE
# - name: Authenticate to GKE Cluster
# run: gcloud container clusters get-credentials $CLUSTER --zone $ZONE

- name: Helm Upgrade Postgres
run: |-
helm upgrade --install min-postgres-chart ./charts/postgres \
-f ./charts/postgres/Values.yaml \
--set postgresUsername=${{ secrets.POSTGRES_USER }} \
--set postgresPassword=${{ secrets.POSTGRES_PASSWORD }}
# - name: Helm Upgrade Postgres
# run: |-
# helm upgrade --install min-postgres-chart ./charts/postgres \
# -f ./charts/postgres/Values.yaml \
# --set postgresUsername=${{ secrets.POSTGRES_USER }} \
# --set postgresPassword=${{ secrets.POSTGRES_PASSWORD }}

- name: Helm Upgrade Backstage (backstage:${{ env.TAG }})
run: |-
helm upgrade --install min-backstage-chart ./charts/backstage \
-f ./charts/backstage/Values.yaml \
--set backstageImage="$IMAGE:$TAG" \
--set backstageGithubCredentials="$CREDENTIALS" \
--set humanitecToken="$HUMANITEC_TOKEN"
env:
CREDENTIALS: ${{ secrets.BACKSTAGE_GITHUB_APP_CREDENTIALS }}
HUMANITEC_TOKEN: ${{ secrets.HUMANITEC_TOKEN }}
# - name: Helm Upgrade Backstage (backstage:${{ env.TAG }})
# run: |-
# helm upgrade --install min-backstage-chart ./charts/backstage \
# -f ./charts/backstage/Values.yaml \
# --set backstageImage="$IMAGE:$TAG" \
# --set backstageGithubCredentials="$CREDENTIALS" \
# --set humanitecToken="$HUMANITEC_TOKEN"
# env:
# CREDENTIALS: ${{ secrets.BACKSTAGE_GITHUB_APP_CREDENTIALS }}
# HUMANITEC_TOKEN: ${{ secrets.HUMANITEC_TOKEN }}

- name: Confirm Deployment Status
id: deploy-status
continue-on-error: true
run: kubectl rollout status deployment/backstage
# - name: Confirm Deployment Status
# id: deploy-status
# continue-on-error: true
# run: kubectl rollout status deployment/backstage

- name: Rollback Deployment
if: steps.deploy-status.outcome == 'failure'
run: helm rollback min-backstage-chart
# - name: Rollback Deployment
# if: steps.deploy-status.outcome == 'failure'
# run: helm rollback min-backstage-chart