Skip to content

Commit

Permalink
perf: 离线镜像校验
Browse files Browse the repository at this point in the history
  • Loading branch information
wojiushixiaobai committed Dec 29, 2023
1 parent 3487dd2 commit 67ffeb1
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ $ ./jmsctl.sh tail
[root@localhost config]# tree .
.
├── config.txt # 主配置文件
├── core
│ └── config.yml # core yml 格式配置文件,可以留空,使用 config.txt 设置
├── koko
│ └── config.yml # koko yml 格式配置文件,可以留空,使用 config.txt 设置
├── mysql
│ └── my.cnf # mysql 配置文件
|── mariadb
Expand Down
1 change: 0 additions & 1 deletion compose/docker-compose-celery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ services:
env_file:
- ${CONFIG_FILE}
volumes:
- ${CONFIG_DIR}/core/config.yml:/opt/jumpserver/config.yml
- ${CONFIG_DIR}/certs:/opt/jumpserver/data/certs
- ${VOLUME_DIR}/core/data:/opt/jumpserver/data
healthcheck:
Expand Down
1 change: 0 additions & 1 deletion compose/docker-compose-init-db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ services:
env_file:
- ${CONFIG_FILE}
volumes:
- ${CONFIG_DIR}/core/config.yml:/opt/jumpserver/config.yml
- ${CONFIG_DIR}/certs:/opt/jumpserver/data/certs
- ${VOLUME_DIR}/core/data:/opt/jumpserver/data
networks:
Expand Down
31 changes: 30 additions & 1 deletion scripts/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -651,13 +651,42 @@ function pull_image() {
echo ""
}

function check_images() {
images_to=$(get_images)
failed=0

for image in ${images_to}; do
if ! docker image inspect -f '{{ .Id }}' "$image" &> /dev/null; then
pull_image "$image"
fi
done
for image in ${images_to}; do
if ! docker image inspect -f '{{ .Id }}' "$image" &> /dev/null; then
echo_red "$(gettext 'Failed to pull image') ${image}"
failed=1
fi
done

if [ $failed -eq 1 ]; then
exit 1
fi
}

function pull_images() {
images_to=$(get_images)
pids=()

trap 'kill ${pids[*]}' SIGINT SIGTERM

for image in ${images_to}; do
pull_image "$image" &
pids+=($!)
done
wait
wait ${pids[*]}

trap - SIGINT SIGTERM

check_images
}

function installation_log() {
Expand Down

0 comments on commit 67ffeb1

Please sign in to comment.