Fix workflow: use debian-host runner and registry.i80.dk
Some checks failed
Build and Deploy citti / build-and-deploy (push) Failing after 5s
Some checks failed
Build and Deploy citti / build-and-deploy (push) Failing after 5s
Match BlaaAi deployment pattern: debian-host runner, Harbor registry, nomad CLI directly, NOMAD_ADDR=https://nomad.i80.dk:4646. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,37 +1,54 @@
|
||||
name: deploy
|
||||
name: Build and Deploy citti
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
SERVICE_NAME: citti
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
build-and-deploy:
|
||||
runs-on: debian-host
|
||||
|
||||
env:
|
||||
PATH: /usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/bin:/snap/bin
|
||||
DOCKER_HOST: unix:///var/run/docker.sock
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Login to registry
|
||||
run: echo "${{ secrets.GITEA_TOKEN }}" | docker login gea.i80.dk -u hjess --password-stdin
|
||||
|
||||
- name: Build & push
|
||||
- name: Log in to Docker Registry
|
||||
run: |
|
||||
echo "${{ secrets.HARBOR_ROBOT_TOKEN }}" | docker login registry.i80.dk -u "robot\$gitserver" --password-stdin
|
||||
|
||||
- name: Build Docker image
|
||||
run: |
|
||||
SHA=$(git rev-parse --short HEAD)
|
||||
docker build \
|
||||
-t gea.i80.dk/hjess/citti:latest \
|
||||
-t gea.i80.dk/hjess/citti:${{ gitea.sha }} .
|
||||
docker push gea.i80.dk/hjess/citti:latest
|
||||
docker push gea.i80.dk/hjess/citti:${{ gitea.sha }}
|
||||
-t registry.i80.dk/gitea/${SERVICE_NAME}:latest \
|
||||
-t registry.i80.dk/gitea/${SERVICE_NAME}:$SHA .
|
||||
|
||||
- name: Push Docker image
|
||||
run: |
|
||||
SHA=$(git rev-parse --short HEAD)
|
||||
docker push registry.i80.dk/gitea/${SERVICE_NAME}:latest
|
||||
docker push registry.i80.dk/gitea/${SERVICE_NAME}:$SHA
|
||||
|
||||
- name: Deploy to Nomad
|
||||
env:
|
||||
NOMAD_ADDR: ${{ secrets.NOMAD_ADDR }}
|
||||
NOMAD_TOKEN: ${{ secrets.NOMAD_TOKEN }}
|
||||
run: |
|
||||
job_hcl=$(jq -Rs . < citti.nomad)
|
||||
job_json=$(curl -sf "${NOMAD_ADDR}/v1/jobs/parse" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"JobHCL\": ${job_hcl}}")
|
||||
curl -sf -X POST "${NOMAD_ADDR}/v1/jobs" \
|
||||
-H "X-Nomad-Token: ${NOMAD_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"Job\": ${job_json}}"
|
||||
echo "Deployed ${{ gitea.sha }}"
|
||||
nomad job validate ${SERVICE_NAME}.nomad
|
||||
nomad job run ${SERVICE_NAME}.nomad
|
||||
env:
|
||||
NOMAD_ADDR: "https://nomad.i80.dk:4646"
|
||||
|
||||
- name: Verify deployment
|
||||
run: |
|
||||
echo "Deployment triggered — checking status..."
|
||||
sleep 20
|
||||
nomad job status ${SERVICE_NAME}
|
||||
env:
|
||||
NOMAD_ADDR: "https://nomad.i80.dk:4646"
|
||||
|
||||
2
Makefile
2
Makefile
@@ -1,4 +1,4 @@
|
||||
IMAGE ?= gea.i80.dk/hjess/citti
|
||||
IMAGE ?= registry.i80.dk/gitea/citti
|
||||
TAG ?= latest
|
||||
|
||||
.PHONY: run install build push
|
||||
|
||||
@@ -21,7 +21,7 @@ job "citti" {
|
||||
driver = "docker"
|
||||
|
||||
config {
|
||||
image = "gea.i80.dk/hjess/citti:latest"
|
||||
image = "registry.i80.dk/gitea/citti:latest"
|
||||
ports = ["http"]
|
||||
force_pull = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user