Skip to content

build juicefs image #265

build juicefs image

build juicefs image #265

name: build juicefs image
on:
workflow_dispatch:
inputs:
ce_juicefs_build_version:
description: 'ce juicefs version for image build'
required: false
type: string
schedule:
- cron: "0 0 * * *"
jobs:
publish-ce-mount-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Login Docker Hub
env:
PASSWORD: ${{ secrets.DOCKERHUB_FUSE_ACCESS_TOKEN }}
run: docker login --username chnliyong --password ${PASSWORD}
- name: check latest tag
continue-on-error: true
env:
JUICEFS_BUILD_VERSION: ${{ inputs.ce_juicefs_build_version }}
run: |
if [ ${{ env.JUICEFS_BUILD_VERSION }} ]; then
echo "JUICEFS_CE_LATEST_VERSION=${{ env.JUICEFS_BUILD_VERSION }}" >> $GITHUB_ENV
echo "MOUNT_IMAGE_EXIST=false" >> $GITHUB_ENV
else
JUICEFS_CE_LATEST_VERSION=$(curl -fsSL https://api.github.com/repos/juicedata/juicefs/releases/latest | grep tag_name | grep -oE 'v[0-9]+\.[0-9][0-9]*(\.[0-9]+(-[0-9a-z]+)?)?')
if [ -z "$JUICEFS_CE_LATEST_VERSION" ]; then
echo "Failed to get juicefs ce version"
exit 1
fi
echo "mount image is juicedata/mount:ce-${JUICEFS_CE_LATEST_VERSION}"
echo "MOUNT_IMAGE_EXIST=false" >> $GITHUB_ENV
echo "JUICEFS_CE_LATEST_VERSION=$JUICEFS_CE_LATEST_VERSION" >> $GITHUB_ENV
docker pull juicedata/mount:ce-${JUICEFS_CE_LATEST_VERSION}
rst=$?
if [ $rst -eq 0 ]; then
echo "MOUNT_IMAGE_EXIST=true" >> $GITHUB_ENV
fi
fi
- name: Build and Push juicefs latest image
env:
CEVERSION: latest
run: |
JUICEFS_CE_LATEST_VERSION=$(curl -fsSL https://api.github.com/repos/juicedata/juicefs/releases/latest | grep tag_name | grep -oE 'v[0-9]+\.[0-9][0-9]*(\.[0-9]+(-[0-9a-z]+)?)?')
if [ -z "$JUICEFS_CE_LATEST_VERSION" ]; then
echo "Failed to get juicefs ce version"
exit 1
fi
docker pull juicedata/mount:ce-${JUICEFS_CE_LATEST_VERSION}
rst=$?
if [ $rst -eq 0 ]; then
echo "JuiceFS latest image already exists"
else
echo "Build JuiceFS latest image"
export CEJUICEFS_VERSION=${JUICEFS_CE_LATEST_VERSION}
make -C docker ce-image
fi
- name: Buildx and Push juicefs image
env:
CEVERSION: ce-${{ env.JUICEFS_CE_LATEST_VERSION }}
CEJUICEFS_VERSION: ${{ env.JUICEFS_CE_LATEST_VERSION }}
run: |
image_exist=${{ env.MOUNT_IMAGE_EXIST }}
if [ $image_exist == "false" ]; then
echo "Build JuiceFS new version image: $JUICEFS_CE_LATEST_VERSION"
export DOCKER_CLI_EXPERIMENTAL=enabled
docker run --rm --privileged docker/binfmt:66f9012c56a8316f9244ffd7622d7c21c1f6f28d
docker buildx create --use --name mybuilder
make -C docker ce-image-buildx
make -C docker fuse-ce-image-buildx
else
echo "JuiceFS mount ce version image $JUICEFS_CE_LATEST_VERSION already exists"
fi
- name: Setup upterm session
if: ${{ failure() }}
timeout-minutes: 60
uses: lhotari/action-upterm@v1
publish-ee-mount-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Login Docker Hub
env:
PASSWORD: ${{ secrets.DOCKERHUB_FUSE_ACCESS_TOKEN }}
run: docker login --username chnliyong --password ${PASSWORD}
- name: check latest tag
continue-on-error: true
run: |
JUICEFS_EE_LATEST_VERSION=$(curl -sSL https://juicefs.com/static/juicefs -o juicefs-ee && chmod +x juicefs-ee && ./juicefs-ee version | cut -d' ' -f3)
if [ -z "$JUICEFS_EE_LATEST_VERSION" ]; then
echo "Failed to get juicefs ee version"
exit 1
fi
echo "mount image is juicedata/mount:ee-$JUICEFS_EE_LATEST_VERSION"
echo "MOUNT_IMAGE_EXIST=false" >> $GITHUB_ENV
echo "JUICEFS_EE_LATEST_VERSION=$JUICEFS_EE_LATEST_VERSION" >> $GITHUB_ENV
docker pull juicedata/mount:ee-$JUICEFS_EE_LATEST_VERSION
rst=$?
if [ $rst -eq 0 ]; then
echo "MOUNT_IMAGE_EXIST=true" >> $GITHUB_ENV
fi
- name: Buildx and Push juicefs image
env:
EEVERSION: ee-${{ env.JUICEFS_EE_LATEST_VERSION }}
run: |
image_exist=${{ env.MOUNT_IMAGE_EXIST }}
if [ $image_exist == "false" ]; then
echo "Build JuiceFS new version image"
export DOCKER_CLI_EXPERIMENTAL=enabled
docker run --rm --privileged docker/binfmt:66f9012c56a8316f9244ffd7622d7c21c1f6f28d
docker buildx create --use --name mybuilder
make -C docker ee-image-buildx
make -C docker fuse-ee-image-buildx
else
echo "JuiceFS mount ee version image already exists"
fi
- name: Setup upterm session
if: ${{ failure() }}
timeout-minutes: 60
uses: lhotari/action-upterm@v1