Skip to content

Refactor docker compose of the dataprep microservice (#1227) #363

Refactor docker compose of the dataprep microservice (#1227)

Refactor docker compose of the dataprep microservice (#1227) #363

# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
name: Build latest images on push event
on:
push:
branches: ["main"]
paths:
- 'comps/**'
- 'src/**'
- '.github/workflows/docker/compose/**'
- '!**/*.md'
- '!**/*.txt'
- '**/requirements.txt'
- '.github/workflows/push-image-build.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-on-push
cancel-in-progress: true
jobs:
get-build-matrix:
runs-on: ubuntu-latest
outputs:
services: ${{ steps.get-services.outputs.services }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Test Services
id: get-services
run: |
base_commit=$(git rev-parse HEAD~1)
merged_commit=$(git log -1 --format='%H')
# git diff --name-only ${base_commit} ${merged_commit} | grep -E "cores|comps/__init__.py" | grep -Ev ".md"
# if [ $? -eq 0 ]; then
if git diff --name-only ${base_commit} ${merged_commit} | grep -E "cores|comps/__init__.py" | grep -Ev ".md"; then
echo "ALL image build!!!"
services=$(basename -a .github/workflows/docker/compose/*-compose.yaml | sed 's/-compose.yaml//' | jq -R '.' )
else
changed_src="$(git diff --name-only ${base_commit} ${merged_commit} | grep 'src/' | grep -vE '\.md')" || true
changed_yamls="$(git diff --name-only ${base_commit} ${merged_commit} | grep '.github/workflows/docker/compose/')" || true
services=$(printf '%s\n' "${changed_src[@]}" | cut -d'/' -f2 | grep -vE '\.py' | sort -u | jq -R '.' ) || true
while IFS= read -r line; do
filename=$(basename "$line" -compose.yaml)
echo "$line $(printf '%s\n' "$filename" | jq -R '.' )"
services+=" $(printf '%s\n' "$filename" | jq -R '.' )" || true
done <<< "$changed_yamls"
fi
echo "services=$(echo "$services" | jq -sc 'unique | sort')"
echo "services=$(echo "$services" | jq -sc 'unique | sort')" >> $GITHUB_OUTPUT
continue-on-error: true
image-build:
needs: get-build-matrix
strategy:
matrix:
service: ${{ fromJSON(needs.get-build-matrix.outputs.services) }}
node: [xeon, gaudi]
runs-on: docker-build-${{ matrix.node }}
continue-on-error: true
steps:
- name: Clean up Working Directory
run: |
sudo rm -rf ${{github.workspace}}/*
- name: Checkout out Repo
uses: actions/checkout@v4
- name: Check Docker Compose File Exists
env:
service: ${{ matrix.service }}
run: |
docker_compose_path="${{ github.workspace }}/.github/workflows/docker/compose/${service}-compose.yaml"
if [ -e $docker_compose_path ]; then
echo "file_exists=true" >> $GITHUB_ENV
echo "docker_compose_path=${docker_compose_path}" >> $GITHUB_ENV
else
echo "file_exists=false" >> $GITHUB_ENV
echo "docker_compose_path=${docker_compose_path} for this service does not exist, so skipping image build for this service!!!"
fi
if [[ $(grep -c "vllm-openvino:" ${docker_compose_path}) != 0 ]]; then
git clone https://github.com/vllm-project/vllm.git vllm-openvino
cd ./vllm-openvino && git checkout v0.6.1 && git rev-parse HEAD && cd ../
fi
if [[ $(grep -c "vllm-gaudi:" ${docker_compose_path}) != 0 ]]; then
git clone --depth 1 --branch v0.6.4.post2+Gaudi-1.19.0 https://github.com/HabanaAI/vllm-fork.git
sed -i 's/triton/triton==3.1.0/g' vllm-fork/requirements-hpu.txt
fi
- name: Build Image
if: env.file_exists == 'true'
uses: opea-project/validation/actions/image-build@main
with:
work_dir: ${{ github.workspace }}
docker_compose_path: ${{ env.docker_compose_path }}
registry: ${OPEA_IMAGE_REPO}opea