mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-20 06:45:50 +00:00
change ci style
This commit is contained in:
parent
633dfb981c
commit
58d587f902
3 changed files with 23 additions and 7 deletions
16
.github/workflows/ci.yml
vendored
16
.github/workflows/ci.yml
vendored
|
@ -9,10 +9,16 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Setup GCP authentication
|
- name: Setup Terraform
|
||||||
run: echo "${{ secrets.GCP_JSON }}" | base64 -d > output_file.txt
|
uses: hashicorp/setup-terraform@v3
|
||||||
- run: export GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/output_file.txt
|
with:
|
||||||
- name: Initiate Terraform
|
terraform_version: 1.9.8
|
||||||
|
project_id: ${{ secrets.PROJECT_ID }}
|
||||||
|
- name: Validate Terraform Configuration
|
||||||
run: terraform -chdir=terraform init
|
run: terraform -chdir=terraform init
|
||||||
|
env:
|
||||||
|
GOOGLE_CREDENTIALS: ${{ secrets.GCP_JSON }}
|
||||||
- name: Dry run Terraform
|
- name: Dry run Terraform
|
||||||
run: terraform -chdir=terraform plan -var-file=terraform/variables.tfvars
|
run: terraform -chdir=terraform plan -var-file=terraform/variables.tfvars
|
||||||
|
env:
|
||||||
|
GOOGLE_CREDENTIALS: ${{ secrets.GCP_JSON }}
|
|
@ -3,6 +3,8 @@ provider "google" {
|
||||||
region = var.region
|
region = var.region
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data "google_compute_default_service_account" "default" {}
|
||||||
|
|
||||||
data "google_compute_network" "default" {
|
data "google_compute_network" "default" {
|
||||||
name = "default"
|
name = "default"
|
||||||
}
|
}
|
||||||
|
@ -28,6 +30,11 @@ resource "google_compute_instance" "petclinic" {
|
||||||
}
|
}
|
||||||
|
|
||||||
metadata_startup_script = "${file("startup-script.sh")}"
|
metadata_startup_script = "${file("startup-script.sh")}"
|
||||||
|
|
||||||
|
service_account {
|
||||||
|
email = data.google_compute_default_service_account.default.email
|
||||||
|
scopes = ["cloud-platform"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "google_sql_database_instance" "petclinic" {
|
resource "google_sql_database_instance" "petclinic" {
|
||||||
|
@ -48,7 +55,7 @@ resource "google_sql_database_instance" "petclinic" {
|
||||||
resource "google_sql_user" "users" {
|
resource "google_sql_user" "users" {
|
||||||
name = var.app
|
name = var.app
|
||||||
instance = google_sql_database_instance.petclinic.name
|
instance = google_sql_database_instance.petclinic.name
|
||||||
password = POSTGRES_PASSWORD
|
password = "changeme"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "google_sql_database" "database" {
|
resource "google_sql_database" "database" {
|
||||||
|
|
|
@ -12,4 +12,7 @@ sudo apt-get update
|
||||||
|
|
||||||
sudo apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
sudo apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||||
|
|
||||||
grep -qxF "petclinic.local" /etc/hosts || echo "127.0.0.1 petclinic.local" >> /etc/hosts
|
grep -qxF "petclinic.local" /etc/hosts || echo "127.0.0.1 petclinic.local" >> /etc/hosts
|
||||||
|
|
||||||
|
curl -sSO https://dl.google.com/cloudagents/add-google-cloud-ops-agent-repo.sh
|
||||||
|
sudo bash add-google-cloud-ops-agent-repo.sh --also-install
|
Loading…
Reference in a new issue