From e6ea204dcfe8fab6f44d37602dce971d8c40d700 Mon Sep 17 00:00:00 2001 From: Neill Turner Date: Fri, 20 Dec 2024 12:41:25 +0000 Subject: [PATCH] Migrate gcp wif --- .github/actions/deploy-environment/action.yml | 2 +- .github/workflows/delete_review_app.yml | 2 +- config/initializers/dfe_analytics.rb | 57 +++---------------- .../application/config/review.tfvars.json | 2 +- 4 files changed, 10 insertions(+), 53 deletions(-) diff --git a/.github/actions/deploy-environment/action.yml b/.github/actions/deploy-environment/action.yml index 7bed298e7..2803f4f98 100644 --- a/.github/actions/deploy-environment/action.yml +++ b/.github/actions/deploy-environment/action.yml @@ -41,7 +41,7 @@ runs: - uses: google-github-actions/auth@v2 with: project_id: claim-additional-payments - workload_identity_provider: projects/638192024625/locations/global/workloadIdentityPools/claim-additional-payments/providers/claim-additional-payments + workload_identity_provider: projects/638192024625/locations/global/workloadIdentityPools/claim-additional-payments-for-te/providers/claim-additional-payments-for-te - name: Terraform Apply shell: bash diff --git a/.github/workflows/delete_review_app.yml b/.github/workflows/delete_review_app.yml index 6b2f1554e..e282dfdc9 100644 --- a/.github/workflows/delete_review_app.yml +++ b/.github/workflows/delete_review_app.yml @@ -40,7 +40,7 @@ jobs: - uses: google-github-actions/auth@v2 with: project_id: claim-additional-payments - workload_identity_provider: projects/638192024625/locations/global/workloadIdentityPools/claim-additional-payments/providers/claim-additional-payments + workload_identity_provider: projects/638192024625/locations/global/workloadIdentityPools/claim-additional-payments-for-te/providers/claim-additional-payments-for-te - name: Terraform destroy run: | diff --git a/config/initializers/dfe_analytics.rb b/config/initializers/dfe_analytics.rb index 161b720cf..66c536e77 100644 --- a/config/initializers/dfe_analytics.rb +++ b/config/initializers/dfe_analytics.rb @@ -1,55 +1,12 @@ DfE::Analytics.configure do |config| - # Whether to log events instead of sending them to BigQuery. - # - # config.log_only = true - config.log_only = (%w[development test].include?(ENV["RAILS_ENV"]) || ENV["ENVIRONMENT_NAME"].start_with?("review")) - - # Whether to use ActiveJob or dispatch events immediately. - # - # config.async = true - - # Which ActiveJob queue to put events on - # - # config.queue = :default - - # The name of the BigQuery table we’re writing to. - # - # config.bigquery_table_name = ENV['BIGQUERY_TABLE_NAME'] - - # The name of the BigQuery project we’re writing to. - # - # config.bigquery_project_id = ENV['BIGQUERY_PROJECT_ID'] - - # The name of the BigQuery dataset we're writing to. - # - # config.bigquery_dataset = ENV['BIGQUERY_DATASET'] - - # Service account JSON key for the BigQuery API. See - # https://cloud.google.com/bigquery/docs/authentication/service-account-file - # - # config.bigquery_api_json_key = ENV['BIGQUERY_API_JSON_KEY'] - - # Passed directly to the retries: option on the BigQuery client - # - # config.bigquery_retries = 3 - - # Passed directly to the timeout: option on the BigQuery client - # - # config.bigquery_timeout = 120 - - # A proc which returns true or false depending on whether you want to - # enable analytics. You might want to hook this up to a feature flag or - # environment variable. - # - config.enable_analytics = proc { Rails.env.production? } - - # Enable entity table check job - # + config.queue = :analytics + config.environment = HostingEnvironment.environment_name config.entity_table_checks_enabled = true - # The environment we’re running in. This value will be attached - # to all events we send to BigQuery. - # - # config.environment = ENV.fetch('RAILS_ENV', 'development') + config.enable_analytics = + proc do + disabled_by_default = Rails.env.development? + ENV.fetch("BIGQUERY_DISABLE", disabled_by_default.to_s) != "true" + end config.azure_federated_auth = ENV.include? "GOOGLE_CLOUD_CREDENTIALS" end diff --git a/terraform/application/config/review.tfvars.json b/terraform/application/config/review.tfvars.json index 8014e8f28..46bb55b4a 100644 --- a/terraform/application/config/review.tfvars.json +++ b/terraform/application/config/review.tfvars.json @@ -7,6 +7,6 @@ "startup_command": ["/bin/sh", "-c", "bin/rails server -b 0.0.0.0"], "worker_command": ["/bin/sh", "-c", "bin/bundle exec bin/delayed_job run -n 1"], "enable_logit": true, - "dataset_name": "claim_events_dev", + "dataset_name": "claim_events_test", "enable_dfe_analytics_federated_auth": true }