Skip to content
This repository has been archived by the owner on Nov 2, 2024. It is now read-only.

Commit

Permalink
fix: Update minor issues discovered in 0.9.0
Browse files Browse the repository at this point in the history
Use cloudshell_git_branch to point to the branch/tag instead of
cloudshell_git_repo.

Fixes #1034

Add "sandboxctl" badge to reflect CLI check status

Fixes #1032

Use 'bash' modifier to allow one-click copy/paste content to Cloud Shell

Fixes #1031

Updates version number in walkthrough URLs
and in version.txt

Report legacy telemetry when Sandbox is launched.
Report DvA using google provider on Terraform ops.

Fixes #1033
  • Loading branch information
minherz authored May 4, 2023
1 parent c39e8b9 commit c3f0fa4
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]: <http://cloud.google.com/products/operations
[ob]: <https://github.com/GoogleCloudPlatform/microservices-demo
[ob-architecture]: <https://github.com/GoogleCloudPlatform/microservices-demo#architecture
Expand Down
2 changes: 1 addition & 1 deletion docs/walkthrough.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ If prompted, authorize Cloud Shell to call listed Google Cloud APIs.

To launch Sandbox using default settings run the following command in Cloud Shell:

```shell
```bash
provisioning/sandboxctl create --project-id <walkthrough-project-id/>
```

Expand Down
22 changes: 18 additions & 4 deletions provisioning/sandboxctl
Original file line number Diff line number Diff line change
Expand Up @@ -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=""

Expand Down Expand Up @@ -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 ###
Expand All @@ -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}"
}
Expand All @@ -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() {
Expand Down Expand Up @@ -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="{ \
Expand All @@ -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}"
}

Expand Down Expand Up @@ -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

}
Expand Down
2 changes: 1 addition & 1 deletion provisioning/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.0
0.9.1

0 comments on commit c3f0fa4

Please sign in to comment.