feature/user-authentication-bdd #9
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
## Context and Problem Statement
|
## Context and Problem Statement
|
||||||
|
|
||||||
We needed to choose a Go version for the DanceLessonsCoach project that provides:
|
We needed to choose a Go version for the dance-lessons-coach project that provides:
|
||||||
- Stability and long-term support
|
- Stability and long-term support
|
||||||
- Access to modern language features
|
- Access to modern language features
|
||||||
- Good ecosystem compatibility
|
- Good ecosystem compatibility
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
## Context and Problem Statement
|
## Context and Problem Statement
|
||||||
|
|
||||||
We needed to choose an HTTP router for the DanceLessonsCoach web service that provides:
|
We needed to choose an HTTP router for the dance-lessons-coach web service that provides:
|
||||||
- Good performance characteristics
|
- Good performance characteristics
|
||||||
- Flexible routing capabilities
|
- Flexible routing capabilities
|
||||||
- Middleware support
|
- Middleware support
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
## Context and Problem Statement
|
## Context and Problem Statement
|
||||||
|
|
||||||
We needed to choose a logging library for DanceLessonsCoach that provides:
|
We needed to choose a logging library for dance-lessons-coach that provides:
|
||||||
- High performance with minimal overhead
|
- High performance with minimal overhead
|
||||||
- Structured logging capabilities
|
- Structured logging capabilities
|
||||||
- Multiple output formats (console, JSON)
|
- Multiple output formats (console, JSON)
|
||||||
@@ -94,7 +94,7 @@ Chosen option: "Zerolog" because it provides excellent performance, clean API, g
|
|||||||
| With fields | 3 alloc | 4 alloc |
|
| With fields | 3 alloc | 4 alloc |
|
||||||
| Complex | 5 alloc | 6 alloc |
|
| Complex | 5 alloc | 6 alloc |
|
||||||
|
|
||||||
### Real-World Impact for DanceLessonsCoach
|
### Real-World Impact for dance-lessons-coach
|
||||||
|
|
||||||
* **Performance**: <1μs difference per request - negligible impact
|
* **Performance**: <1μs difference per request - negligible impact
|
||||||
* **Memory**: Zerolog's better allocation profile helps in long-running services
|
* **Memory**: Zerolog's better allocation profile helps in long-running services
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
## Context and Problem Statement
|
## Context and Problem Statement
|
||||||
|
|
||||||
We needed to choose a design pattern for DanceLessonsCoach that provides:
|
We needed to choose a design pattern for dance-lessons-coach that provides:
|
||||||
- Good testability and mocking capabilities
|
- Good testability and mocking capabilities
|
||||||
- Flexibility for future changes
|
- Flexibility for future changes
|
||||||
- Clear separation of concerns
|
- Clear separation of concerns
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
## Context and Problem Statement
|
## Context and Problem Statement
|
||||||
|
|
||||||
We needed to implement a shutdown mechanism for DanceLessonsCoach that provides:
|
We needed to implement a shutdown mechanism for dance-lessons-coach that provides:
|
||||||
- Clean resource cleanup
|
- Clean resource cleanup
|
||||||
- Proper handling of in-flight requests
|
- Proper handling of in-flight requests
|
||||||
- Kubernetes/service mesh compatibility
|
- Kubernetes/service mesh compatibility
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
## Context and Problem Statement
|
## Context and Problem Statement
|
||||||
|
|
||||||
We needed a configuration management solution for DanceLessonsCoach that provides:
|
We needed a configuration management solution for dance-lessons-coach that provides:
|
||||||
- Support for multiple configuration sources (files, environment variables, defaults)
|
- Support for multiple configuration sources (files, environment variables, defaults)
|
||||||
- Configuration validation
|
- Configuration validation
|
||||||
- Type-safe configuration loading
|
- Type-safe configuration loading
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
## Context and Problem Statement
|
## Context and Problem Statement
|
||||||
|
|
||||||
We needed to add observability to DanceLessonsCoach that provides:
|
We needed to add observability to dance-lessons-coach that provides:
|
||||||
- Distributed tracing capabilities
|
- Distributed tracing capabilities
|
||||||
- Performance monitoring
|
- Performance monitoring
|
||||||
- Request flow visualization
|
- Request flow visualization
|
||||||
@@ -105,7 +105,7 @@ func (s *Server) getAllMiddlewares() []func(http.Handler) http.Handler {
|
|||||||
telemetry:
|
telemetry:
|
||||||
enabled: true
|
enabled: true
|
||||||
otlp_endpoint: "localhost:4317"
|
otlp_endpoint: "localhost:4317"
|
||||||
service_name: "DanceLessonsCoach"
|
service_name: "dance-lessons-coach"
|
||||||
insecure: true
|
insecure: true
|
||||||
sampler:
|
sampler:
|
||||||
type: "parentbased_always_on"
|
type: "parentbased_always_on"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
## Context and Problem Statement
|
## Context and Problem Statement
|
||||||
|
|
||||||
We needed to add behavioral testing to DanceLessonsCoach that provides:
|
We needed to add behavioral testing to dance-lessons-coach that provides:
|
||||||
- User-centric test scenarios
|
- User-centric test scenarios
|
||||||
- Living documentation
|
- Living documentation
|
||||||
- Integration testing capabilities
|
- Integration testing capabilities
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
## Context and Problem Statement
|
## Context and Problem Statement
|
||||||
|
|
||||||
We need to establish a comprehensive testing strategy for DanceLessonsCoach that provides:
|
We need to establish a comprehensive testing strategy for dance-lessons-coach that provides:
|
||||||
- Behavioral verification through BDD
|
- Behavioral verification through BDD
|
||||||
- API documentation through Swagger/OpenAPI
|
- API documentation through Swagger/OpenAPI
|
||||||
- Client SDK validation
|
- Client SDK validation
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
## Context
|
## Context
|
||||||
|
|
||||||
The DanceLessonsCoach application needed to add a new API version (v2) that provides different greeting behavior while maintaining backward compatibility with the existing v1 API. The v2 API should only be available when explicitly enabled via a feature flag.
|
The dance-lessons-coach application needed to add a new API version (v2) that provides different greeting behavior while maintaining backward compatibility with the existing v1 API. The v2 API should only be available when explicitly enabled via a feature flag.
|
||||||
|
|
||||||
## Decision
|
## Decision
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
## Context
|
## Context
|
||||||
|
|
||||||
The DanceLessonsCoach project implemented Git hooks to automatically run `go fmt` and `go mod tidy` before commits. Initially, the `go fmt` hook was configured to format **all Go files** in the repository, regardless of their staged status.
|
The dance-lessons-coach project implemented Git hooks to automatically run `go fmt` and `go mod tidy` before commits. Initially, the `go fmt` hook was configured to format **all Go files** in the repository, regardless of their staged status.
|
||||||
|
|
||||||
During implementation review, concerns were raised about this approach:
|
During implementation review, concerns were raised about this approach:
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
## Context
|
## Context
|
||||||
|
|
||||||
The DanceLessonsCoach project requires comprehensive API documentation and testing capabilities. As the API evolves with v1 and v2 endpoints, we need a robust OpenAPI/Swagger toolchain to:
|
The dance-lessons-coach project requires comprehensive API documentation and testing capabilities. As the API evolves with v1 and v2 endpoints, we need a robust OpenAPI/Swagger toolchain to:
|
||||||
|
|
||||||
1. **Document APIs**: Generate interactive API documentation
|
1. **Document APIs**: Generate interactive API documentation
|
||||||
2. **Test APIs**: Enable automated API testing
|
2. **Test APIs**: Enable automated API testing
|
||||||
@@ -166,9 +166,9 @@ import (
|
|||||||
// Chi adapter would be needed
|
// Chi adapter would be needed
|
||||||
)
|
)
|
||||||
|
|
||||||
// @title DanceLessonsCoach API
|
// @title dance-lessons-coach API
|
||||||
// @version 1.0
|
// @version 1.0
|
||||||
// @description API for DanceLessonsCoach service
|
// @description API for dance-lessons-coach service
|
||||||
// @host localhost:8080
|
// @host localhost:8080
|
||||||
// @BasePath /api
|
// @BasePath /api
|
||||||
func main() {
|
func main() {
|
||||||
@@ -328,9 +328,9 @@ After thorough evaluation and implementation, we've successfully integrated swag
|
|||||||
go install github.com/swaggo/swag/cmd/swag@latest
|
go install github.com/swaggo/swag/cmd/swag@latest
|
||||||
|
|
||||||
# 2. Add swagger metadata to main.go
|
# 2. Add swagger metadata to main.go
|
||||||
// @title DanceLessonsCoach API
|
// @title dance-lessons-coach API
|
||||||
// @version 1.0
|
// @version 1.0
|
||||||
// @description API for DanceLessonsCoach service
|
// @description API for dance-lessons-coach service
|
||||||
// @host localhost:8080
|
// @host localhost:8080
|
||||||
// @BasePath /api
|
// @BasePath /api
|
||||||
package main
|
package main
|
||||||
@@ -390,9 +390,9 @@ swag fmt
|
|||||||
go install github.com/swaggo/swag/cmd/swag@latest
|
go install github.com/swaggo/swag/cmd/swag@latest
|
||||||
|
|
||||||
# 2. Add swagger metadata to main.go
|
# 2. Add swagger metadata to main.go
|
||||||
// @title DanceLessonsCoach API
|
// @title dance-lessons-coach API
|
||||||
// @version 1.0
|
// @version 1.0
|
||||||
// @description API for DanceLessonsCoach service
|
// @description API for dance-lessons-coach service
|
||||||
// @host localhost:8080
|
// @host localhost:8080
|
||||||
// @BasePath /api
|
// @BasePath /api
|
||||||
package main
|
package main
|
||||||
@@ -525,7 +525,7 @@ s.router.Get("/swagger/*", httpSwagger.WrapHandler)
|
|||||||
# 2. Create OpenAPI spec (openapi.yaml)
|
# 2. Create OpenAPI spec (openapi.yaml)
|
||||||
# openapi: 3.0.3
|
# openapi: 3.0.3
|
||||||
# info:
|
# info:
|
||||||
# title: DanceLessonsCoach API
|
# title: dance-lessons-coach API
|
||||||
# version: 1.0.0
|
# version: 1.0.0
|
||||||
|
|
||||||
# 3. Generate server types
|
# 3. Generate server types
|
||||||
@@ -654,9 +654,9 @@ go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@latest
|
|||||||
# 2. Create OpenAPI spec (openapi.yaml)
|
# 2. Create OpenAPI spec (openapi.yaml)
|
||||||
openapi: 3.0.3
|
openapi: 3.0.3
|
||||||
info:
|
info:
|
||||||
title: DanceLessonsCoach API
|
title: dance-lessons-coach API
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
description: API for DanceLessonsCoach service
|
description: API for dance-lessons-coach service
|
||||||
servers:
|
servers:
|
||||||
- url: http://localhost:8080/api
|
- url: http://localhost:8080/api
|
||||||
description: Development server
|
description: Development server
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
## Context
|
## Context
|
||||||
|
|
||||||
As DanceLessonsCoach grows, we need a more robust and maintainable CLI structure. Currently, we use simple flag parsing (`--version`), but this approach has limitations:
|
As dance-lessons-coach grows, we need a more robust and maintainable CLI structure. Currently, we use simple flag parsing (`--version`), but this approach has limitations:
|
||||||
|
|
||||||
1. **Limited scalability**: Adding more commands/flags becomes messy
|
1. **Limited scalability**: Adding more commands/flags becomes messy
|
||||||
2. **Poor user experience**: No built-in help, completion, or validation
|
2. **Poor user experience**: No built-in help, completion, or validation
|
||||||
@@ -51,10 +51,10 @@ We will adopt **Cobra** as our CLI framework. Cobra is a mature, widely-used lib
|
|||||||
```go
|
```go
|
||||||
var rootCmd = &cobra.Command{
|
var rootCmd = &cobra.Command{
|
||||||
Use: "dance-lessons-coach",
|
Use: "dance-lessons-coach",
|
||||||
Short: "DanceLessonsCoach - API server and CLI tools",
|
Short: "dance-lessons-coach - API server and CLI tools",
|
||||||
Long: `DanceLessonsCoach provides greeting services and API management.
|
Long: `dance-lessons-coach provides greeting services and API management.
|
||||||
|
|
||||||
To begin working with DanceLessonsCoach, run:
|
To begin working with dance-lessons-coach, run:
|
||||||
dance-lessons-coach server --help`,
|
dance-lessons-coach server --help`,
|
||||||
SilenceUsage: true,
|
SilenceUsage: true,
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ var versionCmd = &cobra.Command{
|
|||||||
|
|
||||||
var serverCmd = &cobra.Command{
|
var serverCmd = &cobra.Command{
|
||||||
Use: "server",
|
Use: "server",
|
||||||
Short: "Start the DanceLessonsCoach server",
|
Short: "Start the dance-lessons-coach server",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
// Load config and start server
|
// Load config and start server
|
||||||
cfg, err := config.LoadConfig()
|
cfg, err := config.LoadConfig()
|
||||||
@@ -116,7 +116,7 @@ func main() {
|
|||||||
|
|
||||||
**Current Commands:**
|
**Current Commands:**
|
||||||
- `version`: Print version information
|
- `version`: Print version information
|
||||||
- `server`: Start the DanceLessonsCoach server
|
- `server`: Start the dance-lessons-coach server
|
||||||
- `greet [name]`: Greet someone by name
|
- `greet [name]`: Greet someone by name
|
||||||
- `help`: Built-in help system
|
- `help`: Built-in help system
|
||||||
- `completion`: Shell completion scripts (automatic)
|
- `completion`: Shell completion scripts (automatic)
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
# 16. CI/CD Pipeline Design for Multi-Platform Compatibility
|
# 16. CI/CD Pipeline Design for Multi-Platform Compatibility
|
||||||
|
|
||||||
**Date:** 2026-04-05
|
**Date:** 2026-04-05
|
||||||
**Status:** 🟡 Proposed
|
**Status:** ✅ Accepted
|
||||||
**Authors:** Arcodange Team
|
**Authors:** Arcodange Team
|
||||||
**Decision Date:** TBD
|
**Decision Date:** 2026-04-08
|
||||||
**Implementation Status:** Not Started
|
**Implementation Status:** ✅ Completed
|
||||||
|
|
||||||
## Context
|
## Context
|
||||||
|
|
||||||
DanceLessonsCoach requires a robust CI/CD pipeline that:
|
dance-lessons-coach requires a robust CI/CD pipeline that:
|
||||||
|
|
||||||
1. **Primary Platform**: Gitea (self-hosted Git service)
|
1. **Primary Platform**: Gitea (self-hosted Git service)
|
||||||
2. **Mirror Support**: GitHub and GitLab mirrors for visibility and backup
|
2. **Mirror Support**: GitHub and GitLab mirrors for visibility and backup
|
||||||
@@ -69,7 +69,7 @@ graph TD
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# .github/workflows/main.yml
|
# .github/workflows/main.yml
|
||||||
name: DanceLessonsCoach CI/CD
|
name: dance-lessons-coach CI/CD
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -140,10 +140,10 @@ jobs:
|
|||||||
# README.md
|
# README.md
|
||||||
|
|
||||||
[](https://ci.dancelessonscoach.org)
|
[](https://ci.dancelessonscoach.org)
|
||||||
[](https://github.com/yourorg/DanceLessonsCoach/actions)
|
[](https://github.com/yourorg/dance-lessons-coach/actions)
|
||||||
[](https://gitlab.com/yourorg/DanceLessonsCoach/-/pipelines)
|
[](https://gitlab.com/yourorg/dance-lessons-coach/-/pipelines)
|
||||||
[](https://goreportcard.com/report/github.com/yourorg/DanceLessonsCoach)
|
[](https://goreportcard.com/report/github.com/yourorg/dance-lessons-coach)
|
||||||
[](https://codecov.io/gh/yourorg/DanceLessonsCoach)
|
[](https://codecov.io/gh/yourorg/dance-lessons-coach)
|
||||||
```
|
```
|
||||||
|
|
||||||
### 5. Mirror Synchronization Strategy
|
### 5. Mirror Synchronization Strategy
|
||||||
@@ -170,7 +170,7 @@ mkdir -p .gitea/workflows
|
|||||||
|
|
||||||
# 2. Create main workflow file with Arcodange-specific configuration
|
# 2. Create main workflow file with Arcodange-specific configuration
|
||||||
cat > .gitea/workflows/ci-cd.yaml << 'EOF'
|
cat > .gitea/workflows/ci-cd.yaml << 'EOF'
|
||||||
name: DanceLessonsCoach CI/CD
|
name: dance-lessons-coach CI/CD
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -200,41 +200,41 @@ jobs:
|
|||||||
- name: Notify internal systems
|
- name: Notify internal systems
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
curl -X POST "$GITEA_INTERNAL/api/v1/repos/yourorg/DanceLessonsCoach/statuses/$(git rev-parse HEAD)" \
|
curl -X POST "$GITEA_INTERNAL/api/v1/repos/yourorg/dance-lessons-coach/statuses/$(git rev-parse HEAD)" \
|
||||||
-H "Authorization: token $GITEA_TOKEN" \
|
-H "Authorization: token $GITEA_TOKEN" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{\"state\": \"$([ $? -eq 0 ] && echo 'success' || echo 'failure')\", \"context\": \"ci/build-test\"}"
|
-d "{\"state\": \"$([ $? -eq 0 ] && echo 'success' || echo 'failure')\", \"context\": \"ci/build-test\"}"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# 3. Enable Gitea CI/CD in repo settings (Arcodange instance)
|
# 3. Enable Gitea CI/CD in repo settings (Arcodange instance)
|
||||||
# - Go to: https://gitea.arcodange.lab/arcodange/DanceLessonsCoach/settings/actions
|
# - Go to: https://gitea.arcodange.lab/arcodange/dance-lessons-coach/settings/actions
|
||||||
# - Enable GitHub Actions
|
# - Enable GitHub Actions
|
||||||
# - Configure runner to use internal network (192.168.1.202)
|
# - Configure runner to use internal network (192.168.1.202)
|
||||||
# - Set up GITEA_TOKEN for API access
|
# - Set up GITEA_TOKEN for API access
|
||||||
# - SSH URL: ssh://git@192.168.1.202:2222/arcodange/DanceLessonsCoach.git
|
# - SSH URL: ssh://git@192.168.1.202:2222/arcodange/dance-lessons-coach.git
|
||||||
|
|
||||||
# 4. Add STATUS_BADGES.md with Arcodange-specific URLs
|
# 4. Add STATUS_BADGES.md with Arcodange-specific URLs
|
||||||
cat > STATUS_BADGES.md << 'EOF'
|
cat > STATUS_BADGES.md << 'EOF'
|
||||||
## Arcodange Gitea Badges
|
## Arcodange Gitea Badges
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
[](https://gitea.arcodange.fr/arcodange/DanceLessonsCoach)
|
[](https://gitea.arcodange.fr/arcodange/dance-lessons-coach)
|
||||||
[](https://gitea.arcodange.fr/arcodange/DanceLessonsCoach/-/pipelines)
|
[](https://gitea.arcodange.fr/arcodange/dance-lessons-coach/-/pipelines)
|
||||||
```
|
```
|
||||||
|
|
||||||
**Configuration Details:**
|
**Configuration Details:**
|
||||||
- Organization: arcodange
|
- Organization: arcodange
|
||||||
- Repository: DanceLessonsCoach
|
- Repository: dance-lessons-coach
|
||||||
- Internal URL: https://gitea.arcodange.lab/
|
- Internal URL: https://gitea.arcodange.lab/
|
||||||
- External URL: https://gitea.arcodange.fr/
|
- External URL: https://gitea.arcodange.fr/
|
||||||
- SSH URL: ssh://git@192.168.1.202:2222/arcodange/DanceLessonsCoach.git
|
- SSH URL: ssh://git@192.168.1.202:2222/arcodange/dance-lessons-coach.git
|
||||||
- Badges use external URL with full org/repo path
|
- Badges use external URL with full org/repo path
|
||||||
- CI/CD uses internal URL for faster network access
|
- CI/CD uses internal URL for faster network access
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# 5. Configure CI/CD runners on internal network
|
# 5. Configure CI/CD runners on internal network
|
||||||
# - Set up runners to access: https://gitea.arcodange.lab/
|
# - Set up runners to access: https://gitea.arcodange.lab/
|
||||||
# - Configure SSH access: ssh://git@192.168.1.202:2222/arcodange/DanceLessonsCoach.git
|
# - Configure SSH access: ssh://git@192.168.1.202:2222/arcodange/dance-lessons-coach.git
|
||||||
# - Ensure runners have network access to internal services (192.168.1.202:2222)
|
# - Ensure runners have network access to internal services (192.168.1.202:2222)
|
||||||
# - Configure runners with proper GITEA_TOKEN
|
# - Configure runners with proper GITEA_TOKEN
|
||||||
# - Test connection: curl https://gitea.arcodange.lab/api/v1/version
|
# - Test connection: curl https://gitea.arcodange.lab/api/v1/version
|
||||||
@@ -332,18 +332,18 @@ cat > STATUS_BADGES.md << 'EOF'
|
|||||||
|
|
||||||
## GitHub Mirror
|
## GitHub Mirror
|
||||||
```markdown
|
```markdown
|
||||||
[](https://github.com/yourorg/DanceLessonsCoach/actions)
|
[](https://github.com/yourorg/dance-lessons-coach/actions)
|
||||||
```
|
```
|
||||||
|
|
||||||
## GitLab Mirror
|
## GitLab Mirror
|
||||||
```markdown
|
```markdown
|
||||||
[](https://gitlab.com/yourorg/DanceLessonsCoach/-/pipelines)
|
[](https://gitlab.com/yourorg/dance-lessons-coach/-/pipelines)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Code Quality
|
## Code Quality
|
||||||
```markdown
|
```markdown
|
||||||
[](https://goreportcard.com/report/github.com/yourorg/DanceLessonsCoach)
|
[](https://goreportcard.com/report/github.com/yourorg/dance-lessons-coach)
|
||||||
[](https://codecov.io/gh/yourorg/DanceLessonsCoach)
|
[](https://codecov.io/gh/yourorg/dance-lessons-coach)
|
||||||
```
|
```
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
@@ -452,7 +452,7 @@ docker run --rm \
|
|||||||
-e GITEA_INTERNAL="https://gitea.arcodange.lab/" \
|
-e GITEA_INTERNAL="https://gitea.arcodange.lab/" \
|
||||||
-e GITEA_EXTERNAL="https://gitea.arcodange.fr/" \
|
-e GITEA_EXTERNAL="https://gitea.arcodange.fr/" \
|
||||||
-e GITEA_ORG="arcodange" \
|
-e GITEA_ORG="arcodange" \
|
||||||
-e GITEA_REPO="DanceLessonsCoach" \
|
-e GITEA_REPO="dance-lessons-coach" \
|
||||||
gitea/act_runner:latest \
|
gitea/act_runner:latest \
|
||||||
act -W .gitea/workflows/ci-cd.yaml --rm
|
act -W .gitea/workflows/ci-cd.yaml --rm
|
||||||
```
|
```
|
||||||
@@ -472,7 +472,7 @@ act -W .gitea/workflows/ci-cd.yaml \
|
|||||||
# 3. With specific event simulation
|
# 3. With specific event simulation
|
||||||
act push -W .gitea/workflows/ci-cd.yaml \
|
act push -W .gitea/workflows/ci-cd.yaml \
|
||||||
--env GITEA_ORG=arcodange \
|
--env GITEA_ORG=arcodange \
|
||||||
--env GITEA_REPO=DanceLessonsCoach
|
--env GITEA_REPO=dance-lessons-coach
|
||||||
```
|
```
|
||||||
|
|
||||||
### Pipeline Status Checking Scripts
|
### Pipeline Status Checking Scripts
|
||||||
@@ -489,10 +489,10 @@ echo "🔍 Checking CI/CD Pipeline Status"
|
|||||||
echo "================================"
|
echo "================================"
|
||||||
|
|
||||||
# 1. Gitea (Primary) - Internal URL
|
# 1. Gitea (Primary) - Internal URL
|
||||||
if curl -s -o /dev/null -w "%{http_code}" "https://gitea.arcodange.lab/api/v1/repos/arcodange/DanceLessonsCoach/actions/workflows" | grep -q "200"; then
|
if curl -s -o /dev/null -w "%{http_code}" "https://gitea.arcodange.lab/api/v1/repos/arcodange/dance-lessons-coach/actions/workflows" | grep -q "200"; then
|
||||||
echo "✅ Gitea Internal API: Accessible"
|
echo "✅ Gitea Internal API: Accessible"
|
||||||
# Get workflow list
|
# Get workflow list
|
||||||
WORKFLOWS=$(curl -s "https://gitea.arcodange.lab/api/v1/repos/arcodange/DanceLessonsCoach/actions/workflows" | jq -r '.[] | .name + " (" + .file_name + ")"')
|
WORKFLOWS=$(curl -s "https://gitea.arcodange.lab/api/v1/repos/arcodange/dance-lessons-coach/actions/workflows" | jq -r '.[] | .name + " (" + .file_name + ")"')
|
||||||
echo "📋 Gitea Workflows:"
|
echo "📋 Gitea Workflows:"
|
||||||
echo "$WORKFLOWS" | sed 's/^/ - /'
|
echo "$WORKFLOWS" | sed 's/^/ - /'
|
||||||
else
|
else
|
||||||
@@ -502,9 +502,9 @@ fi
|
|||||||
# 2. Gitea (External) - Public URL
|
# 2. Gitea (External) - Public URL
|
||||||
echo ""
|
echo ""
|
||||||
echo "🌐 Gitea External Status:"
|
echo "🌐 Gitea External Status:"
|
||||||
if curl -s -o /dev/null -w "%{http_code}" "https://gitea.arcodange.fr/arcodange/DanceLessonsCoach" | grep -q "200"; then
|
if curl -s -o /dev/null -w "%{http_code}" "https://gitea.arcodange.fr/arcodange/dance-lessons-coach" | grep -q "200"; then
|
||||||
echo "✅ Gitea External: Accessible"
|
echo "✅ Gitea External: Accessible"
|
||||||
echo "🔗 Repository: https://gitea.arcodange.fr/arcodange/DanceLessonsCoach"
|
echo "🔗 Repository: https://gitea.arcodange.fr/arcodange/dance-lessons-coach"
|
||||||
else
|
else
|
||||||
echo "❌ Gitea External: Not accessible"
|
echo "❌ Gitea External: Not accessible"
|
||||||
fi
|
fi
|
||||||
@@ -512,7 +512,7 @@ fi
|
|||||||
# 3. Check badge API
|
# 3. Check badge API
|
||||||
echo ""
|
echo ""
|
||||||
echo "🏷️ Badge API Status:"
|
echo "🏷️ Badge API Status:"
|
||||||
BADGE_URL="https://gitea.arcodange.fr/api/badges/arcodange/DanceLessonsCoach/status"
|
BADGE_URL="https://gitea.arcodange.fr/api/badges/arcodange/dance-lessons-coach/status"
|
||||||
if curl -s -o /dev/null -w "%{http_code}" "$BADGE_URL" | grep -q "200"; then
|
if curl -s -o /dev/null -w "%{http_code}" "$BADGE_URL" | grep -q "200"; then
|
||||||
echo "✅ Badge API: Accessible"
|
echo "✅ Badge API: Accessible"
|
||||||
echo "🔗 Badge URL: $BADGE_URL"
|
echo "🔗 Badge URL: $BADGE_URL"
|
||||||
@@ -541,8 +541,8 @@ echo "✅ Arcodange conventions: Matches webapp workflow style"
|
|||||||
echo ""
|
echo ""
|
||||||
echo "💡 Next Steps:"
|
echo "💡 Next Steps:"
|
||||||
echo " 1. Push to trigger workflow: git push origin main"
|
echo " 1. Push to trigger workflow: git push origin main"
|
||||||
echo " 2. Check Gitea Actions: https://gitea.arcodange.lab/arcodange/DanceLessonsCoach/actions"
|
echo " 2. Check Gitea Actions: https://gitea.arcodange.lab/arcodange/dance-lessons-coach/actions"
|
||||||
echo " 3. Monitor badges: https://gitea.arcodange.fr/arcodange/DanceLessonsCoach"
|
echo " 3. Monitor badges: https://gitea.arcodange.fr/arcodange/dance-lessons-coach"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Workflow Validation Script
|
### Workflow Validation Script
|
||||||
@@ -659,7 +659,7 @@ services:
|
|||||||
- GITEA_INTERNAL=https://gitea.arcodange.lab/
|
- GITEA_INTERNAL=https://gitea.arcodange.lab/
|
||||||
- GITEA_EXTERNAL=https://gitea.arcodange.fr/
|
- GITEA_EXTERNAL=https://gitea.arcodange.fr/
|
||||||
- GITEA_ORG=arcodange
|
- GITEA_ORG=arcodange
|
||||||
- GITEA_REPO=DanceLessonsCoach
|
- GITEA_REPO=dance-lessons-coach
|
||||||
command: act -W .gitea/workflows/ci-cd.yaml --rm
|
command: act -W .gitea/workflows/ci-cd.yaml --rm
|
||||||
|
|
||||||
yamllint:
|
yamllint:
|
||||||
@@ -758,7 +758,81 @@ graph TD
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**Status:** Proposed
|
## Implementation Status
|
||||||
**Next Review:** 2026-04-12
|
|
||||||
|
### ✅ Completed - Container/Services Architecture
|
||||||
|
|
||||||
|
The CI/CD pipeline has been successfully implemented using GitHub Actions' container/services architecture:
|
||||||
|
|
||||||
|
**Key Implementation Details:**
|
||||||
|
|
||||||
|
1. **Container-based Execution**: All CI steps run within a pre-built Docker cache image containing Go tools, Node.js, and PostgreSQL client
|
||||||
|
2. **Service-based PostgreSQL**: Database provided as a service container, accessible via `postgres` hostname
|
||||||
|
3. **Smart Caching**: Dependency hash calculated from `go.mod`, `go.sum`, and `Dockerfile.build` for accurate cache invalidation
|
||||||
|
4. **Environment Configuration**: Database connection parameters set via `DLC_*` environment variables
|
||||||
|
5. **Simplified Workflow**: Removed Docker Compose overhead and unnecessary setup steps
|
||||||
|
|
||||||
|
**Current Workflow Structure:**
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
jobs:
|
||||||
|
build-cache:
|
||||||
|
name: Build Docker Cache
|
||||||
|
# Calculates dependency hash and builds cache image if needed
|
||||||
|
|
||||||
|
ci-pipeline:
|
||||||
|
name: CI Pipeline
|
||||||
|
needs: build-cache
|
||||||
|
container:
|
||||||
|
image: gitea.arcodange.lab/arcodange/dance-lessons-coach-build-cache:${{ needs.build-cache.outputs.deps_hash }}
|
||||||
|
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:15
|
||||||
|
env:
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
POSTGRES_DB: dance_lessons_coach_bdd_test
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set database environment variables
|
||||||
|
run: |
|
||||||
|
echo "DLC_DATABASE_HOST=postgres" >> $GITHUB_ENV
|
||||||
|
echo "DLC_DATABASE_PORT=5432" >> $GITHUB_ENV
|
||||||
|
# ... other database config
|
||||||
|
|
||||||
|
- name: Generate Swagger Docs
|
||||||
|
run: go generate ./pkg/server
|
||||||
|
|
||||||
|
- name: Build all packages
|
||||||
|
run: go build ./...
|
||||||
|
|
||||||
|
- name: Wait for PostgreSQL to be ready
|
||||||
|
run: pg_isready -h postgres -p 5432
|
||||||
|
|
||||||
|
- name: Run tests with coverage
|
||||||
|
run: go test ./... -coverprofile=coverage.out
|
||||||
|
|
||||||
|
- name: Build binaries
|
||||||
|
run: ./scripts/build.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
**Performance Improvements:**
|
||||||
|
- ✅ **Faster execution**: Direct container execution without compose overhead
|
||||||
|
- ✅ **Reliable caching**: Accurate dependency tracking with multi-file hash
|
||||||
|
- ✅ **Simpler debugging**: Clear container boundaries and service networking
|
||||||
|
- ✅ **Better portability**: Standard GitHub Actions patterns work across platforms
|
||||||
|
|
||||||
|
**Verification:**
|
||||||
|
- ✅ **Workflow 465**: Both jobs completed successfully (2026-04-08)
|
||||||
|
- ✅ **All tests passing**: Database connectivity working correctly
|
||||||
|
- ✅ **Coverage reporting**: Badges updating automatically
|
||||||
|
- ✅ **Binary builds**: Scripts executing properly in container environment
|
||||||
|
|
||||||
|
**Status:** ✅ Accepted
|
||||||
|
**Implementation Date:** 2026-04-08
|
||||||
**Implementation Owner:** Arcodange Team
|
**Implementation Owner:** Arcodange Team
|
||||||
**Approvers Needed:** @gabrielradureau
|
**Reviewers:** @gabrielradureau
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
## Context
|
## Context
|
||||||
|
|
||||||
DanceLessonsCoach requires a safe workflow for making CI/CD changes to prevent breaking the main branch. The current workflow allows direct pushes to main, which poses risks for CI/CD configuration changes that could break the entire pipeline.
|
dance-lessons-coach requires a safe workflow for making CI/CD changes to prevent breaking the main branch. The current workflow allows direct pushes to main, which poses risks for CI/CD configuration changes that could break the entire pipeline.
|
||||||
|
|
||||||
## Decision Drivers
|
## Decision Drivers
|
||||||
|
|
||||||
@@ -220,13 +220,13 @@ echo 'm' | act -n -W .gitea/workflows/ci-cd.yaml
|
|||||||
|
|
||||||
#### Sample Dry Run Output
|
#### Sample Dry Run Output
|
||||||
```
|
```
|
||||||
*DRYRUN* [DanceLessonsCoach CI/CD/Build and Test ] ⭐ Run Set up job
|
*DRYRUN* [dance-lessons-coach CI/CD/Build and Test ] ⭐ Run Set up job
|
||||||
*DRYRUN* [DanceLessonsCoach CI/CD/Build and Test ] 🚀 Start image=node:16-buster-slim
|
*DRYRUN* [dance-lessons-coach CI/CD/Build and Test ] 🚀 Start image=node:16-buster-slim
|
||||||
*DRYRUN* [DanceLessonsCoach CI/CD/Build and Test ] ✅ Success - Set up job
|
*DRYRUN* [dance-lessons-coach CI/CD/Build and Test ] ✅ Success - Set up job
|
||||||
*DRYRUN* [DanceLessonsCoach CI/CD/Build and Test ] ⭐ Run Main Checkout code
|
*DRYRUN* [dance-lessons-coach CI/CD/Build and Test ] ⭐ Run Main Checkout code
|
||||||
*DRYRUN* [DanceLessonsCoach CI/CD/Build and Test ] ✅ Success - Main Checkout code [4.038875ms]
|
*DRYRUN* [dance-lessons-coach CI/CD/Build and Test ] ✅ Success - Main Checkout code [4.038875ms]
|
||||||
... (all steps succeeded)
|
... (all steps succeeded)
|
||||||
*DRYRUN* [DanceLessonsCoach CI/CD/Build and Test ] 🏁 Job succeeded
|
*DRYRUN* [dance-lessons-coach CI/CD/Build and Test ] 🏁 Job succeeded
|
||||||
```
|
```
|
||||||
|
|
||||||
### Recommended Local Development Workflow
|
### Recommended Local Development Workflow
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
version: '3.8'
|
|
||||||
|
|
||||||
services:
|
|
||||||
act-runner:
|
|
||||||
image: gitea/act_runner:latest
|
|
||||||
volumes:
|
|
||||||
- .:/workspace
|
|
||||||
- ./config/runner:/data/.runner
|
|
||||||
working_dir: /workspace
|
|
||||||
environment:
|
|
||||||
- GITEA_INSTANCE_URL=${GITEA_INSTANCE_URL:-https://gitea.arcodange.lab/}
|
|
||||||
- GITEA_RUNNER_REGISTRATION_TOKEN=${GITEA_RUNNER_REGISTRATION_TOKEN}
|
|
||||||
- GITEA_RUNNER_NAME=${GITEA_RUNNER_NAME:-local-test-runner}
|
|
||||||
- GITEA_RUNNER_LABELS=${GITEA_RUNNER_LABELS:-ubuntu-latest:docker://node:16-bullseye,ubuntu-22.04:docker://gitea/act_runner:latest}
|
|
||||||
command: act -W .gitea/workflows/go-ci-cd.yaml --rm
|
|
||||||
|
|
||||||
yamllint:
|
|
||||||
image: pipelinecomponents/yamllint:latest
|
|
||||||
volumes:
|
|
||||||
- .:/workspace
|
|
||||||
working_dir: /workspace
|
|
||||||
command: yamllint .gitea/workflows/
|
|
||||||
|
|
||||||
yq-validator:
|
|
||||||
image: mikefarah/yq:latest
|
|
||||||
volumes:
|
|
||||||
- .:/workspace
|
|
||||||
working_dir: /workspace
|
|
||||||
command: yq eval '.' .gitea/workflows/ci-cd.yaml
|
|
||||||
Reference in New Issue
Block a user