Skip to content

Commit

Permalink
hot fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JuribaDev committed Aug 29, 2024
1 parent c290f38 commit fc4c4d4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 22 deletions.
23 changes: 11 additions & 12 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:

- name: Configure Docker for Artifact Registry
run: |
gcloud auth configure-docker ${LOCATION}-docker.pkg.dev
gcloud auth configure-docker ${{env.LOCATION}}-docker.pkg.dev
- name: Build and push Docker image for client
run: |
Expand All @@ -43,11 +43,11 @@ jobs:
--build-arg GITHUB_SHA=${{ github.sha }} \
--build-arg GITHUB_REF_NAME=${{ github.ref_name }} \
-f apps/client/Dockerfile \
-t ${LOCATION}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.REPO_NAME }}/client:${{ github.sha }} \
-t ${LOCATION}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.REPO_NAME }}/client:${{ github.ref_name }} \
-t ${{env.LOCATION}}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.REPO_NAME }}/client:${{ github.sha }} \
-t ${{env.LOCATION}}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.REPO_NAME }}/client:${{ github.ref_name }} \
.
docker push ${LOCATION}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.REPO_NAME }}/client:${{ github.sha }}
docker push ${LOCATION}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.REPO_NAME }}/client:${{ github.ref_name }}
docker push ${{env.LOCATION}}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.REPO_NAME }}/client:${{ github.sha }}
docker push ${{env.LOCATION}}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.REPO_NAME }}/client:${{ github.ref_name }}
- name: Build and push Docker image for server
run: |
Expand All @@ -56,18 +56,18 @@ jobs:
--build-arg GITHUB_SHA=${{ github.sha }} \
--build-arg GITHUB_REF_NAME=${{ github.ref_name }} \
-f apps/server/Dockerfile \
-t ${LOCATION}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.REPO_NAME }}/server:${{ github.sha }} \
-t ${LOCATION}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.REPO_NAME }}/server:${{ github.ref_name }} \
-t ${{env.LOCATION}}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.REPO_NAME }}/server:${{ github.sha }} \
-t ${{env.LOCATION}}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.REPO_NAME }}/server:${{ github.ref_name }} \
.
docker push ${LOCATION}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.REPO_NAME }}/server:${{ github.sha }}
docker push ${LOCATION}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.REPO_NAME }}/server:${{ github.ref_name }}
docker push ${{env.LOCATION}}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.REPO_NAME }}/server:${{ github.sha }}
docker push ${{env.LOCATION}}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.REPO_NAME }}/server:${{ github.ref_name }}
- name: Install kubectl
run: gcloud components install kubectl

- name: Deploy to GKE
run: |
gcloud container clusters get-credentials ${{ secrets.GKE_CLUSTER }} --zone ${LOCATION} --project ${{ secrets.GCP_PROJECT_ID }}
gcloud container clusters get-credentials ${{ secrets.GKE_CLUSTER }} --zone ${{env.LOCATION}} --project ${{ secrets.GCP_PROJECT_ID }}
# Create Namespace if Not Exists
if ! kubectl get namespace ${{ secrets.ENVIRONMENT_NAMESPACE }} &> /dev/null; then
Expand All @@ -84,8 +84,7 @@ jobs:
sed -i 's|ENVIRONMENT_NAMESPACE|'${{ secrets.ENVIRONMENT_NAMESPACE }}'|g' k8s/manifests.yaml
sed -i 's|MONGODB_URI_SECRET|'${{ secrets.MONGODB_URI_SECRET }}'|g' k8s/manifests.yaml
sed -i 's|JWT_KEY_SECRET|'${{ secrets.JWT_KEY_SECRET }}'|g' k8s/manifests.yaml
sed -i 's|JWT_EXPIRATION_KEY_SECRET|'${{ secrets.JWT_EXPIRATION }}'|g' k8s/manifests.yaml
sed -i 's|LOCATION|'${LOCATION}'|g' k8s/manifests.yaml
sed -i 's|LOCATION|'${{env.LOCATION}}'|g' k8s/manifests.yaml
sed -i 's|PROJECT_ID|'${{ secrets.GCP_PROJECT_ID }}'|g' k8s/manifests.yaml
sed -i 's|REPO_NAME|'${{ secrets.REPO_NAME }}'|g' k8s/manifests.yaml
sed -i 's|TAG|'${{ github.sha }}'|g' k8s/manifests.yaml
Expand Down
15 changes: 5 additions & 10 deletions k8s/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,14 @@ spec:
valueFrom:
secretKeyRef:
name: app-secrets
key: MONGODB_URI_KEY
key: MongodbURIKey
- name: JWT_SECRET
valueFrom:
secretKeyRef:
name: app-secrets
key: JWT_KEY

key: JwtKey
- name: JWT_EXPIRATION
valueFrom:
secretKeyRef:
name: app-secrets
key: JWT_EXPIRATION_KEY
value: "8h"

---
apiVersion: v1
Expand Down Expand Up @@ -117,6 +113,5 @@ metadata:
name: app-secrets
type: Opaque
stringData:
MONGODB_URI_KEY: "MONGODB_URI_SECRET"
JWT_KEY: "JWT_KEY_SECRET"
JWT_EXPIRATION_KEY: "JWT_EXPIRATION_KEY_SECRET"
MongodbURIKey: "MONGODB_URI_SECRET"
JwtKey: "JWT_KEY_SECRET"

0 comments on commit fc4c4d4

Please sign in to comment.