Skip to content

Commit

Permalink
Set service account for VM from config
Browse files Browse the repository at this point in the history
  • Loading branch information
var77 committed Apr 26, 2024
1 parent 5c44d66 commit 49d8171
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,12 @@ def self.e2e_test?
# Lantern
override :lantern_top_domain, "db.lantern.dev", string
override :lantern_dns_email, "varik@lantern.dev", string
override :lantern_backup_bucket, "lantern-wal-g-backups-dev"
override :lantern_backup_bucket, "walg-dev-backups"
override :e2e_test, "0"

# GCP
override :gcp_project_id, "ringed-griffin-394922", string
override :gcp_project_id, "lantern-development", string
override :gcp_compute_service_account, "339254316100-compute@developer.gserviceaccount.com", string
optional :gcp_creds_gcr_b64, string
optional :gcp_creds_logging_b64, string
optional :gcp_creds_coredumps_b64, string
Expand Down
5 changes: 3 additions & 2 deletions lib/hosting/gcp_apis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def create_vm(name, zone, image, ssh_key, user, machine_type, disk_size_gb, labe
},
serviceAccounts: [
{
email: "511682212298-compute@developer.gserviceaccount.com",
email: Config.gcp_compute_service_account,
scopes: [
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/logging.write",
Expand All @@ -129,7 +129,8 @@ def create_vm(name, zone, image, ssh_key, user, machine_type, disk_size_gb, labe

def get_vm(vm_name, zone)
connection = Excon.new(@host[:connection_string], headers: @host[:headers])
response = connection.get(path: "/compute/v1/projects/#{@project}/zones/#{zone}/instances/#{vm_name}", expects: 200)
response = connection.get(path: "/compute/v1/projects/#{@project}/zones/#{zone}/instances/#{vm_name}", expects: [200, 400, 404])
Hosting::GcpApis.check_errors(response)

JSON.parse(response.body)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/model/lantern/lantern_timeline_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
expect(lantern_timeline).to receive(:gcp_creds_b64).and_return("test-creds")
config = {
gcp_creds_b64: "test-creds",
walg_gs_prefix: "gs://lantern-wal-g-backups-dev/pvr1mcnhzd8p0qwwa00tr5cvex"
walg_gs_prefix: "gs://walg-dev-backups/pvr1mcnhzd8p0qwwa00tr5cvex"
}

expect(lantern_timeline.generate_walg_config).to eq(config)
Expand Down

0 comments on commit 49d8171

Please sign in to comment.