Skip to content

chore(ci): migrate sqlserver/mssql sample to new ci #4066

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

glasnt
Copy link
Contributor

@glasnt glasnt commented Apr 8, 2025

Description

Fixes #

Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.

Checklist

  • I have followed guidelines from CONTRIBUTING.MD and Samples Style Guide
  • Tests pass: npm test (see Testing)
  • Lint pass: npm run lint (see Style)
  • These samples need a new API enabled in testing projects to pass (let us know which ones)
  • These samples need a new/updated env vars in testing projects set to pass (let us know which ones)
  • This pull request is from a branch created directly off of GoogleCloudPlatform/nodejs-docs-samples. Not a fork.
  • This sample adds a new sample directory, and I updated the CODEOWNERS file with the codeowners for this sample
  • This sample adds a new sample directory, and I created GitHub Actions workflow for this sample
  • This sample adds a new Product API, and I updated the Blunderbuss issue/PR auto-assigner with the codeowners for this sample
  • Please merge this PR for me once it is approved

@product-auto-label product-auto-label bot added samples Issues that are directly related to samples. api: cloudsql Issues related to the Cloud SQL for MySQL API. asset: pattern DEE Asset tagging - Pattern. labels Apr 8, 2025
Copy link
Contributor

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

Choose a reason for hiding this comment

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

Hello @glasnt, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request migrates the sqlserver/mssql sample to the new CI. This involves adding a ci-setup.json file with environment variables and secrets, updating the package.json to include a proxy script for running system tests, and updating the nodejs-dev.jsonc and nodejs.jsonc files to reflect the change.

Highlights

  • CI Migration: The sqlserver/mssql sample is being migrated to the new CI.
  • ci-setup.json: A new ci-setup.json file is added to define environment variables and secrets for the CI environment.
  • package.json update: The package.json file is updated to include a proxy script that uses sql-proxy.sh and prepends it to the system test command.
  • nodejs config updates: The nodejs-dev.jsonc and nodejs.jsonc files are updated to reflect the migration of the sqlserver/mssql sample.

Changelog

  • .github/config/nodejs-dev.jsonc
    • Added cloud-sql/sqlserver/mssql to the list of samples in the nodejs-dev.jsonc file at line 106.
  • .github/config/nodejs.jsonc
    • Removed cloud-sql/sqlserver/mssql from the list of samples in the nodejs.jsonc file at line 80.
  • cloud-sql/sqlserver/mssql/ci-setup.json
    • Created a new ci-setup.json file with environment variables and secrets for the CI environment, including INSTANCE_HOST, INSTANCE_CONNECTION_NAME, UNIX_SOCKET_DIR, CLOUD_SQL_CONNECTION_NAME, INSTANCE_UNIX_SOCKET, DB_NAME, DB_USER, and DB_PASS.
  • cloud-sql/sqlserver/mssql/package.json
    • Added a proxy script to the package.json file at line 16 that executes the sql-proxy.sh script.
    • Modified the system-test script at line 17 to use the new proxy script to run the tests.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


The SQL server sleeps,
A proxy whispers awake,
Tests now start to pass.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

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

Choose a reason for hiding this comment

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

Code Review

The pull request migrates the sqlserver/mssql sample to the new CI. This involves adding the sample to the nodejs-dev.jsonc config, removing it from the nodejs.jsonc config, creating a ci-setup.json file, and modifying the package.json file to include a proxy script for system tests. Overall, the changes seem reasonable and necessary for the migration.

Merge Readiness

The changes appear to be correct and necessary for migrating the sqlserver/mssql sample to the new CI. I recommend merging this pull request after addressing the review comments. I am unable to directly approve the pull request, and users should have others review and approve this code before merging.

@@ -77,7 +77,6 @@
// TODO: fix these
"ai-platform/snippets", // PERMISSION_DENIED: Permission denied: Consumer 'projects/undefined' has been suspended.
"automl", // (untested) FAILED_PRECONDITION: Google Cloud AutoML Natural Language was retired on March 15, 2024. Please migrate to Vertex AI instead
"cloud-sql/sqlserver/mssql", // (untested) TypeError: The "config.server" property is required and must be of type string.
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This line is being removed, which makes sense since the sample is being migrated to the nodejs-dev.jsonc config. However, it's important to ensure that the reason for the previous failure (TypeError: The "config.server" property is required and must be of type string.) has been addressed in the new CI setup. Otherwise, the sample might still fail in the new CI environment.

Comment on lines +16 to +17
"proxy": "$GITHUB_WORKSPACE/.github/workflows/utils/sql-proxy.sh",
"system-test": "npm run proxy -- c8 mocha -p -j 2 test/*.test.js --timeout=60000 --exit",
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The proxy script is introduced here. It's good to see that the SQL proxy is being used for system tests. However, it would be helpful to add a comment explaining what this script does and why it's needed. This will improve the maintainability of the code.

@@ -13,7 +13,8 @@
},
"scripts": {
"start": "node server/server.js",
"system-test": "c8 mocha -p -j 2 test/*.test.js --timeout=60000 --exit",
"proxy": "$GITHUB_WORKSPACE/.github/workflows/utils/sql-proxy.sh",
"system-test": "npm run proxy -- c8 mocha -p -j 2 test/*.test.js --timeout=60000 --exit",
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The system-test script now uses the proxy script. It's important to ensure that the sql-proxy.sh script is executable. Also, consider adding a check to ensure that the proxy is running before running the tests. This will prevent the tests from failing if the proxy is not running.

@glasnt glasnt marked this pull request as ready for review April 16, 2025 04:35
@glasnt glasnt requested review from a team as code owners April 16, 2025 04:35
"env": {
"INSTANCE_HOST": "127.0.0.1",
"INSTANCE_CONNECTION_NAME": "nodejs-docs-samples-tests:us-central1:sql-server-ci",
"UNIX_SOCKET_DIR": "tmp/cloudsql",
Copy link
Contributor

Choose a reason for hiding this comment

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

@glasnt SQL Server does not support unix domain socket connections so I think we can remove the unix socket related variables from SQL Server config 😄

@glasnt
Copy link
Contributor Author

glasnt commented Apr 17, 2025

experimental test is failing because it's using the package.json from the main branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: cloudsql Issues related to the Cloud SQL for MySQL API. asset: pattern DEE Asset tagging - Pattern. samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants