$ git push origin main
Enumerating objects: 14, done.
Writing objects: 100% (14/14), 3.21 KiB | done.
[✓] Triggered pipeline run #312
▶ Stage: checkout
Cloning repository...
Branch: main Commit: a4f9c2e
[✓] Checkout complete (1.2s)
▶ Stage: dependencies
go mod download
All modules verified.
[✓] Dependencies ready (4.8s)
▶ Stage: lint
golangci-lint run ./...
[✓] No issues found
▶ Stage: test
go test ./... -race -cover
ok api/handlers 0.312s coverage: 89.4%
ok api/services 0.201s coverage: 93.1%
ok api/models 0.089s coverage: 96.2%
[✓] 137 tests passed 0 failed (3.1s)
▶ Stage: build
docker build -t api-service:v2.4.1 .
Step 1/10 : FROM golang:1.21-alpine
Step 5/10 : RUN go build -ldflags='-s -w' -o main
Step 10/10 : EXPOSE 8080
Successfully built e4f8a2c91d3b
[✓] Image built (42s)
▶ Stage: security-scan
trivy image api-service:v2.4.1
2024-01-15T09:23:51Z Scanning...
semgrep --config=p/owasp-top-ten .
gitleaks detect --source .
snyk test --severity-threshold=high
[✓] No critical vulnerabilities (18s)
▶ Stage: push
docker push 123456.dkr.ecr.us-east-1.amazonaws.com/api:v2.4.1
v2.4.1: digest: sha256:e4f8a2c9... size: 1847
[✓] Pushed to ECR (8s)
▶ Stage: deploy → staging
kubectl apply -f k8s/staging/
deployment.apps/api-service configured
Waiting for rollout... 0/3 ready
Waiting for rollout... 1/3 ready
Waiting for rollout... 3/3 ready
[✓] Staging rollout complete (24s)
▶ Stage: integration-tests
pytest tests/integration/ -v
PASSED test_health_check
PASSED test_auth_flow
PASSED test_api_endpoints[24/24]
[✓] All integration tests passed (31s)
▶ Stage: deploy → production
kubectl apply -f k8s/production/
Rolling update: api-service 3 replicas
api-service-78d9f-xkp Running node-01
api-service-78d9f-mnq Running node-02
api-service-78d9f-pzr Running node-03
[✓] Production rollout complete (19s)
▶ Stage: verify
curl -s https://api.prod/health
{"status":"healthy","version":"v2.4.1","uptime":4}
[✓] Health check passed
══════════════════════════════════════════
[✓] Pipeline #312 PASSED 3m 41s
══════════════════════════════════════════
$ kubectl get pods -n production
NAME READY STATUS AGE
api-service-78d9f-xkp 1/1 Running 2m
api-service-78d9f-mnq 1/1 Running 2m
api-service-78d9f-pzr 1/1 Running 2m
$ terraform plan -out=tfplan
Refreshing state... aws_vpc.main
Refreshing state... aws_subnet.private[0]
Plan: 2 to add, 1 to change, 0 to destroy.
$ ansible-playbook -i inventory/prod deploy.yml
PLAY [webservers] *****************************
TASK [Pull latest image] **********************
changed: [web-01.prod.internal]
changed: [web-02.prod.internal]
PLAY RECAP ok=6 changed=2 unreachable=0
INFO CloudWatch: CPU avg 14% Mem 41%
INFO Prometheus: all scrape targets UP
INFO Grafana: 0 active alerts
INFO New Relic: Apdex 0.98 Error rate 0.01%
$ git push origin main
Enumerating objects: 14, done.
Writing objects: 100% (14/14), 3.21 KiB | done.
[✓] Triggered pipeline run #312
▶ Stage: checkout
Cloning repository...
Branch: main Commit: a4f9c2e
[✓] Checkout complete (1.2s)
▶ Stage: dependencies
go mod download
All modules verified.
[✓] Dependencies ready (4.8s)
▶ Stage: lint
golangci-lint run ./...
[✓] No issues found
▶ Stage: test
go test ./... -race -cover
ok api/handlers 0.312s coverage: 89.4%
ok api/services 0.201s coverage: 93.1%
ok api/models 0.089s coverage: 96.2%
[✓] 137 tests passed 0 failed (3.1s)
▶ Stage: build
docker build -t api-service:v2.4.1 .
Step 1/10 : FROM golang:1.21-alpine
Step 5/10 : RUN go build -ldflags='-s -w' -o main
Step 10/10 : EXPOSE 8080
Successfully built e4f8a2c91d3b
[✓] Image built (42s)
▶ Stage: security-scan
trivy image api-service:v2.4.1
2024-01-15T09:23:51Z Scanning...
semgrep --config=p/owasp-top-ten .
gitleaks detect --source .
snyk test --severity-threshold=high
[✓] No critical vulnerabilities (18s)
▶ Stage: push
docker push 123456.dkr.ecr.us-east-1.amazonaws.com/api:v2.4.1
v2.4.1: digest: sha256:e4f8a2c9... size: 1847
[✓] Pushed to ECR (8s)
▶ Stage: deploy → staging
kubectl apply -f k8s/staging/
deployment.apps/api-service configured
Waiting for rollout... 0/3 ready
Waiting for rollout... 1/3 ready
Waiting for rollout... 3/3 ready
[✓] Staging rollout complete (24s)
▶ Stage: integration-tests
pytest tests/integration/ -v
PASSED test_health_check
PASSED test_auth_flow
PASSED test_api_endpoints[24/24]
[✓] All integration tests passed (31s)
▶ Stage: deploy → production
kubectl apply -f k8s/production/
Rolling update: api-service 3 replicas
api-service-78d9f-xkp Running node-01
api-service-78d9f-mnq Running node-02
api-service-78d9f-pzr Running node-03
[✓] Production rollout complete (19s)
▶ Stage: verify
curl -s https://api.prod/health
{"status":"healthy","version":"v2.4.1","uptime":4}
[✓] Health check passed
══════════════════════════════════════════
[✓] Pipeline #312 PASSED 3m 41s
══════════════════════════════════════════
$ kubectl get pods -n production
NAME READY STATUS AGE
api-service-78d9f-xkp 1/1 Running 2m
api-service-78d9f-mnq 1/1 Running 2m
api-service-78d9f-pzr 1/1 Running 2m
$ terraform plan -out=tfplan
Refreshing state... aws_vpc.main
Refreshing state... aws_subnet.private[0]
Plan: 2 to add, 1 to change, 0 to destroy.
$ ansible-playbook -i inventory/prod deploy.yml
PLAY [webservers] *****************************
TASK [Pull latest image] **********************
changed: [web-01.prod.internal]
changed: [web-02.prod.internal]
PLAY RECAP ok=6 changed=2 unreachable=0
INFO CloudWatch: CPU avg 14% Mem 41%
INFO Prometheus: all scrape targets UP
INFO Grafana: 0 active alerts
INFO New Relic: Apdex 0.98 Error rate 0.01%