From 105e07c9c0be22bcf64a4070b1360e36ba3be673 Mon Sep 17 00:00:00 2001 From: Ege Kocabas <48245934+egekocabas@users.noreply.github.com> Date: Tue, 12 Dec 2023 16:26:24 +0100 Subject: [PATCH] build: Add Analytics Base Url to CD and terraform (#14) --- .github/workflows/deploy.yml | 1 + Dockerfile | 2 ++ terraform/module/service.tf | 4 ++++ terraform/module/variables.tf | 5 +++++ terraform/prod/main.tf | 11 ++++++----- terraform/prod/variables.tf | 5 +++++ terraform/staging/main.tf | 11 ++++++----- terraform/staging/variables.tf | 5 +++++ 8 files changed, 34 insertions(+), 10 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e89ab68..b412887 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -17,6 +17,7 @@ defaults: env: TF_VAR_GITHUB_TOKEN: ${{ secrets.MINING_GITHUB_TOKEN }} TF_VAR_FIREBASE_ADMINSDK_CERTIFICATE: ${{ github.event_name == 'release' && secrets.PROD_FIREBASE_ADMINSDK_CERTIFICATE || secrets.STAGING_FIREBASE_ADMINSDK_CERTIFICATE}} + TF_VAR_ANALYTICS_BASE_URL: ${{ github.event_name == 'release' && vars.PROD_ANALYTICS_BASE_URL || vars.STAGING_ANALYTICS_BASE_URL}} jobs: deploy: diff --git a/Dockerfile b/Dockerfile index 9ca98d0..b8ed7ae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,8 @@ COPY --chown=$MAMBA_USER:$MAMBA_USER parma_mining /app/parma_mining ENV GITHUB_TOKEN=$GITHUB_TOKEN ENV "FIREBASE_ADMINSDK_CERTIFICATE"=$FIREBASE_ADMINSDK_CERTIFICATE +ENV ANALYTICS_BASE_URL=$ANALYTICS_BASE_URL + EXPOSE 8080 diff --git a/terraform/module/service.tf b/terraform/module/service.tf index a6fd08b..7888db1 100644 --- a/terraform/module/service.tf +++ b/terraform/module/service.tf @@ -43,6 +43,10 @@ resource "google_cloud_run_service" "parma_mining_github_cloud_run" { name = "FIREBASE_ADMINSDK_CERTIFICATE" value = var.FIREBASE_ADMINSDK_CERTIFICATE } + env { + name = "ANALYTICS_BASE_URL" + value = var.ANALYTICS_BASE_URL + } } } } diff --git a/terraform/module/variables.tf b/terraform/module/variables.tf index 87b95f1..28056db 100644 --- a/terraform/module/variables.tf +++ b/terraform/module/variables.tf @@ -24,3 +24,8 @@ variable "FIREBASE_ADMINSDK_CERTIFICATE" { type = string sensitive = true } + +variable "ANALYTICS_BASE_URL" { + description = "value" + type = string +} diff --git a/terraform/prod/main.tf b/terraform/prod/main.tf index f16ef27..9eaba70 100644 --- a/terraform/prod/main.tf +++ b/terraform/prod/main.tf @@ -29,10 +29,11 @@ provider "google" { } module "main" { - source = "../module" - env = "prod" - project = local.project - region = local.region - GITHUB_TOKEN = var.GITHUB_TOKEN + source = "../module" + env = "prod" + project = local.project + region = local.region + GITHUB_TOKEN = var.GITHUB_TOKEN FIREBASE_ADMINSDK_CERTIFICATE = var.FIREBASE_ADMINSDK_CERTIFICATE + ANALYTICS_BASE_URL = var.ANALYTICS_BASE_URL } diff --git a/terraform/prod/variables.tf b/terraform/prod/variables.tf index e21fd5b..5d5cf32 100644 --- a/terraform/prod/variables.tf +++ b/terraform/prod/variables.tf @@ -9,3 +9,8 @@ variable "FIREBASE_ADMINSDK_CERTIFICATE" { type = string sensitive = true } + +variable "ANALYTICS_BASE_URL" { + description = "value" + type = string +} diff --git a/terraform/staging/main.tf b/terraform/staging/main.tf index eedc4eb..606207a 100644 --- a/terraform/staging/main.tf +++ b/terraform/staging/main.tf @@ -29,10 +29,11 @@ provider "google" { } module "main" { - source = "../module" - env = "staging" - project = local.project - region = local.region - GITHUB_TOKEN = var.GITHUB_TOKEN + source = "../module" + env = "staging" + project = local.project + region = local.region + GITHUB_TOKEN = var.GITHUB_TOKEN FIREBASE_ADMINSDK_CERTIFICATE = var.FIREBASE_ADMINSDK_CERTIFICATE + ANALYTICS_BASE_URL = var.ANALYTICS_BASE_URL } diff --git a/terraform/staging/variables.tf b/terraform/staging/variables.tf index e21fd5b..5d5cf32 100644 --- a/terraform/staging/variables.tf +++ b/terraform/staging/variables.tf @@ -9,3 +9,8 @@ variable "FIREBASE_ADMINSDK_CERTIFICATE" { type = string sensitive = true } + +variable "ANALYTICS_BASE_URL" { + description = "value" + type = string +}