1- name : Build and push sglang and sglang -router to Harbor
1+ name : Build and push sglang-router to Harbor
22
33on :
44 push :
55 tags :
6- - ' aa/release /*'
6+ - ' aa/test /*'
77
88permissions :
99 contents : read
1010
11- env :
12- HARBOR_HOST : harbor.management-prod01.stackit.run
13- CONTAINER_REPOSITORY : inference-images
14-
1511jobs :
16- build-and-push :
17- # This runner has VPN access, which Harbor requires
18- runs-on : cpu-runner-16c-64gb-01
19- strategy :
20- fail-fast : true
21- max-parallel : 1
22- matrix :
23- include :
24- - image_name : sglang
25- dockerfile : docker/Dockerfile.aa_sglang
26- - image_name : sglang-router
27- dockerfile : docker/Dockerfile.aa_sgl_router
28-
29- env :
30- IMAGE_NAME : ${{ matrix.image_name }}
31- DOCKERFILE : ${{ matrix.dockerfile }}
12+ meta :
13+ runs-on : cpu-runner-8c-32gb-01
14+ outputs :
15+ version : ${{ steps.ver.outputs.version }}
16+ should_run : ${{ steps.ver.outputs.should_run }}
3217 steps :
33- - name : Checkout
34- uses : actions/checkout@v4
35- with :
36- fetch-depth : 0
37-
38- - name : Derive version and image refs
39- id : meta
18+ - name : Compute version with datetime suffix
19+ id : ver
20+ shell : bash
4021 run : |
41- RELEASE_VERSION="${GITHUB_REF_NAME#aa/release/}"
42- echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV
43- SHORT_SHA="${GITHUB_SHA::12}"
44- echo "SHORT_SHA=${SHORT_SHA}" >> $GITHUB_ENV
45- DATETIME="$(date -u +%Y%m%d-%H%M%S)"
46- echo "DATETIME=${DATETIME}" >> $GITHUB_ENV
47- IMAGE="${HARBOR_HOST}/${CONTAINER_REPOSITORY}/${IMAGE_NAME}"
48- echo "IMAGE=${IMAGE}" >> $GITHUB_ENV
49- echo "VERSION_TAG=${IMAGE}:${RELEASE_VERSION}-${DATETIME}" >> $GITHUB_ENV
50- echo "BUILD_CACHE=${IMAGE}:buildcache-ci" >> $GITHUB_ENV
51-
52- - name : Set up Docker Buildx
53- uses : docker/setup-buildx-action@v3
54-
55- - name : Login to Harbor
56- uses : docker/login-action@v3
57- with :
58- registry : ${{ env.HARBOR_HOST }}
59- username : ${{ vars.HARBOR_USER }}
60- password : ${{ secrets.HARBOR_PASS }}
61-
62- - name : Build and push to Harbor
63- uses : docker/build-push-action@v6
64- with :
65- context : .
66- file : ${{ env.DOCKERFILE }}
67- push : true
68- tags : |
69- ${{ env.VERSION_TAG }}
70- labels : |
71- org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
72- org.opencontainers.image.revision=${{ github.sha }}
73- org.opencontainers.image.version=${{ env.RELEASE_VERSION }}
22+ REF_NAME="${GITHUB_REF_NAME}"
23+ if [[ "$REF_NAME" == aa/release/* ]]; then
24+ BASE_VERSION="${REF_NAME#aa/release/}"
25+ DT="$(date -u +%Y%m%dT%H%M%SZ)"
26+ echo "version=${BASE_VERSION}-${DT}" >> "$GITHUB_OUTPUT"
27+ echo "should_run=true" >> "$GITHUB_OUTPUT"
28+ else
29+ echo "Non-release ref: $REF_NAME. Skipping publish." >&2
30+ echo "should_run=false" >> "$GITHUB_OUTPUT"
31+ fi
32+ build-and-publish :
33+ if : ${{ needs.meta.outputs.should_run == 'true' }}
34+ needs : meta
35+ permissions :
36+ contents : read
37+ id-token : write
38+ uses : Aleph-Alpha/shared-workflows/.github/workflows/build-and-push.yaml@a7c73c4e95557755ef409b1d2906ab94fc73d90a
39+ with :
40+ registry : ${{ vars.REGISTRY }}
41+ image_repository : inference-images/sglang-router
42+ version : ${{ needs.meta.outputs.version }}
43+ push : true
44+ containerfile : ./docker/Dockerfile.sgl_router
45+ context : .
0 commit comments