Fix production-deploy workflow: use array syntax for branches, remove if condition
This commit is contained in:
@@ -112,7 +112,8 @@ jobs:
|
||||
build:
|
||||
name: Build Docker Image
|
||||
needs: test
|
||||
if: always() && (needs.test.result == 'success' || needs.test.result == 'skipped')
|
||||
# Note: if condition might not work correctly in Gitea - always() might need different syntax
|
||||
# if: always() && (needs.test.result == 'success' || needs.test.result == 'skipped')
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
image_tag: ${{ steps.meta.outputs.tag }}
|
||||
|
||||
110
deployment/gitea-runner/ADD_PHP_CI_LABEL.md
Normal file
110
deployment/gitea-runner/ADD_PHP_CI_LABEL.md
Normal file
@@ -0,0 +1,110 @@
|
||||
# php-ci Label zum Runner hinzufügen
|
||||
|
||||
## Problem
|
||||
Workflows mit `runs-on: php-ci` können nicht ausgeführt werden, wenn der Runner dieses Label nicht kennt.
|
||||
|
||||
## Lösung
|
||||
|
||||
### Schritt 1: php-ci Image verfügbar machen
|
||||
|
||||
**Option A: Image in Registry pushen (empfohlen für Production)**
|
||||
```bash
|
||||
cd deployment/gitea-runner
|
||||
./build-ci-image.sh
|
||||
|
||||
# Login zur Registry
|
||||
docker login registry.michaelschiemer.de -u admin
|
||||
|
||||
# Image zur Registry pushen
|
||||
docker tag php-ci:latest registry.michaelschiemer.de/ci/php-ci:latest
|
||||
docker push registry.michaelschiemer.de/ci/php-ci:latest
|
||||
```
|
||||
|
||||
**Option B: Image lokal in docker-dind laden**
|
||||
```bash
|
||||
cd deployment/gitea-runner
|
||||
|
||||
# Stelle sicher dass docker-dind läuft
|
||||
docker compose up -d docker-dind
|
||||
|
||||
# Image bauen
|
||||
./build-ci-image.sh
|
||||
|
||||
# Image in docker-dind laden
|
||||
docker save php-ci:latest | docker exec -i gitea-runner-dind docker load
|
||||
```
|
||||
|
||||
### Schritt 2: Label zu .env hinzufügen
|
||||
|
||||
**Wenn .env existiert:**
|
||||
```bash
|
||||
cd deployment/gitea-runner
|
||||
nano .env
|
||||
```
|
||||
|
||||
Füge `php-ci:docker://php-ci:latest` zu `GITEA_RUNNER_LABELS` hinzu:
|
||||
|
||||
```bash
|
||||
# Für lokales Image:
|
||||
GITEA_RUNNER_LABELS=ubuntu-latest:docker://node:16-bullseye,ubuntu-22.04:docker://node:16-bullseye,php-ci:docker://php-ci:latest
|
||||
|
||||
# Für Registry Image (empfohlen):
|
||||
GITEA_RUNNER_LABELS=ubuntu-latest:docker://node:16-bullseye,ubuntu-22.04:docker://node:16-bullseye,php-ci:docker://registry.michaelschiemer.de/ci/php-ci:latest
|
||||
```
|
||||
|
||||
**Wenn .env nicht existiert:**
|
||||
```bash
|
||||
cd deployment/gitea-runner
|
||||
cp .env.example .env
|
||||
# Dann .env bearbeiten und php-ci Label sicherstellen (ist schon im Beispiel enthalten)
|
||||
```
|
||||
|
||||
### Schritt 3: Runner neu registrieren
|
||||
|
||||
⚠️ **WICHTIG:** Labels können nur bei der Registration geändert werden!
|
||||
|
||||
```bash
|
||||
cd deployment/gitea-runner
|
||||
|
||||
# Runner unregistrieren
|
||||
./unregister.sh
|
||||
|
||||
# Runner mit neuen Labels neu registrieren
|
||||
./register.sh
|
||||
```
|
||||
|
||||
### Schritt 4: Verifikation
|
||||
|
||||
1. **In Gitea UI prüfen:**
|
||||
- Gehe zu: https://git.michaelschiemer.de/admin/actions/runners
|
||||
- Runner sollte jetzt das `php-ci` Label zeigen
|
||||
|
||||
2. **Workflow testen:**
|
||||
- Ein Workflow mit `runs-on: php-ci` sollte jetzt funktionieren
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**Runner zeigt php-ci Label nicht:**
|
||||
- Runner muss neu registriert werden (Labels können nicht dynamisch geändert werden)
|
||||
- Prüfe ob Image verfügbar ist: `docker exec gitea-runner-dind docker images | grep php-ci`
|
||||
|
||||
**Workflow findet keinen Runner:**
|
||||
- Prüfe ob Runner das Label hat (Gitea UI)
|
||||
- Prüfe ob Image verfügbar ist (für lokales Image: in docker-dind)
|
||||
|
||||
## Schnellstart
|
||||
|
||||
```bash
|
||||
cd deployment/gitea-runner
|
||||
|
||||
# 1. Image bauen und in docker-dind laden
|
||||
./build-ci-image.sh
|
||||
docker save php-ci:latest | docker exec -i gitea-runner-dind docker load
|
||||
|
||||
# 2. .env prüfen/anpassen
|
||||
nano .env # Sicherstellen dass php-ci:docker://php-ci:latest in GITEA_RUNNER_LABELS ist
|
||||
|
||||
# 3. Runner neu registrieren
|
||||
./unregister.sh
|
||||
./register.sh
|
||||
```
|
||||
69
docker/ci/Dockerfile
Normal file
69
docker/ci/Dockerfile
Normal file
@@ -0,0 +1,69 @@
|
||||
# Dockerfile für CI/CD Workflows
|
||||
# Optimiert für Gitea Actions Runner mit PHP 8.5 und allen benötigten Tools
|
||||
FROM php:8.5.0RC3-cli
|
||||
|
||||
# System-Abhängigkeiten für CI/CD
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
curl \
|
||||
unzip \
|
||||
zip \
|
||||
lsb-release \
|
||||
ca-certificates \
|
||||
apt-transport-https \
|
||||
jq \
|
||||
ansible \
|
||||
libzip-dev \
|
||||
libpng-dev \
|
||||
libjpeg-dev \
|
||||
libfreetype6-dev \
|
||||
libwebp-dev \
|
||||
libavif-dev \
|
||||
libxpm-dev \
|
||||
libsodium-dev \
|
||||
libpq-dev \
|
||||
libxml2-dev \
|
||||
libicu-dev \
|
||||
libonig-dev \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Installiere PHP Extensions (CLI-Version)
|
||||
RUN docker-php-ext-configure gd \
|
||||
--with-freetype \
|
||||
--with-jpeg \
|
||||
--with-webp \
|
||||
&& docker-php-ext-install -j$(nproc) \
|
||||
zip \
|
||||
pdo_mysql \
|
||||
pdo_pgsql \
|
||||
pcntl \
|
||||
bcmath \
|
||||
mbstring \
|
||||
xml \
|
||||
intl \
|
||||
exif \
|
||||
soap \
|
||||
gd
|
||||
|
||||
# Installiere PECL Extensions
|
||||
RUN pecl install apcu redis-6.3.0RC1 \
|
||||
&& docker-php-ext-enable apcu redis
|
||||
|
||||
# Configure APCu
|
||||
RUN echo "apc.enable_cli=1" >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini \
|
||||
&& echo "apc.shm_size=128M" >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini
|
||||
|
||||
# Composer installieren
|
||||
RUN curl -sS https://getcomposer.org/installer | php \
|
||||
&& mv composer.phar /usr/local/bin/composer \
|
||||
&& chmod +x /usr/local/bin/composer
|
||||
|
||||
# Arbeitsverzeichnis
|
||||
WORKDIR /workspace
|
||||
|
||||
# Standard-User für CI (UID/GID 1000)
|
||||
RUN groupadd -g 1000 ci && useradd -u 1000 -g ci -m ci
|
||||
|
||||
# Stelle sicher, dass alle benötigten Tools verfügbar sind
|
||||
RUN php -v && composer --version && git --version && jq --version
|
||||
Reference in New Issue
Block a user