Some checks failed
build-all / build-gateway (push) Failing after 1s
build-images / gateway (push) Failing after 1s
build-all / build-users (push) Failing after 1s
build-all / build-cron (push) Failing after 2s
build-gateway / build (push) Failing after 4s
build-services / build-gateway (push) Failing after 3s
build-services / build-users (push) Failing after 5s
build-services / build-jobs (push) Failing after 3s
build-and-push / detect-changes (push) Successful in 8s
build-services / build-cron (push) Failing after 2s
build-services / build-leads (push) Failing after 4s
build-all-services / build (push) Failing after 3s
build-and-push / build (cron) (push) Failing after 5s
build-and-push / build (customers) (push) Failing after 3s
build-and-push / build (employees) (push) Failing after 3s
build-and-push / build (developers) (push) Failing after 3s
build-and-push / build (fitness-trainers) (push) Failing after 4s
build-and-push / build (gateway) (push) Failing after 3s
build-and-push / build (graphic-designers) (push) Failing after 3s
build-and-push / build (job-seekers) (push) Failing after 3s
build-and-push / build (jobs) (push) Failing after 2s
build-and-push / build (leads) (push) Failing after 2s
build-and-push / build (makeup-artists) (push) Failing after 2s
build-and-push / build (payments) (push) Failing after 2s
build-and-push / build (photographers) (push) Failing after 3s
build-and-push / build (social-media-managers) (push) Failing after 3s
build-and-push / build (tutors) (push) Failing after 3s
build-and-push / build (ugc-content-creators) (push) Failing after 2s
build-and-push / build (users) (push) Failing after 2s
build-and-push / build (video-editors) (push) Failing after 2s
build-and-push / build (companies) (push) Failing after 10m52s
build-and-push / build (catering-services) (push) Successful in 11m29s
Add build-images.yaml for Forgejo CI tmp build.yaml Add Dockerfiles for jobs and leads services Add build-all.sh script for batch building
116 lines
4.7 KiB
YAML
116 lines
4.7 KiB
YAML
name: Build Backend And Update GitOps
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- high-performance
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
DOCKER_HOST: unix:///var/run/docker.sock
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- app_dir: apps/catering_services
|
|
image: registry.nxtgauge.com/nxtgauge-rust-catering-services
|
|
- app_dir: apps/companies
|
|
image: registry.nxtgauge.com/nxtgauge-rust-companies
|
|
- app_dir: apps/cron
|
|
image: registry.nxtgauge.com/nxtgauge-rust-cron
|
|
- app_dir: apps/customers
|
|
image: registry.nxtgauge.com/nxtgauge-rust-customers
|
|
- app_dir: apps/developers
|
|
image: registry.nxtgauge.com/nxtgauge-rust-developers
|
|
- app_dir: apps/employees
|
|
image: registry.nxtgauge.com/nxtgauge-rust-employees
|
|
- app_dir: apps/fitness_trainers
|
|
image: registry.nxtgauge.com/nxtgauge-rust-fitness-trainers
|
|
- app_dir: apps/gateway
|
|
image: registry.nxtgauge.com/nxtgauge-rust-gateway
|
|
- app_dir: apps/graphic_designers
|
|
image: registry.nxtgauge.com/nxtgauge-rust-graphic-designers
|
|
- app_dir: apps/jobs
|
|
image: registry.nxtgauge.com/nxtgauge-rust-jobs
|
|
- app_dir: apps/job_seekers
|
|
image: registry.nxtgauge.com/nxtgauge-rust-job-seekers
|
|
- app_dir: apps/leads
|
|
image: registry.nxtgauge.com/nxtgauge-rust-leads
|
|
- app_dir: apps/makeup_artists
|
|
image: registry.nxtgauge.com/nxtgauge-rust-makeup-artists
|
|
- app_dir: apps/payments
|
|
image: registry.nxtgauge.com/nxtgauge-rust-payments
|
|
- app_dir: apps/photographers
|
|
image: registry.nxtgauge.com/nxtgauge-rust-photographers
|
|
- app_dir: apps/social_media_managers
|
|
image: registry.nxtgauge.com/nxtgauge-rust-social-media-managers
|
|
- app_dir: apps/tutors
|
|
image: registry.nxtgauge.com/nxtgauge-rust-tutors
|
|
- app_dir: apps/ugc_content_creators
|
|
image: registry.nxtgauge.com/nxtgauge-rust-ugc-content-creators
|
|
- app_dir: apps/users
|
|
image: registry.nxtgauge.com/nxtgauge-rust-users
|
|
- app_dir: apps/video_editors
|
|
image: registry.nxtgauge.com/nxtgauge-rust-video-editors
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Docker CLI
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y docker.io
|
|
|
|
- name: Log in to registry
|
|
run: |
|
|
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login registry.nxtgauge.com -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
|
|
|
|
- name: Build and push backend service image
|
|
run: |
|
|
set -euo pipefail
|
|
IMAGE_SHA="${{ matrix.image }}:${{ github.sha }}"
|
|
IMAGE_LATEST="${{ matrix.image }}:latest"
|
|
docker build -f "${{ matrix.app_dir }}/Dockerfile" -t "${IMAGE_SHA}" -t "${IMAGE_LATEST}" .
|
|
docker push "${IMAGE_SHA}"
|
|
docker push "${IMAGE_LATEST}"
|
|
|
|
update-gitops:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Update GitOps backend tags
|
|
env:
|
|
GITOPS_USERNAME: ${{ secrets.GITOPS_GITHUB_USERNAME || 'Traceworks2023' }}
|
|
GITOPS_PASSWORD: ${{ secrets.GITOPS_GITHUB_TOKEN || secrets.GITOPS_PAT }}
|
|
GITOPS_REPO: https://github.com/Traceworks2023/nxtgauge-gitops.git
|
|
IMAGE_TAG: ${{ github.sha }}
|
|
run: |
|
|
set -euo pipefail
|
|
test -n "${GITOPS_PASSWORD:-}" || { echo "GITOPS_PASSWORD is empty"; exit 1; }
|
|
AUTH="$(printf '%s' "${GITOPS_USERNAME}:${GITOPS_PASSWORD}" | base64 -w0)"
|
|
TMP_DIR="$(mktemp -d)"
|
|
git -c http.extraHeader="AUTHORIZATION: basic ${AUTH}" clone --branch main "${GITOPS_REPO}" "${TMP_DIR}"
|
|
cd "${TMP_DIR}"
|
|
python3 - <<'PY'
|
|
from pathlib import Path
|
|
import os
|
|
path = Path('apps/nxtgauge-backend-rust/overlays/prod/kustomization.yaml')
|
|
lines = path.read_text().splitlines()
|
|
out = []
|
|
for line in lines:
|
|
if line.strip().startswith('newTag:'):
|
|
indent = line[:len(line) - len(line.lstrip())]
|
|
out.append(f"{indent}newTag: {os.environ['IMAGE_TAG']}")
|
|
else:
|
|
out.append(line)
|
|
path.write_text('\n'.join(out) + '\n')
|
|
PY
|
|
git config user.name "forgejo-actions"
|
|
git config user.email "forgejo-actions@nxtgauge.com"
|
|
git add apps/nxtgauge-backend-rust/overlays/prod/kustomization.yaml
|
|
git diff --cached --quiet && exit 0
|
|
git commit -m "chore(gitops): update backend images to ${IMAGE_TAG}"
|
|
git -c http.extraHeader="AUTHORIZATION: basic ${AUTH}" push origin main
|