- docker-compose services now pull from localhost:5000 instead of building locally - build-push.sh builds + pushes all 5 Node images to local registry - CI workflows get build-push job: test → build → push → deploy - Deploy becomes: docker compose pull && docker compose up -d - Eliminates silent git pull + stale Docker cache issues
69 lines
2.2 KiB
YAML
69 lines
2.2 KiB
YAML
name: CI — P2 Drift (Go + Node)
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths: ['products/02-iac-drift-detection/**']
|
|
pull_request:
|
|
paths: ['products/02-iac-drift-detection/**']
|
|
|
|
jobs:
|
|
agent:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
git clone --depth=1 http://192.168.86.11:3005/jarvis/dd0c.git $GITHUB_WORKSPACE || true
|
|
|
|
- name: Install Go
|
|
run: |
|
|
if ! command -v go &>/dev/null; then
|
|
mkdir -p $HOME/go-sdk
|
|
curl -sL https://go.dev/dl/go1.22.12.linux-amd64.tar.gz | tar -C $HOME/go-sdk --strip-components=1 -xzf -
|
|
fi
|
|
export PATH="$HOME/go-sdk/bin:$PATH"
|
|
go version
|
|
|
|
- name: Test agent
|
|
run: |
|
|
export PATH="$HOME/go-sdk/bin:$HOME/go/bin:$PATH"
|
|
cd $GITHUB_WORKSPACE/products/02-iac-drift-detection/agent && go mod download && go mod tidy && go test ./...
|
|
|
|
- name: Vet
|
|
run: |
|
|
export PATH="$HOME/go-sdk/bin:$HOME/go/bin:$PATH"
|
|
cd $GITHUB_WORKSPACE/products/02-iac-drift-detection/agent && go vet ./...
|
|
|
|
saas:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
git clone --depth=1 http://192.168.86.11:3005/jarvis/dd0c.git $GITHUB_WORKSPACE || true
|
|
|
|
- name: Install deps
|
|
run: cd $GITHUB_WORKSPACE/products/02-iac-drift-detection/saas && npm ci --include=dev
|
|
|
|
- name: Type check
|
|
run: cd $GITHUB_WORKSPACE/products/02-iac-drift-detection/saas && ./node_modules/.bin/tsc --noEmit
|
|
|
|
- name: Test
|
|
run: cd $GITHUB_WORKSPACE/products/02-iac-drift-detection/saas && npm test
|
|
|
|
build-push:
|
|
runs-on: ubuntu-latest
|
|
needs: test
|
|
if: github.ref == 'refs/heads/main'
|
|
steps:
|
|
- name: Checkout
|
|
run: git clone --depth=1 http://192.168.86.11:3005/jarvis/dd0c.git $GITHUB_WORKSPACE || true
|
|
- name: Build and push
|
|
run: |
|
|
cd $GITHUB_WORKSPACE/products
|
|
docker build -t localhost:5000/dd0c-drift:latest ./02-iac-drift-detection/saas
|
|
docker push localhost:5000/dd0c-drift:latest
|
|
- name: Deploy
|
|
run: |
|
|
cd $GITHUB_WORKSPACE/products
|
|
docker compose pull drift
|
|
docker compose up -d drift
|