@@ -16,6 +16,7 @@ RESULT_FILE=result.txt
16
16
RESULT_CSV=result.csv
17
17
NYDUSIFY_BIN=$( which nydusify)
18
18
NYDUS_IMAGE_BIN=$( which nydus-image)
19
+ BENCH_CONFIG=bench.yaml
19
20
20
21
# ########################################################
21
22
# Could alert value via arguments
@@ -25,7 +26,7 @@ RESULT_DIR=data
25
26
SOURCE_REGISTRY=docker.io/library
26
27
TARGET_REGISTRY=" "
27
28
SKIP=false
28
- IMAGES_PATH=hello_bench_image_list .txt
29
+ IMAGES_PATH=image_list .txt
29
30
30
31
# ########################################################
31
32
# Push OCI image to TARGET_REGISTRY
@@ -62,18 +63,24 @@ function convert() {
62
63
63
64
image=$1
64
65
66
+ name=$( echo ${image} | awk -F: ' {print $1}' )
67
+ tag=$( echo ${image} | awk -F: ' {print $2}' )
68
+ if [[ " ${tag} " == " " ]]; then
69
+ tag=latest
70
+ fi
71
+
65
72
sudo nerdctl pull ${TARGET_REGISTRY} /${image}
66
- echo " [INFO] Converting ${TARGET_REGISTRY} /${image} to ${TARGET_REGISTRY} /${image} : nydusv6 ..."
73
+ echo " [INFO] Converting ${TARGET_REGISTRY} /${image} to ${TARGET_REGISTRY} /${name} : ${tag} - nydusv6 ..."
67
74
echo " sudo $NYDUSIFY_BIN convert \
68
75
--fs-version 6 \
69
76
--nydus-image $NYDUS_IMAGE_BIN \
70
77
--source ${TARGET_REGISTRY} /${image} \
71
- --target ${TARGET_REGISTRY} /${image} : nydusv6"
78
+ --target ${TARGET_REGISTRY} /${name} : ${tag} - nydusv6"
72
79
sudo $NYDUSIFY_BIN convert \
73
80
--fs-version 6 \
74
81
--nydus-image $NYDUS_IMAGE_BIN \
75
82
--source ${TARGET_REGISTRY} /${image} \
76
- --target ${TARGET_REGISTRY} /${image} : nydusv6
83
+ --target ${TARGET_REGISTRY} /${name} : ${tag} - nydusv6
77
84
}
78
85
79
86
# ########################################################
@@ -112,6 +119,12 @@ function stop_all_containers {
112
119
function run() {
113
120
image=$1
114
121
122
+ name=$( echo ${image} | awk -F: ' {print $1}' )
123
+ tag=$( echo ${image} | awk -F: ' {print $2}' )
124
+ if [[ " ${tag} " == " " ]]; then
125
+ tag=latest
126
+ fi
127
+
115
128
stop_all_containers
116
129
sudo nerdctl ps -a | awk ' NR>1 {print $1}' | xargs sudo nerdctl rm > /dev/null 2>&1
117
130
sudo nerdctl container prune -f
@@ -121,7 +134,7 @@ function run() {
121
134
122
135
echo " [INFO] Run hello bench in ${image} ..."
123
136
sudo nerdctl --snapshotter overlayfs rmi -f ${TARGET_REGISTRY} /${image} > /dev/null 2>&1
124
- result=$( sudo ./hello.py --engine nerdctl --snapshotter overlayfs --op run \
137
+ result=$( sudo ./hello.py --bench-config= ${BENCH_CONFIG} -- engine nerdctl --snapshotter overlayfs --op run \
125
138
--registry=${TARGET_REGISTRY} \
126
139
--images ${image} |
127
140
grep " repo" )
@@ -130,16 +143,16 @@ function run() {
130
143
echo " [INFO] Remove image ${TARGET_REGISTRY} /${image} ..."
131
144
sudo nerdctl --snapshotter overlayfs rmi -f ${TARGET_REGISTRY} /${image} > /dev/null 2>&1
132
145
133
- echo " [INFO] Run hello bench in ${image} : nydusv6 ..."
134
- sudo nerdctl --snapshotter nydus rmi -f ${TARGET_REGISTRY} /${image} : nydusv6 > /dev/null 2>&1
135
- result=$( sudo ./hello.py --engine nerdctl --snapshotter nydus --op run \
146
+ echo " [INFO] Run hello bench in ${name} : ${tag} - nydusv6 ..."
147
+ sudo nerdctl --snapshotter nydus rmi -f ${TARGET_REGISTRY} /${name} : ${tag} - nydusv6 > /dev/null 2>&1
148
+ result=$( sudo ./hello.py --bench-config= ${BENCH_CONFIG} -- engine nerdctl --snapshotter nydus --op run \
136
149
--registry=${TARGET_REGISTRY} \
137
- --images ${image} : nydusv6 |
150
+ --images ${name} : ${tag} - nydusv6 |
138
151
grep " repo" )
139
152
echo ${result}
140
153
echo ${result} >> ${RESULT_DIR} /${RESULT_FILE} .${CURRENT_ROUND}
141
- echo " [INFO] Remove image ${TARGET_REGISTRY} /${image} : nydusv6 ..."
142
- sudo nerdctl --snapshotter nydus rmi -f ${TARGET_REGISTRY} /${image} : nydusv6 > /dev/null 2>&1
154
+ echo " [INFO] Remove image ${TARGET_REGISTRY} /${name} : ${tag} - nydusv6 ..."
155
+ sudo nerdctl --snapshotter nydus rmi -f ${TARGET_REGISTRY} /${name} : ${tag} - nydusv6 > /dev/null 2>&1
143
156
}
144
157
145
158
# ########################################################
@@ -219,6 +232,7 @@ function usage() {
219
232
echo " Usage:"
220
233
echo -e " run.sh -o OPERATION -s SOURCE_REGISTRY -t TARGET_REGISTRY [other options]
221
234
[-o operation] \tavailable options are [ push convert run all draw ]
235
+ [-c config] \tbench config file (only available for \" run\" operation)
222
236
[-i images] \timages list
223
237
[-p images path] \tfile path that contains images list (line by line)
224
238
[-s source registry] \tsource registry for pulling image
@@ -243,7 +257,7 @@ if [ $# -eq 0 ]; then
243
257
usage
244
258
fi
245
259
246
- while getopts o:i:p:s:t:r:d:kh OPT; do
260
+ while getopts o:c: i:p:s:t:r:d:k:h OPT; do
247
261
case $OPT in
248
262
o)
249
263
operation=${OPTARG}
@@ -252,6 +266,9 @@ while getopts o:i:p:s:t:r:d:kh OPT; do
252
266
exit
253
267
fi
254
268
269
+ ;;
270
+ c)
271
+ BENCH_CONFIG=${OPTARG}
255
272
;;
256
273
i)
257
274
getopts_extra " $@ "
0 commit comments