Skip to content

GitLab CI/CD

Every push runs validation. Pushes to main also deploy the Airflow stack to the VM.

This pipeline does not build or publish documentation. The shared site is built only by the GraphRAG GitLab Pages job, which git-clones this repo's docs/ folder. Airflow validate / deploy can fail or be skipped without blocking the docs site.

Pipeline stages

Stage What it does
validate python3 -m compileall dags/ + helpers/
deploy SCP production .env from GitLab → SSH to VM → git reset --hard origin/main → scripts/deploy.sh

Config file: .gitlab-ci.yml

See Documentation Ops in the GraphRAG tab for how Pages clones this docs/ folder.

One-time server setup

On the machine that will host Airflow:

sudo mkdir -p /home/edc_user/cicd/rbtl_airflow
sudo chown $USER:$USER /home/edc_user/cicd/rbtl_airflow
git clone https://gitlab.com/new-momentum/reading-between-the-lines/rbtl_airlflow.git /home/edc_user/cicd/rbtl_airflow
cd /home/edc_user/cicd/rbtl_airflow
# .env is deployed automatically by GitLab CI from the ENV_FILE variable.
# For a first manual deploy, copy .env.example → .env, then:
bash scripts/deploy.sh

Configure Airflow Variables and Connections on that host (same as local setup).

Ensure the deploy user can run Docker without sudo (add the user to the docker group).

GitLab CI/CD variables

In GitLab: Settings → CI/CD → Variables

Variable Required Type Description
ENV_FILE Yes File Full production .env contents
VM_HOST Yes Variable Server hostname or IP
VM_USER Yes Variable SSH user (must access DEPLOY_PATH and Docker)
SSH_PRIVATE_KEY Yes File Private key for VM_USER
SSH_KNOWN_HOSTS Yes File SSH known_hosts entry for the VM
DEPLOY_PATH No Variable Path on VM (default: /home/edc_user/cicd/rbtl_airflow)

Add the matching public key to ~/.ssh/authorized_keys on the deploy host.

What happens on push

git push origin main
    → GitLab runs validate (compile DAGs + helpers)
    → GitLab copies ENV_FILE and SCPs it to the VM as .env
    → GitLab SSHs to VM_HOST, resets to origin/main, runs scripts/deploy.sh
    → Airflow available at http://VM_HOST:8080

Docs are unchanged until someone runs the GraphRAG Pages pipeline, which clones this main.

Manual deploy (without CI)

bash scripts/deploy.sh

Validate only (local)

bash scripts/validate.sh

Job token allowlist (docs clone)

The GraphRAG Pages job clones this private repo. In this Airflow project: Settings → CI/CD → Job token permissions → allow inbound from rbtl_graphrag. That is a git-clone permission, not a requirement that this pipeline is green.