Skip to content

Commit

Permalink
fix: image check + deploy empty full tag bug
Browse files Browse the repository at this point in the history
  • Loading branch information
shivanshs9 committed Nov 11, 2024
1 parent c2ffabf commit 90f8de1
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 16 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/build-push-gcloud.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,13 @@ on:
tag:
description: "Image tag"
value: ${{ jobs.push.outputs.tag }}
full_tag:
description: "Full image tag"
value: ${{ jobs.push.outputs.full_tag }}
jobs:
push:
name: "Build & Push"
runs-on: ubuntu-latest
outputs:
imageid: ${{ steps.build.outputs.imageid }}
tag: ${{ steps.vars.outputs.tag }}
full_tag: ${{ steps.vars.outputs.full_tag }}
steps:
- uses: actions/checkout@v4
- name: Docker login to Google Cloud
Expand All @@ -69,7 +65,7 @@ jobs:
with:
registry: ${{ inputs.registry }}
image_name: ${{ secrets.GCLOUD_PROJECT }}/${{ inputs.repo }}
tag: ${{ steps.vars.outputs.branch }}-${{ steps.vars.outputs.sha_short }}
tag: ${{ steps.vars.outputs.tag }}
- uses: docker/setup-buildx-action@v3
if: steps.image_exists.outcome == 'failure'
- uses: docker/build-push-action@v5
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/cd-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,16 @@ jobs:
run: |
# Write the new image tags to the kustomization files
cd backend
kustomize edit set image grpc-backend=$BACKEND_IMAGE
kustomize edit set image grpc-backend=$REGISTRY/$GCP_PROJECT/services/whisper-notes-backend:$IMAGE_TAG
cd ../frontend
kustomize edit set image frontend=$FRONTEND_IMAGE
kustomize edit set image frontend=$REGISTRY/$GCP_PROJECT/services/whisper-notes-frontend:$IMAGE_TAG
# Commit the changes
git add -u
sha_short=$(git rev-parse --short HEAD)
git commit -m "cd: Update image to main-$sha_short"
git commit -m "cd: Update image to $sha_short"
git push
env:
BACKEND_IMAGE: ${{ needs.push-backend.outputs.full_tag }}
FRONTEND_IMAGE: ${{ needs.push-frontend.outputs.full_tag }}
REGISTRY: europe-north1-docker.pkg.dev
GCP_PROJECT: ${{ secrets.GCLOUD_PROJECT }}
IMAGE_TAG: ${{ needs.push-backend.outputs.tag }}
8 changes: 8 additions & 0 deletions iac/pulumi-gcp/infra/init-network-k8s/Pulumi.prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
encryptionsalt: v1:rJqNqFtNo3k=:v1:/pH6ZHVlVq+pb4bN:PA5f3qC95QU8lOwGB4YkVykohoDIWg==
config:
gcp:project: "" # CHANGEME: GCP Project ID
project: whisper
env: "prod"
region: "" # CHANGEME: GCP Region
shortRegion: "" # CHANGEME: GCP Short Region
ipPrefix: "172.16"
8 changes: 8 additions & 0 deletions iac/pulumi-gcp/infra/k8s-cluster/Pulumi.prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
encryptionsalt: v1:rJqNqFtNo3k=:v1:/pH6ZHVlVq+pb4bN:PA5f3qC95QU8lOwGB4YkVykohoDIWg==
config:
gcp:project: "" # CHANGEME: GCP Project ID
project: whisper
env: "prod"
region: "" # CHANGEME: GCP Region
shortRegion: "" # CHANGEME: GCP Short Region
ipPrefix: "172.16"
7 changes: 7 additions & 0 deletions iac/pulumi-gcp/infra/whisper-notes-db/Pulumi.prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
encryptionsalt: v1:rJqNqFtNo3k=:v1:/pH6ZHVlVq+pb4bN:PA5f3qC95QU8lOwGB4YkVykohoDIWg==
config:
gcp:project: "" # CHANGEME: GCP Project ID
project: whisper
env: "prod"
region: "" # CHANGEME: GCP Region
shortRegion: "" # CHANGEME: GCP Short Region
5 changes: 2 additions & 3 deletions iac/services/backend/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ labels:
- pairs:
app.kubernetes.io/version: latest

# CHANGEME: replace with GCP Artifact Registry
images:
- name: grpc-backend
- name: grpc-backend:latest
newName: europe-north1-docker.pkg.dev/${GCP_PROJECT}/services/whisper-notes-backend
# CHANGEME: replace with GCP Artifact Registry
newName: europe-north1-docker.pkg.dev/${PROJECT}/services/whisper-notes-backend
newTag: main-5d9cf2b
6 changes: 3 additions & 3 deletions iac/services/frontend/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ labels:
- pairs:
app.kubernetes.io/version: latest

# CHANGEME: replace with GCP Artifact Registry

images:
- name: frontend
- name: frontend:latest
newName: europe-north1-docker.pkg.dev/${GCP_PROJECT}/services/whisper-notes-frontend
# CHANGEME: replace with GCP Artifact Registry
newName: europe-north1-docker.pkg.dev/${PROJECT}/services/whisper-notes-frontend
newTag: main-3354b15

0 comments on commit 90f8de1

Please sign in to comment.