Skip to content

test: run the cloud-profiler system tests in google cloud build#8698

Open
danieljbruce wants to merge 8 commits into
mainfrom
kokoro-to-gcb-cloud-profiler
Open

test: run the cloud-profiler system tests in google cloud build#8698
danieljbruce wants to merge 8 commits into
mainfrom
kokoro-to-gcb-cloud-profiler

Conversation

@danieljbruce

@danieljbruce danieljbruce commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Description

This pull request adds a yaml file to instruct the Cloud Profiler system test CI check to work with the new Cloud Build trigger thereby making the new CI check effectively run our system tests. It turns out that no extra code modifications are required to allow the test to run in the new environment.

This pull request is very similar to #8697.

Impact

Leverages the strengths of running system tests in GCB rather than relying on kokoro for system tests.

Testing

This pull request tells the tests how to work with the new check to the continuous integration pipeline for the Cloud Profiler system tests thus improves the effectiveness of that test.

Next Steps

  1. Merge a pull request that removes the system tests from kokoro. This should be done in a separate pull request to separate the concerns of removing the kokoro system tests from adding the Google Cloud Build system tests.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces helper scripts and templates under bin/move-to-gcb/ to automate the setup of Google Cloud Build (GCB) triggers for running system tests on client libraries, including a generated configuration for cloud-profiler. The review feedback suggests enhancing the configurability of these scripts by allowing the wrapper script generate_yaml_and_create_trigger.sh to accept and forward a custom GCP project ID (-p) to create_trigger.sh. Additionally, the reviewer recommends explicitly setting the _GCP_PROJECT_ID substitution parameter during trigger creation in create_trigger.sh to prevent falling back to the default project ID.

Comment on lines +5 to +22
usage() {
echo "Usage: $0 -l <library_name>"
echo " -l The name of the library (e.g., bigtable, spanner) [Required]"
exit 1
}

while getopts "l:h" opt; do
case "${opt}" in
l) LIBRARY_NAME="${OPTARG}" ;;
h) usage ;;
*) usage ;;
esac
done

if [[ -z "${LIBRARY_NAME}" ]]; then
echo "Error: Library name (-l) is required."
usage
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The wrapper script generate_yaml_and_create_trigger.sh does not accept the -p (project ID) option, even though the underlying create_trigger.sh script supports it. This prevents users from specifying a custom GCP project ID when running the wrapper script.

Suggested change
usage() {
echo "Usage: $0 -l <library_name>"
echo " -l The name of the library (e.g., bigtable, spanner) [Required]"
exit 1
}
while getopts "l:h" opt; do
case "${opt}" in
l) LIBRARY_NAME="${OPTARG}" ;;
h) usage ;;
*) usage ;;
esac
done
if [[ -z "${LIBRARY_NAME}" ]]; then
echo "Error: Library name (-l) is required."
usage
fi
usage() {
echo "Usage: $0 -l <library_name> [-p <project_id>]"
echo " -l The name of the library (e.g., bigtable, spanner) [Required]"
echo " -p The Google Cloud project ID"
exit 1
}
while getopts "l:p:h" opt; do
case "${opt}" in
l) LIBRARY_NAME="${OPTARG}" ;;
p) PROJECT_ID="${OPTARG}" ;;
h) usage ;;
*) usage ;;
esac
done
if [[ -z "${LIBRARY_NAME}" ]]; then
echo "Error: Library name (-l) is required."
usage
fi

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was accidentally pushed and is no longer in the list of changes.

Comment on lines +29 to +30
# Create the build trigger
"${SCRIPT_DIR}/create_trigger.sh" -l "${LIBRARY_NAME}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Forward the parsed PROJECT_ID to create_trigger.sh if it is provided.

Suggested change
# Create the build trigger
"${SCRIPT_DIR}/create_trigger.sh" -l "${LIBRARY_NAME}"
# Create the build trigger
if [[ -n "${PROJECT_ID}" ]]; then
"${SCRIPT_DIR}/create_trigger.sh" -l "${LIBRARY_NAME}" -p "${PROJECT_ID}"
else
"${SCRIPT_DIR}/create_trigger.sh" -l "${LIBRARY_NAME}"
fi

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was accidentally pushed and is no longer in the list of changes.

Comment thread bin/move-to-gcb/create_trigger.sh Outdated
Comment on lines +35 to +46
# Execute the gcloud command with variable substitutions
gcloud builds triggers create github \
--project="${PROJECT_ID}" \
--name="${LIBRARY_NAME}-system-tests" \
--region="global" \
--description="CI build trigger for ${LIBRARY_NAME} system tests" \
--repo-owner="googleapis" \
--repo-name="google-cloud-node" \
--pull-request-pattern="^main$" \
--comment-control="COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY" \
--included-files="handwritten/${LIBRARY_NAME}/**" \
--build-config="handwritten/${LIBRARY_NAME}/cloudbuild.yaml"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

When creating the Cloud Build trigger, the _GCP_PROJECT_ID substitution should be explicitly set to the target PROJECT_ID. Otherwise, the trigger will fall back to the default value (long-door-651) defined in the cloudbuild.yaml file, even if the trigger is created in a different project.

Suggested change
# Execute the gcloud command with variable substitutions
gcloud builds triggers create github \
--project="${PROJECT_ID}" \
--name="${LIBRARY_NAME}-system-tests" \
--region="global" \
--description="CI build trigger for ${LIBRARY_NAME} system tests" \
--repo-owner="googleapis" \
--repo-name="google-cloud-node" \
--pull-request-pattern="^main$" \
--comment-control="COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY" \
--included-files="handwritten/${LIBRARY_NAME}/**" \
--build-config="handwritten/${LIBRARY_NAME}/cloudbuild.yaml"
# Execute the gcloud command with variable substitutions
gcloud builds triggers create github \
--project="${PROJECT_ID}" \
--name="${LIBRARY_NAME}-system-tests" \
--region="global" \
--description="CI build trigger for ${LIBRARY_NAME} system tests" \
--repo-owner="googleapis" \
--repo-name="google-cloud-node" \
--pull-request-pattern="^main$" \
--comment-control="COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY" \
--included-files="handwritten/${LIBRARY_NAME}/**" \
--build-config="handwritten/${LIBRARY_NAME}/cloudbuild.yaml" \
--substitutions=_GCP_PROJECT_ID="${PROJECT_ID}"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was accidentally pushed and is no longer in the list of changes.

@danieljbruce danieljbruce changed the title Kokoro to gcb cloud profiler test: run the cloud-profiler system tests in google cloud build Jun 22, 2026
@danieljbruce danieljbruce marked this pull request as ready for review June 22, 2026 21:21
@danieljbruce danieljbruce requested a review from a team as a code owner June 22, 2026 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants