From e58f0ba35c1cbb7b353681819569fb65972f9cdf Mon Sep 17 00:00:00 2001 From: Mubangizi Allan Date: Fri, 24 Apr 2026 06:47:11 +0300 Subject: [PATCH 1/4] update staging app host server --- .github/workflows/staging.yaml | 39 ++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/.github/workflows/staging.yaml b/.github/workflows/staging.yaml index be554f9..ded3e6a 100644 --- a/.github/workflows/staging.yaml +++ b/.github/workflows/staging.yaml @@ -5,6 +5,7 @@ on: push: branches: - develop + - ch-update-host-server workflow_dispatch: @@ -84,23 +85,29 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Login (GCP) - uses: google-github-actions/auth@v2 + # --- GCP DEPLOYEMENT --- + # - name: Login (GCP) + # uses: google-github-actions/auth@v2 + # with: + # credentials_json: ${{ secrets.CREDENTIALS_JSON }} + + # - name: Install (Gcloud) + # uses: google-github-actions/setup-gcloud@v2 + # with: + # project_id: crane-cloud-274413 + # install_components: "gke-gcloud-auth-plugin" + + # - name: Login (Kubernetes Cluster) + # uses: google-github-actions/get-gke-credentials@v2 + # with: + # cluster_name: staging-cluster + # location: us-central1-a + # project_id: crane-cloud-274413 + + # --- RENU DEPLOYEMENT --- + - uses: azure/k8s-set-context@v1 with: - credentials_json: ${{ secrets.CREDENTIALS_JSON }} - - - name: Install (Gcloud) - uses: google-github-actions/setup-gcloud@v2 - with: - project_id: crane-cloud-274413 - install_components: "gke-gcloud-auth-plugin" - - - name: Login (Kubernetes Cluster) - uses: google-github-actions/get-gke-credentials@v2 - with: - cluster_name: staging-cluster - location: us-central1-a - project_id: crane-cloud-274413 + kubeconfig: ${{ secrets.RENU_KUBECONFIG}} - name: Add Repo (cranecloud) run: | From aa1940f25657f7ce95d241269e23c9c553c9d30e Mon Sep 17 00:00:00 2001 From: Mubangizi Allan Date: Thu, 11 Jun 2026 15:18:35 +0300 Subject: [PATCH 2/4] update prod deployment too --- .github/workflows/prod.yml | 68 +++++++++++++++++----------------- .github/workflows/staging.yaml | 3 +- helm/values.prod.yaml | 2 +- 3 files changed, 37 insertions(+), 36 deletions(-) diff --git a/.github/workflows/prod.yml b/.github/workflows/prod.yml index 0f43a0d..7ad1feb 100644 --- a/.github/workflows/prod.yml +++ b/.github/workflows/prod.yml @@ -6,6 +6,10 @@ on: types: - released - prereleased + #TODO: Remove this once the branch is merged + push: + branches: + - ch-update-host-server jobs: build: @@ -14,6 +18,8 @@ jobs: tag: ${{ steps.export.outputs.tag }} runs-on: ubuntu-latest + env: + image: cranecloud/database-api steps: - name: Checkout @@ -24,19 +30,11 @@ jobs: - name: Install (Buildx) uses: docker/setup-buildx-action@v3 - - name: Login (GCP) - uses: google-github-actions/auth@v2 - with: - credentials_json: ${{ secrets.CREDENTIALS_JSON }} - - - name: Install (Gcloud) - uses: google-github-actions/setup-gcloud@v1 + - name: Login to Docker Hub + uses: docker/login-action@v2 with: - project_id: crane-cloud-274413 - install_components: "gke-gcloud-auth-plugin" - - - name: Login (GCR) - run: gcloud auth configure-docker + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - id: meta name: Tag @@ -44,13 +42,11 @@ jobs: with: flavor: | latest=true - images: gcr.io/crane-cloud-274413/database-api + images: ${{ env.image }} tags: | - type=ref,event=branch - type=ref,event=pr type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} - type=sha + type=sha,prefix=prod- - name: Build uses: docker/build-push-action@v2 @@ -69,7 +65,7 @@ jobs: with: script: | const metadata = JSON.parse(`${{ steps.meta.outputs.json }}`) - const fullUrl = metadata.tags.find((t) => t.includes(':sha-')) + const fullUrl = metadata.tags.find((t) => t.includes(':prod-sha-')) if (fullUrl == null) { core.error('Unable to find sha tag of image') } else { @@ -93,23 +89,29 @@ jobs: - name: Clone uses: actions/checkout@v2 - - name: Login (GCP) - uses: google-github-actions/auth@v2 - with: - credentials_json: ${{ secrets.CREDENTIALS_JSON }} - - - name: Install (Gcloud) - uses: google-github-actions/setup-gcloud@v1 - with: - project_id: crane-cloud-274413 - install_components: "gke-gcloud-auth-plugin" - - - name: Login (Kubernetes Cluster) - uses: google-github-actions/get-gke-credentials@v1 + # --- GCP DEPLOYMENT --- + # - name: Login (GCP) + # uses: google-github-actions/auth@v2 + # with: + # credentials_json: ${{ secrets.CREDENTIALS_JSON }} + + # - name: Install (Gcloud) + # uses: google-github-actions/setup-gcloud@v1 + # with: + # project_id: crane-cloud-274413 + # install_components: "gke-gcloud-auth-plugin" + + # - name: Login (Kubernetes Cluster) + # uses: google-github-actions/get-gke-credentials@v1 + # with: + # cluster_name: staging-cluster + # location: us-central1-a + # project_id: crane-cloud-274413 + + # --- RENU DEPLOYEMENT --- + - uses: azure/k8s-set-context@v1 with: - cluster_name: staging-cluster - location: us-central1-a - project_id: crane-cloud-274413 + kubeconfig: ${{ secrets.RENU_KUBECONFIG}} - name: Add Repo (cranecloud) run: | diff --git a/.github/workflows/staging.yaml b/.github/workflows/staging.yaml index ded3e6a..5454100 100644 --- a/.github/workflows/staging.yaml +++ b/.github/workflows/staging.yaml @@ -5,7 +5,6 @@ on: push: branches: - develop - - ch-update-host-server workflow_dispatch: @@ -85,7 +84,7 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - # --- GCP DEPLOYEMENT --- + # --- GCP DEPLOYMENT --- # - name: Login (GCP) # uses: google-github-actions/auth@v2 # with: diff --git a/helm/values.prod.yaml b/helm/values.prod.yaml index b79b023..cf895c7 100644 --- a/helm/values.prod.yaml +++ b/helm/values.prod.yaml @@ -1,7 +1,7 @@ replicaCount: 1 image: - repository: gcr.io/crane-cloud-274413/database-api + repository: cranecloud/database-api pullPolicy: Always tag: ${{ DOCKER_IMAGE_TAG }} From a38df46cdc8b1f9268980a59b283e375a1557349 Mon Sep 17 00:00:00 2001 From: Mubangizi Allan Date: Thu, 11 Jun 2026 16:35:40 +0300 Subject: [PATCH 3/4] improve tag validation --- .github/workflows/prod.yml | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/prod.yml b/.github/workflows/prod.yml index 7ad1feb..4aefb35 100644 --- a/.github/workflows/prod.yml +++ b/.github/workflows/prod.yml @@ -25,7 +25,8 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: - ref: master # reference branch + # ref: master # reference branch + ref: ch-update-host-server - name: Install (Buildx) uses: docker/setup-buildx-action@v3 @@ -44,8 +45,10 @@ jobs: latest=true images: ${{ env.image }} tags: | - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}},enable=${{ github.event_name == 'release' }} + type=semver,pattern={{major}}.{{minor}},enable=${{ github.event_name == 'release' }} type=sha,prefix=prod- - name: Build @@ -65,9 +68,19 @@ jobs: with: script: | const metadata = JSON.parse(`${{ steps.meta.outputs.json }}`) - const fullUrl = metadata.tags.find((t) => t.includes(':prod-sha-')) + const isRelease = context.eventName === 'release' + + let fullUrl + if (isRelease) { + // Pick the full semver tag e.g. 1.16.0 + fullUrl = metadata.tags.find((t) => /:\d+\.\d+\.\d+$/.test(t)) + } else { + // Pick the sha tag e.g. prod-abc1234 + fullUrl = metadata.tags.find((t) => t.includes(':prod-')) + } + if (fullUrl == null) { - core.error('Unable to find sha tag of image') + core.error('Unable to find tag of image') } else { const tag = fullUrl.split(':')[1] core.setOutput('image', fullUrl) From e1a85043a35c002c29f8f76aae384f5d4d827b76 Mon Sep 17 00:00:00 2001 From: Mubangizi Allan Date: Thu, 11 Jun 2026 16:41:32 +0300 Subject: [PATCH 4/4] remove test workflows --- .github/workflows/prod.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/prod.yml b/.github/workflows/prod.yml index 4aefb35..1b332d4 100644 --- a/.github/workflows/prod.yml +++ b/.github/workflows/prod.yml @@ -6,10 +6,6 @@ on: types: - released - prereleased - #TODO: Remove this once the branch is merged - push: - branches: - - ch-update-host-server jobs: build: @@ -25,8 +21,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: - # ref: master # reference branch - ref: ch-update-host-server + ref: master # reference branch - name: Install (Buildx) uses: docker/setup-buildx-action@v3