diff --git a/.github/workflows/rsp-demo-alertdb-tf.yaml b/.github/workflows/rsp-demo-alertdb-tf.yaml new file mode 100644 index 00000000..4b0deac8 --- /dev/null +++ b/.github/workflows/rsp-demo-alertdb-tf.yaml @@ -0,0 +1,65 @@ +# Deploys Science Platform Demo GCP Project with Terraform +name: 'RSP DEMO ALERTDB' + +on: + pull_request: + paths: + - 'environment/deployments/science-platform/env/demo-alertdb.tfvars' + push: + branches: + - main + paths: + - 'environment/deployments/science-platform/env/demo-alertdb.tfvars' + +jobs: + terraform: + name: 'Terraform' + runs-on: ubuntu-latest + + # Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest + defaults: + run: + shell: bash + working-directory: ./environment/deployments/science-platform/alertdb + + # Checkout the repository to the GitHub Actions runner + steps: + - name: Checkout + uses: actions/checkout@v3 + + # gcloud setup + - name: GCP login + uses: google-github-actions/setup-gcloud@v0 + with: + version: '379.0.0' + service_account_key: ${{ secrets.GOOGLE_CREDENTIALS }} + project_id: ${{ secrets.GCP_PROJECT_ID }} + export_default_credentials: true + + # Installs terraform + - name: Setup Terraform + uses: hashicorp/setup-terraform@v1 + with: + terraform_version: 0.13.5 + + # Checks for proper formatting for terraform + - name: Terraform Fmt + run: terraform fmt + + # Initialize a new or existing terraform working directory by creating initial files, loading any remote state, downloading modules, etc. + - name: Terraform Init + run: terraform init -backend-config=bucket=${{ secrets.TERRAFORM_STATE_BUCKET }} -backend-config=prefix=science-platform/demo/alertdb + + # Checks that all terraform configuration files adhere to a canonical format + - name: Terraform Validate + run: terraform validate + + # Generates an execution plan for terraform + - name: Terraform Plan + id: plan + run: terraform plan -var-file=../env/demo-alertdb.tfvars -no-color + + # On push to main, build or change infrastructure according to Terraform configuration files + - name: Terraform Apply + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + run: terraform apply -var-file=../env/demo-alertdb.tfvars -auto-approve diff --git a/.github/workflows/rsp-demo-cloudsql-tf.yaml b/.github/workflows/rsp-demo-cloudsql-tf.yaml new file mode 100644 index 00000000..f69d526a --- /dev/null +++ b/.github/workflows/rsp-demo-cloudsql-tf.yaml @@ -0,0 +1,65 @@ +# Deploys Science Platform Demo GCP Project with Terraform +name: 'RSP DEMO CLOUD SQL' + +on: + pull_request: + paths: + - 'environment/deployments/science-platform/env/demo-cloudsql.tfvars' + push: + branches: + - main + paths: + - 'environment/deployments/science-platform/env/demo-cloudsql.tfvars' + +jobs: + terraform: + name: 'Terraform' + runs-on: ubuntu-latest + + # Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest + defaults: + run: + shell: bash + working-directory: ./environment/deployments/science-platform/cloudsql + + # Checkout the repository to the GitHub Actions runner + steps: + - name: Checkout + uses: actions/checkout@v3 + + # gcloud setup + - name: GCP login + uses: google-github-actions/setup-gcloud@v0 + with: + version: '379.0.0' + service_account_key: ${{ secrets.GOOGLE_CREDENTIALS }} + project_id: ${{ secrets.GCP_PROJECT_ID }} + export_default_credentials: true + + # Installs terraform + - name: Setup Terraform + uses: hashicorp/setup-terraform@v1 + with: + terraform_version: 0.13.5 + + # Checks for proper formatting for terraform + - name: Terraform Fmt + run: terraform fmt + + # Initialize a new or existing terraform working directory by creating initial files, loading any remote state, downloading modules, etc. + - name: Terraform Init + run: terraform init -backend-config=bucket=${{ secrets.TERRAFORM_STATE_BUCKET }} -backend-config=prefix=science-platform/demo/cloudsql + + # Checks that all terraform configuration files adhere to a canonical format + - name: Terraform Validate + run: terraform validate + + # Generates an execution plan for terraform + - name: Terraform Plan + id: plan + run: terraform plan -var-file=../env/demo-cloudsql.tfvars -no-color + + # On push to main, build or change infrastructure according to Terraform configuration files + - name: Terraform Apply + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + run: terraform apply -var-file=../env/demo-cloudsql.tfvars -auto-approve diff --git a/.github/workflows/rsp-demo-firestore-proj-tf.yaml b/.github/workflows/rsp-demo-firestore-proj-tf.yaml new file mode 100644 index 00000000..c84971ac --- /dev/null +++ b/.github/workflows/rsp-demo-firestore-proj-tf.yaml @@ -0,0 +1,65 @@ +# Deploys Science Platform Integration GCP Project with Terraform +name: 'RSP DEMO FIRESTORE GCP Project' + +on: + pull_request: + paths: + - 'environment/deployments/science-platform/firestore/env/demo.tfvars' + push: + paths: + - 'environment/deployments/science-platform/firestore/env/demo.tfvars' + branches: + - main + +jobs: + terraform: + name: 'Terraform' + runs-on: ubuntu-latest + + # Sets default shell and working directory + defaults: + run: + shell: bash + working-directory: ./environment/deployments/science-platform/firestore + + # Checkout the repository to the GitHub Actions runner + steps: + - name: Checkout + uses: actions/checkout@v3 + + # Gcloud CLI setup + - name: GCP login + uses: google-github-actions/setup-gcloud@v0 + with: + version: '379.0.0' + service_account_key: ${{ secrets.GOOGLE_CREDENTIALS }} + project_id: ${{ secrets.GCP_PROJECT_ID }} + export_default_credentials: true + + # Install terraform + - name: Setup Terraform + uses: hashicorp/setup-terraform@v1 + with: + terraform_version: 0.13.5 + + # Checks for proper terraform code formatting + - name: Terraform Fmt + run: terraform fmt + + # Initialize a new or existing terraform working directory by creating initial files, loading any remote state, downloading modules, etc. + - name: Terraform Init + run: terraform init -backend-config=bucket=${{ secrets.TERRAFORM_STATE_BUCKET }} -backend-config=prefix=science-platform/firestore/demo + + # Checks that all terraform configuration files adhere to a canonical format + - name: Terraform Validate + run: terraform validate + + # Generates Terraform execution plan + - name: Terraform Plan + id: plan + run: terraform plan -var-file=env/demo.tfvars -no-color + + # On push to main, build or change infrastructure according to terraform configuration files + - name: Terraform Apply + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + run: terraform apply -var-file=env/demo.tfvars -auto-approve diff --git a/.github/workflows/rsp-demo-gke-tf.yaml b/.github/workflows/rsp-demo-gke-tf.yaml new file mode 100644 index 00000000..ac33bef0 --- /dev/null +++ b/.github/workflows/rsp-demo-gke-tf.yaml @@ -0,0 +1,65 @@ +# Deploys Science Platform Demo GCP Project with Terraform +name: 'RSP DEMO GKE' + +on: + pull_request: + paths: + - 'environment/deployments/science-platform/env/demo-gke.tfvars' + push: + branches: + - main + paths: + - 'environment/deployments/science-platform/env/demo-gke.tfvars' + +jobs: + terraform: + name: 'Terraform' + runs-on: ubuntu-latest + + # Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest + defaults: + run: + shell: bash + working-directory: ./environment/deployments/science-platform/gke + + # Checkout the repository to the GitHub Actions runner + steps: + - name: Checkout + uses: actions/checkout@v3 + + # gcloud setup + - name: GCP login + uses: google-github-actions/setup-gcloud@v0 + with: + version: '379.0.0' + service_account_key: ${{ secrets.PIPELINE_RSP_DEMO_GKE }} + project_id: ${{ secrets.GCP_PROJECT_ID }} + export_default_credentials: true + + # Installs terraform + - name: Setup Terraform + uses: hashicorp/setup-terraform@v1 + with: + terraform_version: 0.12.29 + + # Checks for proper formatting for terraform + - name: Terraform Fmt + run: terraform fmt + + # Initialize a new or existing terraform working directory by creating initial files, loading any remote state, downloading modules, etc. + - name: Terraform Init + run: terraform init -backend-config=bucket=${{ secrets.TERRAFORM_STATE_BUCKET }} -backend-config=prefix=science-platform/demo/gke + + # Checks that all terraform configuration files adhere to a canonical format + - name: Terraform Validate + run: terraform validate + + # Generates an execution plan for terraform + - name: Terraform Plan + id: plan + run: terraform plan -var-file=../env/demo-gke.tfvars -no-color + + # On push to main, build or change infrastructure according to Terraform configuration files + - name: Terraform Apply + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + run: terraform apply -var-file=../env/demo-gke.tfvars -auto-approve \ No newline at end of file diff --git a/.github/workflows/rsp-demo-proj-tf.yaml b/.github/workflows/rsp-demo-proj-tf.yaml new file mode 100644 index 00000000..35bddff8 --- /dev/null +++ b/.github/workflows/rsp-demo-proj-tf.yaml @@ -0,0 +1,65 @@ +# Deploys Science Platform Demo GCP Project with Terraform +name: 'RSP Demo GCP Project' + +on: + pull_request: + paths: + - 'environment/deployments/science-platform/env/demo.tfvars' + push: + paths: + - 'environment/deployments/science-platform/env/demo.tfvars' + branches: + - main + +jobs: + terraform: + name: 'Terraform' + runs-on: ubuntu-latest + + # Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest + defaults: + run: + shell: bash + working-directory: ./environment/deployments/science-platform + + # Checkout the repository to the GitHub Actions runner + steps: + - name: Checkout + uses: actions/checkout@v3 + + # gcloud CLI setup + - name: GCP login + uses: google-github-actions/setup-gcloud@v0 + with: + version: '379.0.0' + service_account_key: ${{ secrets.PIPELINE_RSP_DEMO_PROJECT }} + project_id: ${{ secrets.GCP_PROJECT_ID }} + export_default_credentials: true + + # Installs terraform + - name: Setup Terraform + uses: hashicorp/setup-terraform@v1 + with: + terraform_version: 0.13.5 + + # Checks for proper formatting in terraform code + - name: Terraform Fmt + run: terraform fmt + + # Initialize a new or existing terraform working directory by creating initial files, loading any remote state, downloading modules, etc. + - name: Terraform Init + run: terraform init -backend-config=bucket=${{ secrets.TERRAFORM_STATE_BUCKET }} -backend-config=prefix=science-platform/demo + + # Checks that all terraform configuration files adhere to a canonical format + - name: Terraform Validate + run: terraform validate + + # Generates an execution plan for terraform + - name: Terraform Plan + id: plan + run: terraform plan -var-file=env/demo.tfvars -no-color + + # On push to main, build or change infrastructure according to terraform configuration files + - name: Terraform Apply + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + run: terraform apply -var-file=env/demo.tfvars -auto-approve