Skip to content

[ci] Release mdsv2 prefix images #558

[ci] Release mdsv2 prefix images

[ci] Release mdsv2 prefix images #558

Workflow file for this run

name: CI Build
on:
push:
branches: [ "**" ]
tags:
- '*'
pull_request:
branches: [ "**" ]
env:
BUILD_TYPE: Release
jobs:
build:
if: ${{ !startsWith(github.ref, 'refs/heads/gh-readonly-queue/') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Copy dingofs repository
run: |
echo "Move dingofs repository"
sudo cp -r /home/runner/work/dingofs/dingofs /mnt/
sudo chown $USER:$USER /mnt/dingofs
- 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"
- name: Pull dingodatabase/dingo-eureka:rocky9-fs
run: |
docker pull dingodatabase/dingo-eureka:rocky9-fs
- name: Init build script
run: |
cat <<EOF > /mnt/dingofs/build.sh
#!/bin/bash
set -x
cd /opt/dingofs/
git config --global --add safe.directory /opt/dingofs
make file_dep
make file_build only=//src/* release=1 unit_tests=ON
# check if the build is successful
if [ $? -ne 0 ]
then
echo "build failed"
exit -1
fi
make file_deploy_config
# check install is successful
if [ $? -ne 0 ]
then
echo "install failed"
exit -1
fi
tar -czvf dingofs.tar.gz -C docker/rocky9 dingofs
echo "DingoFS Build finished"
EOF
chmod +x /mnt/dingofs/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:7}
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 DingoFS
run: |
echo "Build DingoFS"
docker run --name release-dingofs --rm -v /mnt/dingofs:/opt/dingofs/ dingodatabase/dingo-eureka:rocky9-fs /opt/dingofs/build.sh
- name: Copy artifactory to another workflow
uses: actions/upload-artifact@v4
with:
name: dingofs
path: /mnt/dingofs/dingofs.tar.gz
compression-level: 0
- name: Release
uses: softprops/action-gh-release@v2
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }}
with:
files: dingofs.tar.gz
name: ${{ env.TAG_NAME }}
tag_name: ${{ env.TAG_NAME }}
token: ${{ secrets.GH_TOKEN }}