# Gitea Configuration for Bakery-IA CI/CD This directory contains the Helm values and scripts for setting up Gitea as the Git server for the Bakery-IA project. ## Features - **Automatic Repository Creation**: When Gitea is installed via Helm, it automatically creates a `bakery-ia` repository owned by the admin user. - **Pre-configured Settings**: The repository comes with issues, wiki, pull requests, and projects enabled. - **Easy Setup Script**: A script to push your existing code to the new Gitea repository. ## Installation ### 1. Install Gitea with Helm ```bash # Add Gitea Helm repository helm repo add gitea https://dl.gitea.io/charts helm repo update # Create namespace kubectl create namespace gitea # Install Gitea with automatic repository creation helm install gitea gitea/gitea -n gitea \ -f infrastructure/cicd/gitea/values.yaml \ --set gitea.admin.password=your-secure-password ``` ### 2. Wait for Gitea to be ready ```bash kubectl wait --for=condition=ready pod -n gitea -l app.kubernetes.io/name=gitea --timeout=300s ``` ### 3. Push your code to the new repository ```bash # Set the admin password as environment variable export GITEA_ADMIN_PASSWORD="your-secure-password" # Run the setup script ./infrastructure/cicd/gitea/setup-gitea-repository.sh ``` ## Configuration Details ### Automatic Repository Creation The `values.yaml` file includes the following configuration to automatically create the `bakery-ia` repository: ```yaml gitea: initialRepositories: - name: bakery-ia description: "Main repository for Bakery IA project - Automatically created by Helm" private: false auto_init: true default_branch: main owner: "{{ .Values.gitea.admin.username }}" enable_issues: true enable_wiki: true enable_pull_requests: true enable_projects: true ``` ### Repository Features The automatically created repository includes: - **Issues**: For tracking bugs and feature requests - **Wiki**: For project documentation - **Pull Requests**: For code review workflow - **Projects**: For project management - **Auto Initialization**: Creates an initial README.md file ## CI/CD Integration Once the repository is created and your code is pushed, you can configure your CI/CD pipelines to use this repository. The repository URL will be: ``` https://gitea.bakery-ia.local/bakery-admin/bakery-ia.git ``` ### Example Tekton Pipeline Configuration ```yaml # In your Tekton PipelineRun or Task spec: params: - name: git-url value: "https://gitea.bakery-ia.local/bakery-admin/bakery-ia.git" - name: git-revision value: "main" ``` ## Troubleshooting ### Repository not created If the repository is not automatically created: 1. Check Gitea logs: `kubectl logs -n gitea -l app.kubernetes.io/name=gitea` 2. Verify the Helm values were applied correctly 3. Manually create the repository using the setup script ### Authentication issues If you have authentication problems when pushing: 1. Verify the admin password is correct 2. Check that the Gitea service is accessible 3. Ensure your kubeconfig has access to the Gitea namespace ## Security Notes - Always use a strong password for the Gitea admin user - Consider using Kubernetes secrets for sensitive data - The setup script uses basic authentication - for production, consider using SSH keys or tokens ## Upgrading To upgrade Gitea while preserving your repositories: ```bash helm upgrade gitea gitea/gitea -n gitea \ -f infrastructure/cicd/gitea/values.yaml \ --set gitea.admin.password=your-secure-password ``` The existing repositories and their contents will be preserved during upgrades.