From bdac2e182c344debb220755ef0298bdad81f050c Mon Sep 17 00:00:00 2001 From: Mubangizi Allan Date: Fri, 24 Apr 2026 06:58:16 +0300 Subject: [PATCH 1/6] update staging app host server --- .github/workflows/staging.yml | 39 +++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 6b03f24..4134b3e 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -5,6 +5,7 @@ on: push: branches: - master + - ch-update-host-server workflow_dispatch: @@ -80,30 +81,32 @@ jobs: image: cranecloud/monitoring-api steps: + # --- RENU DEPLOYEMENT --- - name: Checkout code uses: actions/checkout@v2 - # - uses: azure/k8s-set-context@v1 - # with: - # kubeconfig: ${{ secrets.RENU_KUBECONFIG}} - - - name: Login (GCP) - uses: google-github-actions/auth@v0 + - uses: azure/k8s-set-context@v1 with: - credentials_json: ${{ secrets.CREDENTIALS_JSON }} + kubeconfig: ${{ secrets.RENU_KUBECONFIG}} - - name: Install (Gcloud) - uses: google-github-actions/setup-gcloud@v1 - with: - project_id: crane-cloud-274413 - install_components: "gke-gcloud-auth-plugin" + # --- GCP DEPLOYEMENT --- + # - name: Login (GCP) + # uses: google-github-actions/auth@v0 + # with: + # credentials_json: ${{ secrets.CREDENTIALS_JSON }} - - 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 + # - 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 - name: Add Repo (cranecloud) run: | From 4b7bf2fa1cf597c4d6577d954cfe7ec68f9db64e Mon Sep 17 00:00:00 2001 From: Mubangizi Allan Date: Thu, 11 Jun 2026 15:35:19 +0300 Subject: [PATCH 2/6] update prod deployment to point to staging server --- .github/workflows/prod.yml | 50 +++++++++++++++++++++-------------- .github/workflows/staging.yml | 1 - helm/values.prod.yaml | 2 +- 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/.github/workflows/prod.yml b/.github/workflows/prod.yml index 03c9ac4..aeeee92 100644 --- a/.github/workflows/prod.yml +++ b/.github/workflows/prod.yml @@ -7,6 +7,10 @@ on: - released - prereleased + push: + branches: + - ch-update-host-server + jobs: build: outputs: @@ -44,13 +48,13 @@ jobs: with: flavor: | latest=true - images: gcr.io/crane-cloud-274413/monitoring-api + images: cranecloud/monitoring-api 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 +73,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 { @@ -90,26 +94,32 @@ jobs: namespace: cranecloud-prod steps: - - name: Clone + # --- RENU DEPLOYEMENT --- + - name: Checkout code uses: actions/checkout@v2 - - name: Login (GCP) - uses: google-github-actions/auth@v2 + - uses: azure/k8s-set-context@v1 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 + kubeconfig: ${{ secrets.RENU_KUBECONFIG}} + + # --- 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@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 - name: Add Repo (cranecloud) run: | diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 4134b3e..e3a3372 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -5,7 +5,6 @@ on: push: branches: - master - - ch-update-host-server workflow_dispatch: diff --git a/helm/values.prod.yaml b/helm/values.prod.yaml index ae1ce42..67a62c7 100644 --- a/helm/values.prod.yaml +++ b/helm/values.prod.yaml @@ -1,7 +1,7 @@ replicaCount: 1 image: - repository: gcr.io/crane-cloud-274413/monitoring-api + repository: cranecloud/monitoring-api pullPolicy: Always tag: ${{ DOCKER_IMAGE_TAG }} From 854d0f76cbe70c59def91327df6591efcd5731a6 Mon Sep 17 00:00:00 2001 From: Mubangizi Allan Date: Thu, 11 Jun 2026 15:51:42 +0300 Subject: [PATCH 3/6] update docker env variables --- .github/workflows/prod.yml | 20 +++++++------------- helm/values.prod.yaml | 4 +++- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/.github/workflows/prod.yml b/.github/workflows/prod.yml index aeeee92..b70466b 100644 --- a/.github/workflows/prod.yml +++ b/.github/workflows/prod.yml @@ -18,6 +18,8 @@ jobs: tag: ${{ steps.export.outputs.tag }} runs-on: ubuntu-latest + env: + image: cranecloud/monitoring-api steps: - name: Checkout @@ -28,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 @@ -48,7 +42,7 @@ jobs: with: flavor: | latest=true - images: cranecloud/monitoring-api + images: ${{ env.image }} tags: | type=ref,event=branch type=ref,event=pr diff --git a/helm/values.prod.yaml b/helm/values.prod.yaml index 67a62c7..e3314d5 100644 --- a/helm/values.prod.yaml +++ b/helm/values.prod.yaml @@ -37,4 +37,6 @@ celery: create: false redis: - create: false \ No newline at end of file + create: true +mongo: + create: true \ No newline at end of file From 1e2dd299e488215411ea426a6f02c0b4b4307f5d Mon Sep 17 00:00:00 2001 From: Mubangizi Allan Date: Thu, 11 Jun 2026 16:03:52 +0300 Subject: [PATCH 4/6] change ref branch --- .github/workflows/prod.yml | 3 ++- helm/values.prod.yaml | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/prod.yml b/.github/workflows/prod.yml index b70466b..c6f57a5 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 diff --git a/helm/values.prod.yaml b/helm/values.prod.yaml index e3314d5..67a62c7 100644 --- a/helm/values.prod.yaml +++ b/helm/values.prod.yaml @@ -37,6 +37,4 @@ celery: create: false redis: - create: true -mongo: - create: true \ No newline at end of file + create: false \ No newline at end of file From 618955fba82807face26aba583031ecba1519f2b Mon Sep 17 00:00:00 2001 From: Mubangizi Allan Date: Thu, 11 Jun 2026 16:29:06 +0300 Subject: [PATCH 5/6] improve version references --- .github/workflows/prod.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/prod.yml b/.github/workflows/prod.yml index c6f57a5..154e96d 100644 --- a/.github/workflows/prod.yml +++ b/.github/workflows/prod.yml @@ -47,8 +47,8 @@ jobs: tags: | type=ref,event=branch type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} + 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 @@ -68,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 e51b5e28577b8843e327e0ad7441e35536045f08 Mon Sep 17 00:00:00 2001 From: Mubangizi Allan Date: Thu, 11 Jun 2026 16:32:39 +0300 Subject: [PATCH 6/6] remove test data --- .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 154e96d..9ac8cfa 100644 --- a/.github/workflows/prod.yml +++ b/.github/workflows/prod.yml @@ -7,10 +7,6 @@ on: - released - prereleased - push: - branches: - - ch-update-host-server - jobs: build: outputs: @@ -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