Revert "feat: migrate deployment to Forgejo Actions from GitLab CI"

This reverts commit 27261f107b.
This commit is contained in:
Graham McIntire 2026-03-04 17:29:36 -06:00
parent 27261f107b
commit e29981b307
No known key found for this signature in database
2 changed files with 65 additions and 38 deletions

View file

@ -62,41 +62,3 @@ jobs:
${{ steps.meta.outputs.latest_tag }}
cache-from: type=registry,ref=${{ steps.meta.outputs.cache_tag }}
cache-to: type=registry,ref=${{ steps.meta.outputs.cache_tag }},mode=max
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Extract metadata
id: meta
run: |
TIMESTAMP=$(date +%s)
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
IMAGE=${{ secrets.REGISTRY_URL }}/${{ github.repository }}
echo "tag=${IMAGE}:main-${TIMESTAMP}-${SHORT_SHA}" >> $GITHUB_OUTPUT
- name: Set up kubectl
uses: https://github.com/azure/setup-kubectl@v4
with:
version: 'latest'
- name: Deploy to Kubernetes
env:
KUBECONFIG_DATA: ${{ secrets.KUBECONFIG }}
run: |
# Set up kubeconfig
mkdir -p $HOME/.kube
echo "$KUBECONFIG_DATA" | base64 -d > $HOME/.kube/config
chmod 600 $HOME/.kube/config
# Verify connection
kubectl config get-contexts
kubectl config use-context towerops/towerops:home-cluster-agent
# Set deployment timestamp (ISO 8601 format in UTC)
DEPLOY_TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
echo "Deploying at $DEPLOY_TIMESTAMP"
# Deploy new version (migrations run on app start)
kubectl set image deployment/towerops towerops=${{ steps.meta.outputs.tag }} -n towerops
kubectl set env deployment/towerops DEPLOY_TIMESTAMP=$DEPLOY_TIMESTAMP -n towerops

65
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,65 @@
stages:
- build
- deploy
variables:
DOCKER_BUILDKIT: 1
CI_BUILDX_ARCHS: "linux/amd64"
DOCKER_TLS_CERTDIR: ""
workflow:
auto_cancel:
on_new_commit: interruptible
build:
stage: build
interruptible: true
tags:
- home
image: docker:27
services:
- docker:27-dind
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
# Pull latest image for layer caching (ignore failures if not exists)
- docker pull $CI_REGISTRY_IMAGE:latest || true
# Build with cache-from for faster builds and inline cache for future builds
- docker build
--cache-from $CI_REGISTRY_IMAGE:latest
--build-arg BUILDKIT_INLINE_CACHE=1
-f k8s/Dockerfile
-t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
-t $CI_REGISTRY_IMAGE:latest
.
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker push $CI_REGISTRY_IMAGE:latest
rules:
- if: $CI_COMMIT_BRANCH == "main"
deploy:
stage: deploy
needs:
- job: build
artifacts: false
tags:
- home
image:
name: bitnami/kubectl:latest
entrypoint: [""]
script:
- kubectl config get-contexts
- kubectl config use-context towerops/towerops:home-cluster-agent
# Set deployment timestamp (ISO 8601 format in UTC)
- DEPLOY_TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
- echo "Deploying at $DEPLOY_TIMESTAMP"
# Deploy new version (migrations run on app start)
- kubectl set image deployment/towerops towerops=$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA -n towerops
- kubectl set env deployment/towerops DEPLOY_TIMESTAMP=$DEPLOY_TIMESTAMP -n towerops
# Don't wait for rollout completion - let Kubernetes handle it asynchronously
environment:
name: production
kubernetes:
namespace: towerops
rules:
- if: $CI_COMMIT_BRANCH == "main"