Skip to content
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

chore: Changes to metadata files #20

Merged
merged 8 commits into from
Jan 23, 2024
Merged
10 changes: 5 additions & 5 deletions products/compute/metadata/create_disk_snapshot.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ description = "Creates a new snapshot of the given zonal/regional disk."
standalone = true
deprecated = false
# What kinds of preconditions needs to be met. Natural language. (optional)
requirements = "The disk to be snapshotted should exist."
requirements_desc = "The disk to be snapshotted should exist."
# What will happen when the code sample in the region tag gets executed. Natural Language. (optional)
effects = "The snapshot gets created in the location specified."
effects_desc = "The snapshot gets created in the location specified."

[requirements]
# List of services that need to be enabled for the sample (and tests) to work.
Expand Down Expand Up @@ -44,7 +44,7 @@ parallel_limit = 16
# Using a single project for all the languages. Many tests can be run with `parallel = true`, which
# will speed things up.
# TODO: Replace the PROJECT_ID with a dynamic value.
PROJECT_ID = 'unified-testing-project'
#PROJECT_ID = 'unified-testing-project'
# The series of #### gets replaced by random string to generate unique IDs.
# A different value is prepared for each test language. Different versions of a language
# count as different languages.
Expand All @@ -54,8 +54,8 @@ PROJECT_ID = 'unified-testing-project'
versions = ["3.8", "3.12"]
# Legacy tests skip setup, cleanup and check. They only execute the method pointed to and check if it failed.
legacy = true
file = "../python/templates/delete.py"
method = "delete_instance_template"
file = "../python/snapshot/create.py"
method = "create_snapshot"
test_file = "../python/snapshot/test_snapshots.py"
test_method = "test_snapshot_create_delete"
# Those packages will be installed before executing the Python sample.
Expand Down
6 changes: 3 additions & 3 deletions products/compute/metadata/delete_template.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ description = "Deletes an instance template from a project."
standalone = true
deprecated = false
# What kinds of preconditions needs to be met. Natural language. (optional)
requirements = "The template must exist... No special requirements or hidden catches here."
requirements_desc = "The template must exist... No special requirements or hidden catches here."
# What will happen when the code sample in the region tag gets executed. Natural Language. (optional)
effects = "The template gets deleted."
effects_desc = "The template gets deleted."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is _desc meant to clarify that it's a string value? Are these values separately used in the tool? If not maybe they should be combined? Or perhaps requirements_desc could be moved as requirements.description?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The _desc suffix is there, because right after this we have a section [requirements] and the names collide. So I quickly added the _desc suffix to requirements fields. I added the suffix to effects as well for consistency.


[requirements]
# List of services that need to be enabled for the sample (and tests) to work.
Expand Down Expand Up @@ -69,7 +69,7 @@ commands = ["gcloud compute instance-templates delete --quiet $TEMPLATE_NAME ||

[tests.python]
# We can specify which versions of a language we want to test against.
versions = ["3.8", "3.12"]
versions = ["3.9", "3.10", "3.11", "3.12"]
# Legacy tests skip setup, cleanup and check. They only execute the method pointed to and check if it failed.
legacy = false
file = "../python/templates/delete.py"
Expand Down
9 changes: 4 additions & 5 deletions products/compute/metadata/oslogin_service_account_ssh.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ description = "Runs a command on a remote system, authenticating with a Service
standalone = true
deprecated = false
# What kinds of preconditions needs to be met. Natural language. (optional)
requirements = "The Compute instance, firewall rule and Service Account to be used for authentication must exist."
requirements_desc = "The Compute instance, firewall rule and Service Account to be used for authentication must exist."
# What will happen when the code sample in the region tag gets executed. Natural Language. (optional)
effects = "Runs the given input command on the remote instance and prints the result."
effects_desc = "Runs the given input command on the remote instance and prints the result."

[requirements]
# List of services that need to be enabled for the sample (and tests) to work.
Expand Down Expand Up @@ -52,14 +52,13 @@ parallel_limit = 16
# Using a single project for all the languages. Many tests can be run with `parallel = true`, which
# will speed things up.
# TODO: Replace the PROJECT_ID with a dynamic value.
PROJECT_ID = 'unified-testing-project'
#PROJECT_ID = 'mestiv-playground'
# The series of #### gets replaced by random string to generate unique IDs.
# A different value is prepared for each test language. Different versions of a language
# count as different languages.
# The series of ##### will be replaced by a zone name from the list of zones available.
TEST_ID = 'test-compute-oslogin-#####'
INSTANCE_NAME = '$TEST_ID'
ZONE = '#####'
ZONE = 'europe-north1-b'
SERVICE_ACCOUNT = '{$TEST_ID}@{$PROJECT_ID}.iam.gserviceaccount.com'
HOSTNAME = ''
INPUT_COMMAND = 'uname -a'
Expand Down
10 changes: 5 additions & 5 deletions products/logging/metadata/list_log_entries.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ description = "Lists the most recent entries for a given logger."
standalone = true
deprecated = false
# What kinds of preconditions needs to be met. Natural language. (optional)
requirements = "The Logger must exist in the project."
requirements_desc = "The Logger must exist in the project."
# What will happen when the code sample in the region tag gets executed. Natural Language. (optional)
effects = "The log entries for the given logger for the last one minute will be piped out."
effects_desc = "The log entries for the given logger for the last one minute will be piped out."

[requirements]
# List of services that need to be enabled for the sample (and tests) to work.
Expand Down Expand Up @@ -45,12 +45,12 @@ parallel_limit = 16
# Using a single project for all the languages. Many tests can be run with `parallel = true`, which
# will speed things up.
# TODO: Replace the PROJECT_ID with a dynamic value.
PROJECT_ID = 'unified-testing-project'
#PROJECT_ID = 'unified-testing-project'
# The series of #### gets replaced by random string to generate unique IDs.
# A different value is prepared for each test language. Different versions of a language
# count as different languages.
LOGGER_NAME = 'test-logger-name-#####'
LOG_MESSAGE = 'Hello World'
LOG_MESSAGE = 'Hello World #####'

[tests.setup]
# This needs to exit with code 0. If it doesn't the test will fail.
Expand All @@ -62,7 +62,7 @@ commands = ["gcloud logging write $LOGGER_NAME \"$LOG_MESSAGE\" "]
# Check if the log_message is present in the returned log entries.
# UST_SAMPLE_OUTPUT is an environment variable populated with the
# sample's output.
command = "echo $UST_SAMPLE_OUTPUT | grep $LOG_MESSAGE"
command = 'echo $UST_SAMPLE_OUTPUT | grep "${LOG_MESSAGE}"'

[tests.cleanup]
# Make sure all log entries for the logger are deleted. If the command can fail,
Expand Down
18 changes: 9 additions & 9 deletions products/storage/metadata/storage_move_file.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ description = "Moves or renames a file inside a storage bucket. Not suitable to
standalone = true
deprecated = false
# What kinds of preconditions needs to be met. Natural language. (optional)
requirements = "The bucket and the file must exist. User needs to have write permission to the bucket."
requirements_desc = "The bucket and the file must exist. User needs to have write permission to the bucket."
# What will happen when the code sample in the region tag gets executed. Natural Language. (optional)
effects = "File is moved/renamed."
effects_desc = "File is moved/renamed."

[requirements]
# List of services that need to be enabled for the sample (and tests) to work.
Expand Down Expand Up @@ -62,12 +62,12 @@ terraform = ["tf/storage_move_file/single_bucket_move.tf"]
command = "gsutil ls gs://$BUCKET_NAME/ | grep $NEW_FILE_NAME"

[tests.cleanup]
# Make sure the template is deleted. If the command can fail, use `|| true` to supress the failure.
# In this case, it WILL fail, if the test was successful, so we want to ignore this failure.
# Make sure the file is deleted. If the command can fail, use `|| true` to supress the failure.
# Since Terraform was used to set up the environment, it will be automatically used to clean up using
# `terraform destroy`. However, since some resources might not longer be under Terraform control, we have an option to
# `terraform destroy`. However, since some resources might no longer be under Terraform control, we have an option to
# execute some commands before `terraform destroy` takes place.
commands = ["gsutil rm -f gs://$BUCKET_NAME/$NEW_FILE_NAME"]

commands = ["gsutil rm -f gs://$BUCKET_NAME/$NEW_FILE_NAME || true"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense for prototype, it might be good to move the error suppression into a separate setting, maybe a "warnOnFailure" that would allow the tool to suppress the error but still log as part of the tool's UX that something went wrong.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could work when we have only one command, but if there are multiple commands and we want to ignore error for only some of them, it gets more complicated.

Definitely something to consider if this gets to evolve to full project.


[tests.python]
# We can specify which versions of a language we want to test against.
Expand All @@ -79,7 +79,7 @@ method = "move_blob"
# Parameters can be strings, integers and floats. Define appropriate value in TOML - it supports ints and floats!
parameters = ["$BUCKET_NAME", "$FILE_NAME", "$BUCKET_NAME", "$NEW_FILE_NAME"]
# Those packages will be installed before executing the Python sample.
requirements = "../python/templates/requirements.txt"
requirements = "../python/requirements.txt"

[tests.java]
versions = ["11", "17", "21"]
Expand Down Expand Up @@ -115,15 +115,15 @@ terraform = ["tf/storage_move_file/move_between_buckets.tf"]
command = "gsutil ls gs://$NEW_BUCKET_NAME/ | grep $NEW_FILE_NAME"

[tests.cleanup]
commands = ["gsutil rm -f gs://$NEW_BUCKET_NAME/$NEW_FILE_NAME"]
commands = ["gsutil rm -f gs://$NEW_BUCKET_NAME/$NEW_FILE_NAME || true"]

[tests.python]
versions = ["3.8", "3.12"]
legacy = false
file = "../python/storage_move_file.py"
method = "move_blob"
parameters = ["$BUCKET_NAME", "$FILE_NAME", "$NEW_BUCKET_NAME", "$NEW_FILE_NAME"]
requirements = "../python/templates/requirements.txt"
requirements = "../python/requirements.txt"

[tests.java]
versions = ["11", "17", "21"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@
* limitations under the License.
*/

variable "bucket_name" {
variable "BUCKET_NAME" {
type = string
}
variable "new_bucket_name" {

variable "NEW_BUCKET_NAME" {
type = string
}
variable "file_name" {
variable "FILE_NAME" {
type = string
}

resource "google_storage_bucket" "default" {
name = var.bucket_name
name = var.BUCKET_NAME
location = "EU"
force_destroy = true

Expand All @@ -34,7 +35,7 @@ resource "google_storage_bucket" "default" {
}

resource "google_storage_bucket" "default2" {
name = var.new_bucket_name
name = var.NEW_BUCKET_NAME
location = "EU"
force_destroy = true

Expand All @@ -43,7 +44,7 @@ resource "google_storage_bucket" "default2" {
}

resource "google_storage_bucket_object" "default" {
name = var.file_name
name = var.FILE_NAME
content = " this is the content! "
bucket = google_storage_bucket.default.name
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@
* limitations under the License.
*/

variable "bucket_name" {
variable "BUCKET_NAME" {
type = string
}
variable "file_name" {

variable "FILE_NAME" {
type = string
}

resource "google_storage_bucket" "default" {
name = var.bucket_name
name = var.BUCKET_NAME
location = "EU"
force_destroy = true

Expand All @@ -31,7 +32,7 @@ resource "google_storage_bucket" "default" {
}

resource "google_storage_bucket_object" "default" {
name = var.file_name
name = var.FILE_NAME
content = " this is the content! "
bucket = google_storage_bucket.default.name
}
Expand Down
31 changes: 31 additions & 0 deletions renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,37 @@
"pinDigests": true,
},

{
"matchCategories": ["go"],
"extends": [
"local>.samplesplatform/renovate/go",
],
},
{
"matchCategories": ["python"],
"extends": [
"local>.samplesplatform/renovate/python",
],
},
{
"matchCategories": ["java"],
"extends": [
"local>.samplesplatform/renovate/java",
],
},
{
"matchManagers": ["terraform"],
"extends": [
"local>.samplesplatform/renovate/terraform",
],
},
{
"matchCategories": ["js", "node"],
"extends": [
"local>.samplesplatform/renovate/javascript",
],
},

// Updating coupled ecosystems.
{
"groupName": "Playwright",
Expand Down