diff --git a/README.md b/README.md index 0458953d8..5691ab188 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # 📈 📊 👣 🪵 Cloud Operations Sandbox -![Terraform][tf_badge] +![Terraform][tf_badge] ![sandboxctl][cli_badge] Cloud Operations (Ops) Sandbox is an end-to-end demo that helps practitioners to learn about [Cloud Operations][cloud-ops] (formerly Stackdriver) and Service @@ -72,7 +72,7 @@ Read more about Cloud Ops Sandbox and how to use it in the [documentation](docs/ The following functionality has been changed in the recent versions of Cloud Ops Sandbox: -### Version 0.9.0 +### Version 0.9.1 * Rating service is not a part of the demo application. It has the following effects: * Launch does not provision AppEngine services and CloudSQL DB. @@ -110,8 +110,9 @@ under Apache 2.0. Full license text is available in [LICENSE](LICENSE). > **Note** > This is not an official Google project. Please, report any issues or feature requests related to this project [here]. -[1]: https://console.cloud.google.com/?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fgooglecloudplatform%2Fcloud-ops-sandbox&cloudshell_git_repo=0.9.0&cloudshell_tutorial=docs/walkthrough.md -[tf_badge]: https://github.com/GoogleCloudPlatform/cloud-ops-sandbox/workflows/Terraform/badge.svg +[1]: https://console.cloud.google.com/?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fgooglecloudplatform%2Fcloud-ops-sandbox&cloudshell_git_branch=0.9.1&cloudshell_tutorial=docs/walkthrough.md +[tf_badge]: https://github.com/GoogleCloudPlatform/cloud-ops-sandbox/actions/workflows/terraform.yaml/badge.svg +[cli_badge]: https://github.com/GoogleCloudPlatform/cloud-ops-sandbox/actions/workflows/cli.yaml/badge.svg [cloud-ops]: (https://cloud.google.com/products/operations) [ob]: https://github.com/GoogleCloudPlatform/microservices-demo [gke]: https://cloud.google.com/kubernetes-engine diff --git a/docs/README.md b/docs/README.md index 3dc1e747a..1870f7b0e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -147,7 +147,7 @@ GKE cluster is the core part of the bill. You can see [estimate] costs with pricing [calculator]. [1]: https://cloud.google.com/resource-manager/docs/creating-managing-projects#console_1 -[2]: https://console.cloud.google.com/?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fgooglecloudplatform%2Fcloud-ops-sandbox&cloudshell_git_repo=0.9.0&cloudshell_tutorial=docs/walkthrough.md +[2]: https://console.cloud.google.com/?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fgooglecloudplatform%2Fcloud-ops-sandbox&cloudshell_git_branch=0.9.1&cloudshell_tutorial=docs/walkthrough.md [cloud-ops]: ``` diff --git a/provisioning/sandboxctl b/provisioning/sandboxctl index 3d658a9e1..c34f8691f 100755 --- a/provisioning/sandboxctl +++ b/provisioning/sandboxctl @@ -32,6 +32,7 @@ SCRIPT_NAME="${0##*/}"; readonly SCRIPT_NAME SCRIPT_DIR="$(realpath "$(dirname "${0}")")"; readonly SCRIPT_DIR SANDBOX_VERSION="$(tr -d '\n' < "${SCRIPT_DIR}/version.txt")"; readonly SANDBOX_VERSION SANDBOX_SESSION="${SANDBOX_SESSION:-$(python3 -c 'import uuid; print(uuid.uuid4())')}"; readonly SANDBOX_SESSION +CLOUD_OPS_SANDBOX_DISABLE_TELEMETRY="${CLOUD_OPS_SANDBOX_DISABLE_TELEMETRY:-}"; readonly CLOUD_OPS_SANDBOX_DISABLE_TELEMETRY AGCLOUD="" ATERRAFORM="" @@ -81,7 +82,6 @@ create_subcommand() { done elif [[ -z $(gcloud projects list --filter="project_id:${PROJECT_ID}") ]]; then fatal "You need to provide a valid project ID." - exit 2 fi ### Configre ### @@ -92,10 +92,17 @@ create_subcommand() { pushd "${SCRIPT_DIR}/terraform" > /dev/null { configure_kustomization + if [[ -z "${CLOUD_OPS_SANDBOX_DISABLE_TELEMETRY}" ]]; then + export TF_APPEND_USER_AGENT="deploystack/cloud-ops-sandbox" + export GOOGLE_TERRAFORM_USERAGENT_EXTENSION="${TF_APPEND_USER_AGENT}" + fi terraform init -backend-config "bucket=${TF_BUCKET_NAME}" -backend-config "prefix=${TERRAFORM_PREFIX}" -lockfile=false && \ terraform apply -auto-approve -var-file="${tf_FILE_LOCATION}" && \ print_launch_instructions + send_telemetry "hipstershop-available" } + ### Cleanup ### + unset -v GOOGLE_TERRAFORM_USERAGENT_EXTENSION TF_APPEND_USER_AGENT popd > /dev/null mv "${KUSTOMIZE_FILE}.origin" "${KUSTOMIZE_FILE}" } @@ -117,10 +124,16 @@ delete_subcommand() { pushd "${SCRIPT_DIR}/terraform" > /dev/null { + if [[ -z "${CLOUD_OPS_SANDBOX_DISABLE_TELEMETRY}" ]]; then + export TF_APPEND_USER_AGENT="deploystack/cloud-ops-sandbox" + export GOOGLE_TERRAFORM_USERAGENT_EXTENSION="${TF_APPEND_USER_AGENT}" + fi terraform init -backend-config "bucket=${TF_BUCKET_NAME}" -backend-config "prefix=${TERRAFORM_PREFIX}" -lockfile=false && \ terraform destroy -auto-approve -var-file="${tf_FILE_LOCATION}" && \ info "Successfully deleted Cloud Ops Sandbox from ${PROJECT_ID} project." } + ### Cleanup ### + unset -v GOOGLE_TERRAFORM_USERAGENT_EXTENSION TF_APPEND_USER_AGENT popd > /dev/null } help_subcommand() { @@ -359,7 +372,7 @@ send_telemetry() { local EVENT_NAME="${1}" local TIMESTAMP; TIMESTAMP=$(date --utc +%s.%N) local OBFUSCATED_PROJECT_ID; OBFUSCATED_PROJECT_ID="$(echo "${PROJECT_ID}" | sha256sum | sed 's/ -//')" - gcloud pubsub topics publish "telemetry_test" \ + ${AGCLOUD} pubsub topics publish "telemetry_prod" \ --user-output-enabled=false \ --project "stackdriver-sandbox-230822" \ --message="{ \ @@ -381,7 +394,8 @@ EOF } get_auth_token() { - local TOKEN; TOKEN="$(retry 2 gcloud --project="${PROJECT_ID}" auth print-access-token)" + local TOKEN + TOKEN="$(retry 2 gcloud --project="${PROJECT_ID}" auth print-access-token)" echo "${TOKEN}" } @@ -509,7 +523,7 @@ Explore Cloud Ops Sandbox features by browsing GKE Dashboard: https://console.cloud.google.com/kubernetes/workload?project=${PROJECT_ID} Monitoring Workspace: https://console.cloud.google.com/monitoring/?project=${PROJECT_ID} -Trying Online Boutique at http://${EXTERNAL_IP}/ +Try Online Boutique at http://${EXTERNAL_IP}/ EOF } diff --git a/provisioning/version.txt b/provisioning/version.txt index 899f24fc7..f514a2f0b 100644 --- a/provisioning/version.txt +++ b/provisioning/version.txt @@ -1 +1 @@ -0.9.0 \ No newline at end of file +0.9.1 \ No newline at end of file