-
Notifications
You must be signed in to change notification settings - Fork 84
217 lines (206 loc) · 8.52 KB
/
juicefs-image.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
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: |
set +e
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 "JUICEFS_CE_LATEST_VERSION=$JUICEFS_CE_LATEST_VERSION" >> $GITHUB_ENV
echo "mount image is juicedata/mount:ce-${JUICEFS_CE_LATEST_VERSION}"
echo "MOUNT_IMAGE_EXIST=false" >> $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
ACR_TOKEN: ${{ secrets.ACR_TOKEN }}
ACR_USERNAME: ${{ secrets.ACR_USERNAME }}
run: |
image_exist=${{ env.MOUNT_IMAGE_EXIST }}
if [ $image_exist == "false" ]; then
if [[ ${JUICEFS_CE_LATEST_VERSION:0:4} != "v1.1" ]]; then
echo "Build JuiceFS latest image"
export CEJUICEFS_VERSION=${JUICEFS_CE_LATEST_VERSION}
make -C docker ce-image
${GITHUB_WORKSPACE}/.github/scripts/sync.sh mount
fi
else
echo "JuiceFS latest image already exists"
fi
- name: Build juicefs image
env:
CEVERSION: ce-${{ env.JUICEFS_CE_LATEST_VERSION }}
IMAGE_TAG: ce-${{ env.JUICEFS_CE_LATEST_VERSION }}
CEJUICEFS_VERSION: ${{ env.JUICEFS_CE_LATEST_VERSION }}
ACR_TOKEN: ${{ secrets.ACR_TOKEN }}
ACR_USERNAME: ${{ secrets.ACR_USERNAME }}
run: |
mount_image_exist=${{ env.MOUNT_IMAGE_EXIST }}
export DOCKER_CLI_EXPERIMENTAL=enabled
docker run --rm --privileged docker/binfmt:66f9012c56a8316f9244ffd7622d7c21c1f6f28d
docker buildx create --use --name mybuilder
if [ $mount_image_exist == "false" ]; then
echo "Build JuiceFS new version image: $JUICEFS_CE_LATEST_VERSION"
if [[ ${JUICEFS_CE_LATEST_VERSION:0:4} == "v1.1" ]]; then
make -C docker ce-image-1.1-buildx
else
make -C docker ce-image-buildx
fi
else
echo "JuiceFS mount ce version image $JUICEFS_CE_LATEST_VERSION already exists"
fi
- name: sync image
env:
IMAGE_TAG: ce-${{ env.JUICEFS_CE_LATEST_VERSION }}
ACR_TOKEN: ${{ secrets.ACR_TOKEN }}
ACR_USERNAME: ${{ secrets.ACR_USERNAME }}
run: |
cd ${GITHUB_WORKSPACE}/.github/scripts/
./sync.sh mount ${{ env.IMAGE_TAG }}
- name: Setup upterm session
if: ${{ failure() }}
timeout-minutes: 60
uses: lhotari/action-upterm@v1
publish-ee-4_0-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: |
set +e
JUICEFS_EE_LATEST_VERSION=$(curl -sSL https://juicefs.com/static/Linux/mount.4.9 -o juicefs-ee && chmod +x juicefs-ee && ./juicefs-ee -V | cut -d' ' -f3)
if [ -z "$JUICEFS_EE_LATEST_VERSION" ]; then
echo "Failed to get juicefs ee version"
exit 1
fi
echo "JUICEFS_EE_LATEST_VERSION=$JUICEFS_EE_LATEST_VERSION" >> $GITHUB_ENV
echo "mount image is juicedata/mount:ee-$JUICEFS_EE_LATEST_VERSION"
echo "MOUNT_IMAGE_EXIST=false" >> $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 }}
IMAGE_TAG: ee-${{ env.JUICEFS_EE_LATEST_VERSION }}
ACR_TOKEN: ${{ secrets.ACR_TOKEN }}
ACR_USERNAME: ${{ secrets.ACR_USERNAME }}
run: |
mount_image_exist=${{ env.MOUNT_IMAGE_EXIST }}
export DOCKER_CLI_EXPERIMENTAL=enabled
docker run --rm --privileged docker/binfmt:66f9012c56a8316f9244ffd7622d7c21c1f6f28d
docker buildx create --use --name mybuilder
if [ $mount_image_exist == "false" ]; then
echo "Build JuiceFS new version image"
make -C docker ee-image-4.0-buildx
else
echo "JuiceFS mount ee version image already exists"
fi
- name: sync image
env:
IMAGE_TAG: ee-${{ env.JUICEFS_EE_LATEST_VERSION }}
ACR_TOKEN: ${{ secrets.ACR_TOKEN }}
ACR_USERNAME: ${{ secrets.ACR_USERNAME }}
run: |
cd ${GITHUB_WORKSPACE}/.github/scripts/
./sync.sh mount ${{ env.IMAGE_TAG }}
- name: Setup upterm session
if: ${{ failure() }}
timeout-minutes: 60
uses: lhotari/action-upterm@v1
publish-ee-5_0-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: |
set +e
curl -sSL https://static.juicefs.com/release/bin_pkgs/latest_stable_full.tar.gz | tar -xz
version=$(grep -oP 'mount_version=\K.*' version.ini)
hash=$(./Linux/mount version | awk -F '[()]' '{print $2}' | awk '{print $NF}')
JUICEFS_EE_LATEST_VERSION=$version-$hash
if [ -z "$JUICEFS_EE_LATEST_VERSION" ]; then
echo "Failed to get juicefs ee version"
exit 1
fi
echo "JUICEFS_EE_LATEST_VERSION=$JUICEFS_EE_LATEST_VERSION" >> $GITHUB_ENV
echo "mount image is juicedata/mount:ee-$JUICEFS_EE_LATEST_VERSION"
echo "MOUNT_IMAGE_EXIST=false" >> $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 }}
IMAGE_TAG: ee-${{ env.JUICEFS_EE_LATEST_VERSION }}
ACR_TOKEN: ${{ secrets.ACR_TOKEN }}
ACR_USERNAME: ${{ secrets.ACR_USERNAME }}
run: |
mount_image_exist=${{ env.MOUNT_IMAGE_EXIST }}
export DOCKER_CLI_EXPERIMENTAL=enabled
docker run --privileged --rm tonistiigi/binfmt:qemu-v6.2.0 --uninstall qemu-*
docker run --privileged --rm tonistiigi/binfmt:qemu-v6.2.0 --install all
docker buildx create --use --name mybuilder
if [ $mount_image_exist == "false" ]; then
echo "Build JuiceFS new version image"
make -C docker ee-image-buildx
else
echo "JuiceFS mount ee version image already exists"
fi
- name: sync image
env:
IMAGE_TAG: ee-${{ env.JUICEFS_EE_LATEST_VERSION }}
ACR_TOKEN: ${{ secrets.ACR_TOKEN }}
ACR_USERNAME: ${{ secrets.ACR_USERNAME }}
run: |
cd ${GITHUB_WORKSPACE}/.github/scripts/
./sync.sh mount ${{ env.IMAGE_TAG }}
- name: Setup upterm session
if: ${{ failure() }}
timeout-minutes: 60
uses: lhotari/action-upterm@v1