SERVER-112731: Add git fetch tags step to container post create to en… (#42981)

GitOrigin-RevId: 2c9879bf0277c056464b15a90e412919c38bf448
This commit is contained in:
Eric Lavigne 2025-10-22 10:06:40 -04:00 committed by MongoDB Bot
parent c199256f30
commit d4ce0777a9
3 changed files with 22 additions and 23 deletions

View File

@ -44,7 +44,8 @@
"createDataDir": "sudo mkdir -p /data/db && sudo chown -R $(whoami): /data/db",
"reportDockerServerPlatform": "echo \"\ncommon --bes_keywords=devcontainer:docker_server_platform=$(docker version --format '\"{{.Server.Platform.Name}}\"')\" >> ${containerEnv:HOME}/.bazelrc",
"reportDockerServerVersion": "echo \"\ncommon --bes_keywords=devcontainer:docker_server_version=$(docker version --format '\"{{.Server.Version}}\"')\" >> ${containerEnv:HOME}/.bazelrc",
"reportArch": "echo \"\ncommon --bes_keywords=devcontainer:arch=$(uname -i)\" >> ${containerEnv:HOME}/.bazelrc"
"reportArch": "echo \"\ncommon --bes_keywords=devcontainer:arch=$(uname -i)\" >> ${containerEnv:HOME}/.bazelrc",
"fetchTags": "git fetch --tags || true"
},
"shutdownAction": "none",
"customizations": {

View File

@ -450,10 +450,21 @@ After the container starts, several commands run to finalize setup:
"createDataDir": "sudo mkdir -p /data/db && sudo chown -R $(whoami): /data/db",
"reportDockerServerPlatform": "echo \"\ncommon --bes_keywords=devcontainer:docker_server_platform=$(docker version --format '\"{{.Server.Platform.Name}}\"')\" >> ${containerEnv:HOME}/.bazelrc",
"reportDockerServerVersion": "echo \"\ncommon --bes_keywords=devcontainer:docker_server_version=$(docker version --format '\"{{.Server.Version}}\"')\" >> ${containerEnv:HOME}/.bazelrc",
"reportArch": "echo \"\ncommon --bes_keywords=devcontainer:arch=$(uname -i)\" >> ${containerEnv:HOME}/.bazelrc"
"reportArch": "echo \"\ncommon --bes_keywords=devcontainer:arch=$(uname -i)\" >> ${containerEnv:HOME}/.bazelrc",
"fetchTags": "git fetch --tags || true"
}
```
**What these commands do:**
- **fixVolumePerms**: Ensures proper ownership of mounted volumes
- **venvActivation**: Configures shell to automatically activate Python virtual environment
- **createDataDir**: Creates MongoDB data directory with proper permissions
- **reportDockerServerPlatform**: Adds Docker platform info to Bazel telemetry
- **reportDockerServerVersion**: Adds Docker version to Bazel telemetry
- **reportArch**: Adds system architecture to Bazel telemetry
- **fetchTags**: Fetches all git tags automatically
### From Workstation Feature
The workstation feature's `postCreateCommand`:
@ -534,7 +545,8 @@ This sets:
8. Create Python venv
9. Install Poetry dependencies
10. Create MongoDB data directory
11. Report Docker info to Bazel
11. Fetch git tags
12. Report Docker info to Bazel
**Runtime:**

View File

@ -237,25 +237,11 @@ https://github.com/mongodb/mongo.git
- Install VS Code extensions
- Run post-creation commands
### Step 2: Complete Git History (Recommended)
The clone process may create a shallow clone. Fetch the complete history:
```bash
git fetch --unshallow --all
```
This ensures:
- Access to full repository history
- All branches are available
- Certain build targets work correctly (e.g., `bazel build install-dist`)
### Step 3: Verify Your Setup
### Step 2: Verify Your Setup
Let's make sure everything is working correctly.
#### 3.1 Check Toolchain Installation
#### 2.1 Check Toolchain Installation
```bash
# Verify GCC version
@ -265,7 +251,7 @@ gcc --version
python3 --version
```
#### 3.2 Verify Python Virtual Environment
#### 2.2 Verify Python Virtual Environment
The devcontainer automatically sets up a Python virtual environment:
@ -278,7 +264,7 @@ which python
poetry --version
```
#### 3.3 Test Bazel Build
#### 2.3 Test Bazel Build
Try building a target:
@ -292,7 +278,7 @@ This may take a while on first run but verifies:
- Toolchain is working
- Build system is functional
#### 3.4 Check VS Code Extensions
#### 2.4 Check VS Code Extensions
The following extensions should be installed and active:
@ -303,7 +289,7 @@ The following extensions should be installed and active:
Check: View → Extensions and verify they're enabled.
### Step 4: Understanding Your Environment
### Step 3: Understanding Your Environment
#### Workspace Location