mirror of
https://github.com/SamyRai/turash.git
synced 2025-12-26 23:01:33 +00:00
feat: switch to containerd-native CI/CD with buildah
Some checks failed
CI/CD Pipeline / backend-lint (push) Failing after 31s
CI/CD Pipeline / backend-build (push) Has been skipped
CI/CD Pipeline / frontend-lint (push) Successful in 1m38s
CI/CD Pipeline / frontend-build (push) Failing after 25s
CI/CD Pipeline / e2e-test (push) Has been skipped
Some checks failed
CI/CD Pipeline / backend-lint (push) Failing after 31s
CI/CD Pipeline / backend-build (push) Has been skipped
CI/CD Pipeline / frontend-lint (push) Successful in 1m38s
CI/CD Pipeline / frontend-build (push) Failing after 25s
CI/CD Pipeline / e2e-test (push) Has been skipped
- Replace Docker-based CI/CD with buildah for containerd compatibility - Remove Docker-in-Docker setup from Gitea runner deployment - Use buildah/podman which work natively with containerd runtime - Install buildah and podman in runner container during startup - Maintain Harbor registry integration and caching capabilities Benefits: - Native containerd compatibility (no Docker daemon needed) - Lighter resource usage (no DinD overhead) - Better integration with K3s containerd runtime - Same Harbor registry functionality with cleaner architecture
This commit is contained in:
parent
7b467ab7c8
commit
f3e6e9d44a
@ -42,29 +42,22 @@ jobs:
|
|||||||
if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/master'
|
if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/master'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install Docker CLI
|
- name: Install buildah and podman
|
||||||
run: |
|
run: |
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y docker.io
|
apt-get install -y buildah podman
|
||||||
- name: Set up Docker Buildx
|
- name: Log in to Harbor with buildah
|
||||||
uses: docker/setup-buildx-action@v3
|
run: |
|
||||||
- name: Log in to Harbor
|
buildah login --username ${{ secrets.DOCKER_USERNAME }} --password ${{ secrets.DOCKER_PASSWORD }} registry.bk.glpx.pro
|
||||||
uses: docker/login-action@v3
|
- name: Build and push frontend with buildah
|
||||||
with:
|
run: |
|
||||||
registry: registry.bk.glpx.pro
|
buildah build \
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
--tag registry.bk.glpx.pro/turash/turash-frontend:latest \
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
--tag registry.bk.glpx.pro/turash/turash-frontend:${{ gitea.sha }} \
|
||||||
- name: Build and push frontend
|
--file bugulma/frontend/Dockerfile \
|
||||||
uses: docker/build-push-action@v5
|
bugulma/frontend
|
||||||
with:
|
buildah push registry.bk.glpx.pro/turash/turash-frontend:latest
|
||||||
context: bugulma/frontend
|
buildah push registry.bk.glpx.pro/turash/turash-frontend:${{ gitea.sha }}
|
||||||
file: bugulma/frontend/Dockerfile
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
registry.bk.glpx.pro/turash/turash-frontend:latest
|
|
||||||
registry.bk.glpx.pro/turash/turash-frontend:${{ gitea.sha }}
|
|
||||||
cache-from: type=registry,ref=registry.bk.glpx.pro/turash/turash-frontend:buildcache
|
|
||||||
cache-to: type=registry,ref=registry.bk.glpx.pro/turash/turash-frontend:buildcache,mode=max
|
|
||||||
|
|
||||||
backend-lint:
|
backend-lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -99,29 +92,22 @@ jobs:
|
|||||||
if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/master'
|
if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/master'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install Docker CLI
|
- name: Install buildah and podman
|
||||||
run: |
|
run: |
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y docker.io
|
apt-get install -y buildah podman
|
||||||
- name: Set up Docker Buildx
|
- name: Log in to Harbor with buildah
|
||||||
uses: docker/setup-buildx-action@v3
|
run: |
|
||||||
- name: Log in to Harbor
|
buildah login --username ${{ secrets.DOCKER_USERNAME }} --password ${{ secrets.DOCKER_PASSWORD }} registry.bk.glpx.pro
|
||||||
uses: docker/login-action@v3
|
- name: Build and push backend with buildah
|
||||||
with:
|
run: |
|
||||||
registry: registry.bk.glpx.pro
|
buildah build \
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
--tag registry.bk.glpx.pro/turash/turash-backend:latest \
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
--tag registry.bk.glpx.pro/turash/turash-backend:${{ gitea.sha }} \
|
||||||
- name: Build and push backend
|
--file bugulma/backend/Dockerfile \
|
||||||
uses: docker/build-push-action@v5
|
bugulma/backend
|
||||||
with:
|
buildah push registry.bk.glpx.pro/turash/turash-backend:latest
|
||||||
context: bugulma/backend
|
buildah push registry.bk.glpx.pro/turash/turash-backend:${{ gitea.sha }}
|
||||||
file: bugulma/backend/Dockerfile
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
registry.bk.glpx.pro/turash/turash-backend:latest
|
|
||||||
registry.bk.glpx.pro/turash/turash-backend:${{ gitea.sha }}
|
|
||||||
cache-from: type=registry,ref=registry.bk.glpx.pro/turash/turash-backend:buildcache
|
|
||||||
cache-to: type=registry,ref=registry.bk.glpx.pro/turash/turash-backend:buildcache,mode=max
|
|
||||||
|
|
||||||
e2e-test:
|
e2e-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@ -16,26 +16,13 @@ spec:
|
|||||||
app: gitea-runner
|
app: gitea-runner
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: docker-daemon
|
|
||||||
image: docker:dind
|
|
||||||
env:
|
|
||||||
- name: DOCKER_TLS_CERTDIR
|
|
||||||
value: ""
|
|
||||||
securityContext:
|
|
||||||
privileged: true
|
|
||||||
volumeMounts:
|
|
||||||
- name: docker-graph-storage
|
|
||||||
mountPath: /var/lib/docker
|
|
||||||
- name: docker-config
|
|
||||||
mountPath: /root/.docker/
|
|
||||||
readOnly: true
|
|
||||||
- name: runner
|
- name: runner
|
||||||
image: gitea/act_runner:latest
|
image: gitea/act_runner:latest
|
||||||
command:
|
command:
|
||||||
- sh
|
- sh
|
||||||
- -c
|
- -c
|
||||||
- |
|
- |
|
||||||
apk add --no-cache nodejs npm || true
|
apk add --no-cache nodejs npm buildah podman || true
|
||||||
cd /data
|
cd /data
|
||||||
if [ ! -f .runner ]; then
|
if [ ! -f .runner ]; then
|
||||||
/usr/local/bin/act_runner register --instance "$GITEA_INSTANCE_URL" --token "$GITEA_RUNNER_REGISTRATION_TOKEN" --name "$GITEA_RUNNER_NAME" --labels "$GITEA_RUNNER_LABELS" --no-interactive || true
|
/usr/local/bin/act_runner register --instance "$GITEA_INSTANCE_URL" --token "$GITEA_RUNNER_REGISTRATION_TOKEN" --name "$GITEA_RUNNER_NAME" --labels "$GITEA_RUNNER_LABELS" --no-interactive || true
|
||||||
@ -55,15 +42,11 @@ spec:
|
|||||||
fieldPath: metadata.name
|
fieldPath: metadata.name
|
||||||
- name: GITEA_RUNNER_LABELS
|
- name: GITEA_RUNNER_LABELS
|
||||||
value: "ubuntu-latest:host,ubuntu-22.04:host,ubuntu-20.04:host"
|
value: "ubuntu-latest:host,ubuntu-22.04:host,ubuntu-20.04:host"
|
||||||
- name: DOCKER_HOST
|
|
||||||
value: "tcp://localhost:2375"
|
|
||||||
- name: ACT_RUNNER_CONFIG
|
- name: ACT_RUNNER_CONFIG
|
||||||
value: "/data/.runner_config.yaml"
|
value: "/data/.runner_config.yaml"
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: runner-data
|
- name: runner-data
|
||||||
mountPath: /data
|
mountPath: /data
|
||||||
- name: docker-graph-storage
|
|
||||||
mountPath: /var/lib/docker
|
|
||||||
- name: runner-config
|
- name: runner-config
|
||||||
mountPath: /data/.runner_config.yaml
|
mountPath: /data/.runner_config.yaml
|
||||||
subPath: config.yaml
|
subPath: config.yaml
|
||||||
@ -77,12 +60,7 @@ spec:
|
|||||||
volumes:
|
volumes:
|
||||||
- name: runner-data
|
- name: runner-data
|
||||||
emptyDir: {}
|
emptyDir: {}
|
||||||
- name: docker-graph-storage
|
|
||||||
emptyDir: {}
|
|
||||||
- name: runner-config
|
- name: runner-config
|
||||||
configMap:
|
configMap:
|
||||||
name: gitea-runner-config
|
name: gitea-runner-config
|
||||||
- name: docker-config
|
|
||||||
configMap:
|
|
||||||
name: docker-config
|
|
||||||
dnsPolicy: ClusterFirst
|
dnsPolicy: ClusterFirst
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user