Skip to content

Commit 7b774a0

Browse files
[cd] add docker image push to inner repo (#1447)
* Create docker-inner.yml * add lint before ut * update
1 parent 610bfe6 commit 7b774a0

2 files changed

Lines changed: 68 additions & 0 deletions

File tree

.github/workflows/docker-inner.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: publish-docker-inner
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
image_tag:
7+
required: true
8+
description: 'Set docker image tag. Default is "latest", you can also set "auto" to genterate a formated tag, or input a manual tag'
9+
type: string
10+
default: auto
11+
torch_version:
12+
required: true
13+
description: 'Set docker torch version. Default is "2.8.0"'
14+
type: string
15+
default: '2.8.0'
16+
schedule:
17+
- cron: '00 14 * * 0-4'
18+
19+
jobs:
20+
publish_docker_image:
21+
runs-on: [docker-inner]
22+
env:
23+
IMAGE_NAME: 'registry.h.pjlab.org.cn/ailab-llmrazor/xtuner'
24+
IMAGE_TAG: ${{ inputs.image_tag || 'auto' }}
25+
TORCH_VERSION: ${{ inputs.torch_version || '2.8.0' }}
26+
SCHEDULE_TAG: 'pt28_latest'
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v3
30+
- name: Parse tag
31+
run: |
32+
if [[ "${GITHUB_EVENT_NAME}" == 'schedule' ]]; then
33+
IMAGE_TAG="${SCHEDULE_TAG}"
34+
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV
35+
elif [[ "${IMAGE_TAG}" == 'auto' ]]; then
36+
DATE_TODAY="$(date +'%Y%m%d')"
37+
COMMIT_SHA="$(git rev-parse --short HEAD)"
38+
IMAGE_TAG="pt$(echo ${TORCH_VERSION} | awk -F. '{print $1$2}')_${DATE_TODAY}_${COMMIT_SHA}"
39+
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV
40+
fi
41+
echo "DOCKER_TAG=${IMAGE_NAME}:${IMAGE_TAG}" >> $GITHUB_ENV
42+
- name: Build image
43+
run: |
44+
cat ${{vars.EXTRA_DOCKERFILE}} >> ${{ github.workspace }}/Dockerfile
45+
echo "IMAGE_NAME: ${IMAGE_NAME}, IMAGE_TAG: ${IMAGE_TAG}"
46+
bash ${{ github.workspace }}/image_build.sh
47+
echo "Built image with tag: ${DOCKER_TAG}"
48+
- name: Push to cluster
49+
run: |
50+
echo "$DOCKER_TAG"
51+
docker login registry.h.pjlab.org.cn -p ${{ secrets.CLUSTER_DOCKERHUB_TOKEN }} -u ${{ secrets.CLUSTER_DOCKERHUB_USERNAME }}
52+
docker push $DOCKER_TAG

.github/workflows/unit_test.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,24 @@ concurrency:
2020
cancel-in-progress: true
2121

2222
jobs:
23+
lint:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v2
27+
- name: Set up Python 3.12
28+
uses: actions/setup-python@v2
29+
with:
30+
python-version: 3.12
31+
- name: Install pre-commit hook
32+
run: |
33+
pip install pre-commit
34+
pre-commit install
35+
- name: Linting
36+
run: pre-commit run --files $(find xtuner/v1)
37+
2338
unit_test:
2439
runs-on: [h_cluster]
40+
needs: lint
2541
steps:
2642
- name: mask env
2743
run: |

0 commit comments

Comments
 (0)