File tree Expand file tree Collapse file tree 5 files changed +32
-5
lines changed Expand file tree Collapse file tree 5 files changed +32
-5
lines changed Original file line number Diff line number Diff line change @@ -32,10 +32,11 @@ module "osv_test" {
3232 backups_bucket_retention_days = 5
3333 affected_commits_backups_bucket = " osv-test-affected-commits"
3434 affected_commits_backups_bucket_retention_days = 2
35+ gcs_log_dir = " gs://oss-vdb-tf/apply-logs"
3536
3637 website_domain = " test.osv.dev"
3738 api_url = " api.test.osv.dev"
38- esp_version = " 2.51 .0"
39+ esp_version = " 2.53 .0"
3940}
4041
4142module "k8s_cron_alert" {
Original file line number Diff line number Diff line change @@ -32,10 +32,11 @@ module "osv" {
3232 backups_bucket_retention_days = 60
3333 affected_commits_backups_bucket = " osv-affected-commits"
3434 affected_commits_backups_bucket_retention_days = 3
35+ gcs_log_dir = " gs://oss-vdb-tf/apply-logs"
3536
3637 website_domain = " osv.dev"
3738 api_url = " api.osv.dev"
38- esp_version = " 2.51 .0"
39+ esp_version = " 2.53 .0"
3940}
4041
4142module "k8s_cron_alert" {
Original file line number Diff line number Diff line change @@ -91,3 +91,15 @@ resource "google_project_service" "cloud_build" {
9191 service = " cloudbuild.googleapis.com"
9292 disable_on_destroy = false
9393}
94+
95+ resource "google_project_service" "cloud_firestore" {
96+ project = var. project_id
97+ service = " firestore.googleapis.com"
98+ disable_on_destroy = false
99+ }
100+
101+ resource "google_project_service" "certificate_manager" {
102+ project = var. project_id
103+ service = " certificatemanager.googleapis.com"
104+ disable_on_destroy = false
105+ }
Original file line number Diff line number Diff line change @@ -59,6 +59,12 @@ variable "_api_descriptor_file" {
5959 default = " api/api_descriptor.pb"
6060}
6161
62+ variable "gcs_log_dir" {
63+ type = string
64+ description = " GCS directory to store cloud build logs."
65+ default = " "
66+ }
67+
6268resource "google_endpoints_service" "grpc_service" {
6369 project = var. project_id
6470 service_name = var. api_url
@@ -97,7 +103,8 @@ resource "null_resource" "grpc_proxy_image" {
97103 -s ${ var . api_url } \
98104 -c ${ google_endpoints_service . grpc_service . config_id } \
99105 -p ${ var . project_id } \
100- -v ${ var . esp_version }
106+ -v ${ var . esp_version } \
107+ ${ var . gcs_log_dir != " " ? format (" -l %s" , var. gcs_log_dir ) : " " }
101108 EOS
102109 }
103110}
Original file line number Diff line number Diff line change @@ -38,7 +38,8 @@ function error_exit() {
3838# IMAGE_REPOSITORY as following:
3939# 'LOCATION-docker.pkg.dev/PROJECT-ID/REPOSITORY'
4040
41- while getopts :c:s:p:v:z:g:i: arg; do
41+ GCS_LOG_DIR=" "
42+ while getopts :c:s:p:v:z:g:i:l: arg; do
4243 case ${arg} in
4344 c) CONFIG_ID=" ${OPTARG} " ;;
4445 s) SERVICE=" ${OPTARG} " ;;
@@ -50,6 +51,7 @@ while getopts :c:s:p:v:z:g:i: arg; do
5051 BASE_IMAGE=" ${OPTARG} "
5152 ESP_FULL_VERSION=" custom"
5253 ;;
54+ l) GCS_LOG_DIR=" ${OPTARG} " ;;
5355 \? ) error_exit " Unrecognized argument -${OPTARG} " ;;
5456 esac
5557done
@@ -122,7 +124,11 @@ ENTRYPOINT ["/env_start_proxy.py"]
122124EOF
123125
124126NEW_IMAGE=" ${IMAGE_REPOSITORY} /endpoints-runtime-serverless:${ESP_FULL_VERSION} -${SERVICE} -${CONFIG_ID} "
125- gcloud builds submit --tag " ${NEW_IMAGE} " . --project=" ${PROJECT} "
127+ GCLOUD_BUILD_ARGS=(" --tag" " ${NEW_IMAGE} " " ." " --project=${PROJECT} " )
128+ if [[ -n " ${GCS_LOG_DIR} " ]]; then
129+ GCLOUD_BUILD_ARGS+=(" --gcs-log-dir=${GCS_LOG_DIR} " )
130+ fi
131+ gcloud builds submit " ${GCLOUD_BUILD_ARGS[@]} "
126132)
127133
128134# Delete the temporary directory we created earlier.
You can’t perform that action at this time.
0 commit comments