Skip to content

Add presubmit test for single-instance deployment on GCP #290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions presubmit_tests/single-instance-on-gcp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apk add --no-cache zip

gcs_bucket="gs://oracle-toolkit-presubmit-artifacts"

# Append PROW_JOB_ID to the file name to ensure each presubmit test gets a unique copy.
# This prevents one test from deleting the file while it's still in use by another concurrently running test.
# For all Prow-injected environment variables, see:
# https://docs.prow.k8s.io/docs/jobs/#job-environment-variables
toolkit_zip_file_name="oracle-toolkit-${PROW_JOB_ID}.zip"
zip -r /tmp/${toolkit_zip_file_name} . -x ".git*" -x ".terraform*" -x "terraform*" -x OWNERS > /dev/null
gcloud storage cp /tmp/${toolkit_zip_file_name} "${gcs_bucket}/"

cd terraform

vm_name="github-presubmit-single-instance-${PROW_JOB_ID}"
deployment_name="${vm_name}"

gcloud infra-manager deployments apply projects/gcp-oracle-benchmarks/locations/us-central1/deployments/"${deployment_name}" \
--service-account projects/gcp-oracle-benchmarks/serviceAccounts/infra-manager-deployer@gcp-oracle-benchmarks.iam.gserviceaccount.com \
--local-source="." \
--input-values="deployment_name=${deployment_name}" \
--input-values="gcs_source=${gcs_bucket}/${toolkit_zip_file_name}" \
--input-values="instance_name=${vm_name}"


# 1. Wait for the control-node's startup script to complete
# 2. verify Ansible_log contains "state=ansible_completed_success"
# 3. delete the deployment
# 4. delete "gs://oracle-toolkit-presubmit-artifacts/${toolkit_zip_file_name}" to prevent the GCS bucket from growing indefinitely
53 changes: 53 additions & 0 deletions presubmit_tests/single-instance.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# See variables.tf for a full list, and descriptions.

gcs_source = "gs://oracle-toolkit-presubmit-artifacts/oracle-toolkit.zip" # gets overridden by "gcloud infra-manager deployments apply ... --input-values"
ora_swlib_bucket = "gs://bmaas-testing-oracle-software"
project_id = "gcp-oracle-benchmarks"
vm_service_account = "[email protected]"
control_node_service_account = "[email protected]"
install_workload_agent = true
oracle_metrics_secret = "projects/gcp-oracle-benchmarks/secrets/workload-agent-user-password/versions/latest"
db_password_secret = "projects/gcp-oracle-benchmarks/secrets/sys-user-password/versions/latest"
instance_name = "github-presubmit-1" # gets overridden by "gcloud infra-manager deployments apply ... --input-values"
source_image_family = "oracle-linux-8"
source_image_project = "oracle-linux-cloud"
machine_type = "n4-standard-2"
boot_disk_type = "hyperdisk-balanced"
boot_disk_size_gb = "50"
swap_disk_size_gb = "50"
deployment_name = "github-presubmit-single-instance"
zone1 = "us-central1-b"
subnetwork1 = "projects/gcp-oracle-benchmarks/regions/us-central1/subnetworks/default"
oracle_home_disk = {
size_gb = 50
}
data_disk = {
size_gb = 50
}
reco_disk = {
size_gb = 50
}
ora_version = "19"
ora_release = "latest"
ora_edition = "EE"
ora_backup_dest = "+RECO"
ora_db_name = "orcl"
ora_db_container = false
ntp_pref = "169.254.169.254"
ora_listener_port = "1521"
ora_redo_log_size = "100MB"
skip_database_config = false