Skip to content

[ci][docker] Tag images with short commit id #236

[ci][docker] Tag images with short commit id

[ci][docker] Tag images with short commit id #236

Workflow file for this run

name: CMake_rocky8
on:
push:
branches: [ "main", "develop", "quickBI-v3.0.0" ]
pull_request:
branches: [ "main", "develop", "quickBI-v3.0.0" ]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: RelWithDebInfo
jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Copy dingo-store repository
run: |
echo "Move dingo-store repository"
sudo cp -r /home/runner/work/dingo-store/dingo-store /mnt/
sudo chown $USER:$USER /mnt/dingo-store
- name: Configure Docker data-root
run: |
sudo systemctl stop docker
sudo systemctl stop docker.socket
sudo mkdir -p /mnt/docker
echo '{ "data-root": "/mnt/docker" }' | sudo tee /etc/docker/daemon.json
if [ -d /var/lib/docker ]; then
sudo mv /var/lib/docker /mnt/docker || true
fi
sudo systemctl start docker.socket
sudo systemctl start docker
docker info | grep "Docker Root Dir"
echo "check disk space"
df -h
- name: Pull dingo-store-rocky-8-dev:eureka
run: |
docker pull dingodatabase/dingo-store-rocky-8-dev:eureka
- name: Init build script
run: |
cat <<EOF > /mnt/dingo-store/build.sh
#!/bin/bash
set -x
set -e
cd /opt/dingo-store/
git config --global --add safe.directory /opt/dingo-store
git submodule sync --recursive && git submodule update --init --recursive --progress
source /opt/intel/oneapi/setvars.sh
cmake -B ./build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DTHIRD_PARTY_BUILD_TYPE=RelWithDebInfo -DWITH_DISKANN=ON -DWITH_MKL=ON -DDISKANN_DEPEND_ON_SYSTEM=OFF -DBUILD_UNIT_TESTS=OFF -DBRPC_ENABLE_CPU_PROFILER=OFF -DDINGO_BUILD_STATIC=OFF -DLINK_TCMALLOC=ON -DCMAKE_CXX_STANDARD=23 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cmake --build ./build
# check if the build is successful
if [ $? -ne 0 ]
then
echo "build failed"
exit -1
fi
tar -czvf dingo-store.tar.gz scripts build/bin/dingodb* conf/
echo "dingo-store Build finished"
echo "check server disk size"
df -h
EOF
chmod +x /mnt/dingo-store/build.sh
- name: Record event type
run: |
branchName=$(echo "${{ github.ref_name }}")
echo "branch name is: $branchName"
echo "$branchName" > branch_name.txt
commitId="${{ github.sha }}"
shortCommitId=${commitId:0:8}
echo "commit id is: $shortCommitId"
echo "$shortCommitId" > commit_id.txt
echo "hello dingofs" > event.txt
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "pull_request" > event.txt
elif [ "${{ github.event_name }}" == "push" ]; then
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
echo "tag" > event.txt
tagInfo=$(echo "${{ github.ref }}" | sed 's/refs\/tags\///')
echo "$tagInfo" > tag_name.txt
echo "TAG_NAME=$tagInfo" >> $GITHUB_ENV
else
echo "push" > event.txt
echo "TAG_NAME=latest" >> $GITHUB_ENV
fi
fi
- name: Save event type info
uses: actions/upload-artifact@v4
with:
name: event
path: event.txt
compression-level: 0
- name: Save tag name info
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
uses: actions/upload-artifact@v4
with:
name: tag_name
path: tag_name.txt
compression-level: 0
- name: Save branch name info
uses: actions/upload-artifact@v4
with:
name: branch_name
path: branch_name.txt
compression-level: 0
- name: Save commit id info
uses: actions/upload-artifact@v4
with:
name: commit_id
path: commit_id.txt
compression-level: 0
- name: Build dingo-store
run: |
echo "Build dingo-store"
docker run --name release-dingo-store --rm -v /mnt/dingo-store:/opt/dingo-store/ dingodatabase/dingo-store-rocky-8-dev:eureka /opt/dingo-store/build.sh
- name: copy artifactory to another workflow
uses: actions/upload-artifact@v4
with:
name: dingo-store.tar.gz
path: /mnt/dingo-store/dingo-store.tar.gz