14.8.2 주요 CI/CD 도구(GitHub Actions, Jenkins, GitLab CI) 내 오라클 통합 스크립트 예시
14.8.1절에서 완벽하게 격리된 오라클 컨테이너 이미지를 확보했다면, 이제 이 검증의 칼날을 기업들이 실제로 사용하는 범용 CI/CD 컨트롤러 스크립트 안에 피도 눈물도 없이 이식(Integration)할 차례다.
어떤 플랫폼을 사용하든 철학은 동일하다. “새로운 프롬프트나 모델 가중치가 커밋(Commit)되는 순간, 파이프라인은 즉시 오라클 컨테이너를 스폰시켜 골든 데이터셋과 대결시키고, 그 통과율(Pass Rate)이 100%가 아니라면 빌드 자체를 잔혹하게 박살 낸다(Fail Fast).”
다음에 제시되는 세 가지 대표 도구의 스크립트는 이 철학을 구현하는 가장 표준적인 예시다.
1. GitHub Actions 통합 예시
빠른 피드백과 가벼운 서버리스 환경을 지향하는 GitHub Actions에서는, Pull Request(PR)가 열릴 때마다 즉시 오라클 검증(Job)이 병렬로 실행되도록 구성한다.
# .github/workflows/ai-oracle-pipeline.yml
name: AI Model Oracle Validation
on: [pull_request, push]
jobs:
oracle-evaluation:
runs-on: ubuntu-latest
steps:
- name: 저장소 체크아웃 (Checkout Repository)
uses: actions/checkout@v3
- name: 테스트용 로컬 LLM 서버 기동 (Start Mock LLM or Local VLLM)
run: docker-compose up -d local-llm-service
- name: 오라클 컨테이너 격발 (Run Oracle Evaluation Suite)
run: |
docker run --network host \
-e LLM_API_URL="http://localhost:8000/v1/chat" \
-e OPENAI_API_KEY="${{ secrets.OPENAI_API_KEY }}" \
-v ${{ github.workspace }}/golden_datasets:/data \
my-registry.com/ai-oracle-runner:v2.1 \
pytest --junitxml=oracle-report.xml /scripts/evaluate.py
- name: 오라클 검증 리포트 PR 코멘트 작성 (Report to PR)
if: always() # 실패하더라도 리포트는 생성
uses: mikepenz/action-junit-report@v3
with:
report_paths: 'oracle-report.xml'
2. Jenkins (Jenkinsfile) 통합 예시
엔터프라이즈의 무거운 파이프라인과 복잡한 승인 관문을 제어하는 Jenkins에서는, 선언형(Declarative) 파이프라인 내의 한 Stage로 오라클을 배치하고 실패 시 명확한 currentBuild.result = 'FAILURE'를 선언한다.
// Jenkinsfile
pipeline {
agent { docker { image 'my-registry.com/ai-oracle-runner:v2.1' } }
environment {
OPENAI_API_KEY = credentials('openai-oracle-key')
}
stages {
stage('Oracle Quality Gate') {
steps {
script {
echo "Initiating Deterministic Validation Sequence..."
// 오라클 실행: 1개라도 환각/포맷 에러가 발생하면 exit 1을 반환
def evalStatus = sh(script: 'python -m pytest /scripts/evaluate.py', returnStatus: true)
if (evalStatus != 0) {
// 오라클 관문 통과 실패 시 배포 파이프라인 즉시 차단
error("Pipeline Aborted: Oracle Validation Failed. Check hallucination metrics.")
}
}
}
}
}
post {
always {
junit '**/oracle_results.xml'
archiveArtifacts artifacts: 'oracle_debug_logs/*.json', allowEmptyArchive: true
}
}
}
3. GitLab CI (.gitlab-ci.yml) 통합 예시
GitLab CI는 Docker-in-Docker(DinD) 구조가 잘 발달되어 있어, 오라클 이미지를 서비스 컨테이너와 묶어 통합 테스트를 수행하기에 매우 강력하다.
# .gitlab-ci.yml
stages:
- build
- oracle-validation
- deploy
run_oracle_quality_gate:
stage: oracle-validation
image: my-registry.com/ai-oracle-runner:v2.1
services:
# 테스트 대상인 신규 AI 모델 컨테이너를 함께 띄움
- name: my-registry.com/llm-app-candidate:latest
alias: target-llm
variables:
LLM_API_URL: "http://target-llm:8000"
script:
- echo "Executing Golden Dataset against Target LLM..."
- pytest --maxfail=1 /scripts/evaluate.py
artifacts:
when: always
reports:
junit: oracle-report.xml
# 오라클 에러 발생 시 이 Stage에서 파이프라인은 '빨간색'으로 강제 종료된다.
모든 스크립트의 본질은 “오라클의 명령이 실패(Exit Code != 0)하면 파이프라인의 숨통을 즉각 끊어버린다“는 강제성에 있다. 이것이 바로 CI 도구가 제공하는 가장 물리적이고 확실한 ’결정론적 방패’다.