name: CI — Build & Push Scenario Images on: push: branches: [main] paths: - 'scenario-*/Dockerfile' - 'scenario-*/parent.py' - 'scenario-*/gpu_worker*.py' - 'scripts/observe.sh' - 'scripts/prestop.sh' - '.gitea/workflows/ci.yaml' # 수동 트리거 — Gitea Actions UI 또는 API에서 실행 가능 workflow_dispatch: jobs: build-and-push: runs-on: ubuntu-latest strategy: matrix: include: - scenario: scenario-1-nofix tag: nofix - scenario: scenario-2-tini-only tag: tini - scenario: scenario-4-fullfix tag: fullfix steps: - name: Checkout uses: actions/checkout@v4 - name: Set image tag run: | SHORT_SHA=$(echo ${GITHUB_SHA} | cut -c1-7) echo "SHA_TAG=${{ matrix.tag }}-sha-${SHORT_SHA}" >> $GITHUB_ENV - name: Login to Harbor run: | for i in 1 2 3; do echo '${{ secrets.REGISTRY_PASSWORD }}' | \ docker login ${{ secrets.REGISTRY_URL }} \ -u ${{ secrets.REGISTRY_USER }} --password-stdin && break echo "Retry $i..."; sleep 5 done - name: Prepare build context (observe.sh + prestop.sh 포함) run: | cp scripts/observe.sh ${{ matrix.scenario }}/observe.sh # prestop.sh는 tini/fullfix 이미지에만 필요하지만, # 모든 컨텍스트에 복사해두고 Dockerfile COPY 여부로 제어 (nofix는 미사용) cp scripts/prestop.sh ${{ matrix.scenario }}/prestop.sh - name: Build & push image run: | IMAGE=${{ secrets.REGISTRY_URL }}/aipf/gpu-zombie-test docker build \ -t ${IMAGE}:${{ env.SHA_TAG }} \ -t ${IMAGE}:${{ matrix.tag }} \ ${{ matrix.scenario }} docker push ${IMAGE}:${{ env.SHA_TAG }} docker push ${IMAGE}:${{ matrix.tag }}