Cloud Native 8 min read

Build a Remote VSCode Environment for OceanBase obdiag and Accelerate Coding with AI

This guide walks through setting up a CentOS virtual machine, configuring a Python 3.8 environment with Miniconda, forking and cloning the OceanBase obdiag repository, using VSCode remote‑SSH for development, and leveraging the Tongyi Lingma AI plugin to generate unit tests and documentation, culminating in a contribution workflow.

Alibaba Cloud Native
Alibaba Cloud Native
Alibaba Cloud Native
Build a Remote VSCode Environment for OceanBase obdiag and Accelerate Coding with AI

Background

The author, a curious DBA, chose OceanBase—a distributed relational database—as the target for exploration. The open‑source nature of OceanBase led to the discovery of the OceanBase Diagnostic Tool ( obdiag ), a Python‑based utility for collecting diagnostics, analysis, and inspection across various deployment modes.

1. Build a CentOS Virtual Machine

The development environment runs on Linux, so the author created a CentOS 7.9 VM using VMware Workstation . Detailed installation steps are referenced in an external tutorial (see link in the original article).

2. Deploy the obdiag Development Environment

obdiag requires Python 3.8. The author used Miniconda to create an isolated Python environment, simplifying dependency management. A tutorial for installing Conda and setting up the Python environment is also referenced.

3. Fork and Clone the obdiag Repository

Log in to GitHub, navigate to https://github.com/oceanbase/obdiag, and click Fork to create a personal copy. Then clone the forked repository into the CentOS VM: git clone [email protected]:owner_name/obdiag.git After cloning, the typical code‑pull and contribution workflow is illustrated with screenshots in the original article.

4. Set Up VSCode Remote‑SSH

Install Visual Studio Code on the host machine and add the Remote - SSH extension. Configure the remote server by adding the CentOS VM’s SSH details, selecting a configuration file, and opening a new remote window.

Once connected, open the obdiag Python project folder.

5. Configure the Python Interpreter

Install the VSCode Python extension, then select the Conda‑based interpreter:

Press Ctrl+Shift+P, type Python: Select Interpreter, and choose the Conda environment created earlier.

6. Use Tongyi Lingma AI Plugin

Install the Tongyi Lingma extension from the VSCode marketplace. After installation, each function in the code shows a Lingma icon offering four actions: code explanation, unit‑test generation, code optimization, and comment generation.

To generate unit tests, click the icon and select the Unit Test option. Copy the generated test code into the appropriate test directory and run the tests. The same process applies to automatically generate code comments.

7. Contribute Changes Back to the Project

After fixing bugs or adding features, create a new branch in the forked repository: git checkout -b feature-name Stage and commit the changes:

git add .
git commit -m "add unittest for ssh_client"

Push the branch to the forked repository: git push origin feature-name On GitHub, click the Compare & Pull Request button to submit a PR to the upstream oceanbase/obdiag repository.

Conclusion

The combination of a remote CentOS development environment, the obdiag tool, VSCode remote‑SSH, and the Tongyi Lingma AI assistant streamlines onboarding to a new open‑source project, accelerates unit‑test creation, and simplifies code documentation, ultimately enabling effective contributions to the OceanBase ecosystem.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

AI CodingGitVSCodeRemote DevelopmentOceanBaseobdiag
Alibaba Cloud Native
Written by

Alibaba Cloud Native

We publish cloud-native tech news, curate in-depth content, host regular events and live streams, and share Alibaba product and user case studies. Join us to explore and share the cloud-native insights you need.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.