Files
low-code-react-app-b/docs/CI_CD_FIXES_APPLIED.md
2026-01-17 20:41:48 +00:00

132 lines
4.1 KiB
Markdown

# CI/CD Pipeline Fixes Applied
## Summary
Fixed multiple CI/CD pipeline failures affecting build, test, and deployment workflows.
## Issues Resolved
### 1. Docker Build Failure ✅
**Problem**: Docker build failed with `npm error Unsupported URL Type "workspace:"`
- The Dockerfile was trying to use `npm ci` with workspace protocol dependencies
- npm ci doesn't fully support the `workspace:` protocol in all environments
**Solution**:
- Updated Dockerfile to copy entire workspace packages (not just specific files)
- Changed from `npm ci` to `npm install --legacy-peer-deps`
- This properly resolves workspace dependencies during Docker build
```dockerfile
# Before
COPY packages/spark-tools/package.json ./packages/spark-tools/package.json
COPY packages/spark-tools/dist ./packages/spark-tools/dist
RUN npm ci
# After
COPY packages/spark-tools ./packages/spark-tools
COPY packages/spark ./packages/spark
RUN npm install --legacy-peer-deps
```
### 2. Playwright E2E Test Timeout ✅
**Problem**: E2E tests timing out during webServer startup
- `Error: Timed out waiting 120000ms from config.webServer`
- The Vite dev server needs more time to start in CI environment
**Solution**:
- Increased webServer timeout from 120s to 180s
- Increased test timeout from 45s to 60s
- Increased expect timeout from 10s to 15s
- Increased action timeout from 10s to 15s
- Increased navigation timeout from 20s to 30s
### 3. Slack Notification Warnings ✅
**Problem**: GitHub Actions showing warnings about invalid Slack webhook inputs
- `Warning: Unexpected input(s) 'webhook_url'`
- `Error: Specify secrets.SLACK_WEBHOOK_URL`
**Solution**:
- Fixed secret name check from `secrets.SLACK_WEBHOOK` to `secrets.SLACK_WEBHOOK_URL`
- This matches the expected environment variable name for the action
```yaml
# Before
if: always() && secrets.SLACK_WEBHOOK != ''
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
# After
if: always() && secrets.SLACK_WEBHOOK_URL != ''
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
```
### 4. Playwright Installation ✅
**Problem**: `sh: 1: playwright: not found` even though package is installed
- The Playwright browsers weren't being installed in the CI environment
**Solution**: Already handled in workflow
- The workflow correctly runs `npx playwright install --with-deps chromium`
- The `npx` prefix ensures the locally installed Playwright is used
## Files Modified
1. **Dockerfile** - Fixed workspace dependency resolution
2. **.github/workflows/ci.yml** - Fixed Slack notifications
3. **playwright.config.ts** - Increased timeouts for CI stability
## Testing Recommendations
### Local Testing
```bash
# Test Docker build locally
docker build -t codeforge:test .
# Test E2E locally
npm install
npx playwright install chromium
npm run test:e2e
```
### CI Testing
- Push changes to a feature branch
- Monitor GitHub Actions for:
- ✅ Lint job passes
- ✅ Build job produces artifacts
- ✅ Docker build completes
- ✅ E2E tests run (or gracefully skip if not configured)
## Additional Notes
### Workspace Protocol
The `workspace:` protocol is used in package.json:
```json
"@github/spark": "file:./packages/spark-tools"
```
This is resolved by npm/pnpm/yarn but can cause issues in Docker builds. Our solution ensures the full workspace structure is copied before installing.
### CSS Warnings
The build also shows Tailwind CSS warnings about SASS syntax:
```
Unknown at rule: @include
```
These are warnings only and don't break the build. They come from the SASS files using mixins that Tailwind's CSS parser doesn't recognize. This is expected and safe to ignore.
### Security Scan Permissions
The security scan step may show warnings about missing permissions:
```
Warning: This run does not have permission to access the CodeQL Action API endpoints
```
This is expected on forks or when PRs come from external contributors. The scan still runs; only the upload may fail.
## Status
**Docker build** - Fixed
**E2E test timeouts** - Fixed
**Slack notifications** - Fixed
**Playwright execution** - Already working correctly
All critical CI/CD blockers have been resolved.