Skip to content

Commit 6e4559a

Browse files
fix(vpc-endpoints): resolve critical testing infrastructure issues … (#1)
* fix(vpc-endpoints): resolve critical testing infrastructure issues and YAML operation failures ## Summary Fixed multiple critical issues in VPC endpoints testing infrastructure that were preventing successful test execution and YAML operations. Resolved project ID parsing failures, cloud provider mismatches in deletion operations, and flawed verification logic. ## Issues Fixed ### 1. VPC Endpoints YAML Project ID Resolution - **Problem**: VPC endpoint YAML configurations weren't being parsed for project ID resolution - **Error**: "failed to resolve project ID for '': project '' not found in organization" - **Root Cause**: getProjectID() function only handled SearchIndex resources, not VPCEndpoint - **Fix**: Enhanced getProjectID() to extract projectName from VPCEndpoint resource specs - **Impact**: YAML operations (plan/apply/destroy) now work correctly with VPCEndpoint resources ### 2. Multi-Provider Deletion Support - **Problem**: AWS endpoints deleted successfully, but GCP and Azure endpoints failed deletion - **Root Cause**: All deletion commands hardcoded to use "--cloud-provider AWS" - **Fix**: Dynamic cloud provider extraction using jq from Atlas API responses - **Impact**: Multi-provider tests now pass cleanup phase, preventing resource leaks ### 3. Verification Logic Alignment with Atlas API - **Problem**: Tests searched for YAML metadata names that don't exist in Atlas responses - **Root Cause**: Atlas VPC endpoints don't store user-defined names, only system IDs - **Fix**: Replaced name-based verification with endpoint count and provider validation - **Impact**: All verification phases now pass correctly with accurate results ## Technical Changes ### Enhanced Project ID Parsing (cmd/infra/apply.go) - Added VPCEndpoint support to getProjectID() function - Enhanced parsing for DatabaseUser, NetworkAccess, and Cluster resources - Improved error handling for project resolution across all resource types ### Multi-Provider Deletion Logic (scripts/test/vpc-endpoints-lifecycle.sh) - Replaced hardcoded AWS provider with dynamic extraction - Added jq-based provider and ID extraction from Atlas API responses - Enhanced cleanup_all_vpc_endpoints() with proper provider handling - Updated all deletion operations to use correct cloud providers ### Verification Logic Overhaul - Replaced grep searches for non-existent names with jq length counting - Added cloud provider verification using jq -r '.[].cloudProvider' - Implemented robust endpoint existence checking based on actual API responses - Enhanced error handling and null value validation ## Files Modified - cmd/infra/apply.go: Enhanced getProjectID() with comprehensive resource support - scripts/test/vpc-endpoints-lifecycle.sh: Fixed deletion logic and verification methods ## Test Results ### Before Fix - YAML operations: Failed with project ID resolution errors - Multi-provider deletion: GCP/Azure endpoints not deleted (resource leaks) - Verification: All attempts failed searching for non-existent names - Test suite: Consistent failures in YAML phase ### After Fix ✅ VPC endpoint YAML operations work correctly with proper project ID resolution ✅ Multi-provider deletion works for AWS, Azure, and GCP endpoints ✅ Verification logic checks actual endpoint existence and cloud provider types ✅ Complete test suite passes all phases including multi-provider scenarios ## Verification **Project ID Resolution Test:** ```bash $ matlas infra plan -f vpc-endpoint.yaml --preserve-existing Execution Plan plan-1755680190 Project 68961f3e6a4bb94d55e6404c (resolved from YAML) Stage 0 (1 operations) Resource Type Operation Resource Name Risk Duration VPCEndpoint Create test-vpc-endpoint-123 low 30s Multi-Provider Support: - AWS: ✅ Uses --cloud-provider AWS correctly - Azure: ✅ Uses --cloud-provider AZURE correctly - GCP: ✅ Uses --cloud-provider GCP correctly Impact The VPC endpoints feature is now fully operational and comprehensively tested: - Complete dual interface support (CLI + YAML) - Multi-cloud provider support (AWS/Azure/GCP) - Enterprise-grade testing with proper resource lifecycle management - Robust cleanup and preservation mechanisms - Reliable verification based on actual Atlas API responses Resolves VPC endpoint testing infrastructure issues and enables full YAML workflow support. * fix: golangci-lint errors and windows matrix workflow * fix: lint and fmt --------- Co-authored-by: Danny Teller <danny.teller@tipalti.com>
1 parent bc002a0 commit 6e4559a

53 files changed

Lines changed: 8500 additions & 593 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/release.yml

Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ permissions:
1414

1515
env:
1616
GO_VERSION: '1.24.5'
17-
GOLANGCI_LINT_VERSION: 'v2.3.1'
17+
GOLANGCI_LINT_VERSION: 'v2.4.0'
1818

1919
jobs:
2020
# ==============================================================================
@@ -44,19 +44,31 @@ jobs:
4444
restore-keys: |
4545
${{ runner.os }}-go-
4646
47+
- name: Clean Go Module Cache (prevent lint issues)
48+
run: go clean -modcache || true
49+
4750
- name: Download Dependencies
4851
run: go mod download
4952

5053
- name: Sync vendor (ensure consistent vendoring for linter)
54+
shell: bash
5155
run: |
56+
# Clean any existing vendor directory to prevent conflicts
57+
if [ -d "vendor" ]; then
58+
rm -rf vendor/
59+
fi
5260
go mod tidy
5361
go mod vendor
62+
echo "✅ Vendor directory synced successfully"
5463
5564
- name: Run golangci-lint
5665
uses: golangci/golangci-lint-action@v7
5766
with:
5867
version: ${{ env.GOLANGCI_LINT_VERSION }}
5968
args: --no-config --enable-only=errcheck,gosec,ineffassign --timeout=5m
69+
skip-pkg-cache: false
70+
skip-build-cache: false
71+
only-new-issues: false
6072

6173
- name: Check Code Formatting
6274
run: |
@@ -100,13 +112,19 @@ jobs:
100112
with:
101113
go-version: ${{ matrix.go-version }}
102114

115+
- name: Download Dependencies
116+
run: go mod download
117+
103118
- name: Sync vendor
119+
shell: bash
104120
run: |
121+
# Clean any existing vendor directory to prevent conflicts
122+
if [ -d "vendor" ]; then
123+
rm -rf vendor/
124+
fi
105125
go mod tidy
106126
go mod vendor
107-
108-
- name: Download Dependencies
109-
run: go mod download
127+
echo "✅ Vendor directory synced for ${{ matrix.os }}"
110128
111129
- name: Create Test Temp Directory
112130
shell: bash
@@ -180,6 +198,8 @@ jobs:
180198
~/go/pkg/mod
181199
~/.cache/go-build
182200
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
201+
restore-keys: |
202+
${{ runner.os }}-go-
183203
184204
- name: Build Binary
185205
env:
@@ -191,18 +211,20 @@ jobs:
191211
COMMIT=$(git rev-parse --short HEAD)
192212
BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
193213
194-
# Create dist directory
195-
mkdir -p dist
214+
# Create unique dist directory for this build
215+
DIST_DIR="dist-${{ matrix.goos }}-${{ matrix.goarch }}"
216+
rm -rf "${DIST_DIR}"
217+
mkdir -p "${DIST_DIR}"
196218
197219
# Build binary
198220
BINARY_NAME="matlas${{ matrix.ext }}"
199221
go build \
200222
-ldflags="-s -w -X main.version=${VERSION} -X main.commit=${COMMIT} -X main.buildTime=${BUILD_TIME}" \
201-
-o "dist/${BINARY_NAME}" \
223+
-o "${DIST_DIR}/${BINARY_NAME}" \
202224
.
203225
204226
# Create release archive
205-
cd dist
227+
cd "${DIST_DIR}"
206228
if [ "${{ matrix.goos }}" = "windows" ]; then
207229
zip "matlas_${{ matrix.goos }}_${{ matrix.goarch }}.zip" "${BINARY_NAME}"
208230
else
@@ -216,12 +238,12 @@ jobs:
216238
with:
217239
name: matlas-${{ matrix.os }}-${{ matrix.arch }}
218240
path: |
219-
dist/*.zip
220-
dist/*.tar.gz
241+
dist-${{ matrix.goos }}-${{ matrix.goarch }}/*.zip
242+
dist-${{ matrix.goos }}-${{ matrix.goarch }}/*.tar.gz
221243
retention-days: 90
222244

223-
create-checksums:
224-
name: 📋 Create Checksums
245+
prepare-release-assets:
246+
name: 📋 Prepare Release Assets
225247
runs-on: ubuntu-latest
226248
needs: build
227249
steps:
@@ -243,13 +265,6 @@ jobs:
243265
echo "Generated checksums:"
244266
cat checksums.txt
245267
246-
- name: Upload consolidated artifacts
247-
uses: actions/upload-artifact@v4
248-
with:
249-
name: release-artifacts
250-
path: dist/
251-
retention-days: 90
252-
253268
# ==============================================================================
254269
# Semantic Release
255270
# ==============================================================================
@@ -258,7 +273,7 @@ jobs:
258273
name: 🚀 Semantic Release
259274
runs-on: ubuntu-latest
260275
timeout-minutes: 15
261-
needs: [create-checksums]
276+
needs: [prepare-release-assets]
262277
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
263278
outputs:
264279
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
@@ -271,11 +286,19 @@ jobs:
271286
# Use a Personal Access Token to trigger other workflows if needed
272287
token: ${{ secrets.SEMANTIC_RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
273288

274-
- name: Download consolidated artifacts
289+
- name: Download all artifacts to recreate dist/
275290
uses: actions/download-artifact@v4
276291
with:
277-
name: release-artifacts
278-
path: dist/
292+
path: artifacts/
293+
294+
- name: Recreate dist directory for semantic-release
295+
run: |
296+
mkdir -p dist
297+
find artifacts/ -name "*.zip" -exec cp {} dist/ \;
298+
find artifacts/ -name "*.tar.gz" -exec cp {} dist/ \;
299+
# Generate checksums
300+
cd dist
301+
sha256sum *.zip *.tar.gz > checksums.txt || shasum -a 256 *.zip *.tar.gz > checksums.txt
279302
280303
- name: Set up Node.js
281304
uses: actions/setup-node@v4

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,7 @@ coverage.html
6565
config.local.yaml
6666
.matlas/
6767
test-reports/
68-
new_gaps.md
68+
new_gaps.md
69+
WARP.md
70+
CLAUDE.md
71+
.claude/*

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,31 @@
2121

2222
## [Unreleased]
2323

24+
### Added
25+
- New `atlas search` command group for Atlas Search index management
26+
- `matlas atlas search list` - List search indexes in cluster or collection
27+
- `matlas atlas search create` - Create new search indexes (basic implementation)
28+
- Support for both full-text search and vector search indexes
29+
- New YAML kinds: `SearchIndex` and `VPCEndpoint` for ApplyDocument support
30+
- Comprehensive examples for search and VPC endpoint configurations
31+
- Multi-cloud provider support for VPC endpoints (AWS, Azure, GCP)
32+
33+
### Fixed
34+
- **VPC Endpoints YAML Project ID Resolution**: Fixed critical project ID parsing error where VPCEndpoint YAML configurations weren't being processed for project resolution, causing all YAML operations to fail with "project '' not found in organization" error
35+
- **VPC Endpoints Multi-Provider Deletion**: Fixed cloud provider mismatch where all deletion operations were hardcoded to use AWS provider, causing GCP and Azure endpoints to fail deletion and creating resource leaks
36+
- **VPC Endpoints Test Verification Logic**: Fixed verification logic that searched for non-existent YAML metadata names in Atlas API responses, replacing with actual endpoint count and cloud provider validation
37+
- Enhanced project ID parsing support for DatabaseUser, NetworkAccess, and Cluster resources in YAML configurations
38+
- Improved VPC endpoints test infrastructure with proper timing mechanisms for Atlas backend processing delays
39+
- Added robust resource cleanup procedures with dynamic cloud provider extraction
40+
41+
### Changed
42+
- Updated documentation with Atlas Search and VPC endpoint examples
43+
- Added support for Atlas Search APIs in SDK v20250312005
44+
- VPC endpoints testing infrastructure now uses Atlas API-compatible verification methods
45+
- Enhanced test scripts with comprehensive multi-provider cleanup and verification logic
46+
2447
### Fixed
48+
- Updated release process documentation to accurately reflect the consolidated workflow implementation
2549
- Fixed semantic-release not detecting conventional commits by consolidating workflows
2650
- Completely redesigned release process following current best practices
2751
- Consolidated CI/CD, testing, building, and releasing into single workflow

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,13 @@ generate-mocks:
7171
install-hooks:
7272
mkdir -p .git/hooks
7373
cp scripts/pre-commit .git/hooks/pre-commit
74-
chmod +x .git/hooks/pre-commit
74+
chmod +x .git/hooks/pre-commit
75+
76+
install:
77+
./install.sh
78+
79+
install-user:
80+
MATLAS_INSTALL_DIR=~/.local/bin ./install.sh
81+
82+
uninstall:
83+
./uninstall.sh

0 commit comments

Comments
 (0)