isula-build/patch/0058-shellcheck-fix-of-common.sh.patch
jingxiaolu 16d4ded5e2 isula-build: sync for fix save multi-tags and tests update
Sync from upstream for:
- bugfix: fix save multiple tags single image failed
- tests:
  - pidofbuilder do not set when running a new bash script in new child process
  - shellcheck fix of common.sh
  - add integration tests for saving one image with multiple tags

Signed-off-by: jingxiaolu <lujingxiao@huawei.com>
2021-08-31 10:54:46 +08:00

91 lines
3.6 KiB
Diff

From 29ad6f4d4de67e143ba0ab7bba1ca3668cda9797 Mon Sep 17 00:00:00 2001
From: xingweizheng <xingweizheng@huawei.com>
Date: Tue, 24 Aug 2021 19:23:55 +0800
Subject: [PATCH 2/4] shellcheck fix of common.sh
---
tests/lib/common.sh | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/tests/lib/common.sh b/tests/lib/common.sh
index f393ee1..2099eac 100755
--- a/tests/lib/common.sh
+++ b/tests/lib/common.sh
@@ -123,8 +123,7 @@ function test_build_with_oci_archive_output() {
# test build image with docker-daemon output
function test_build_with_docker_daemon_output() {
- systemctl status docker > /dev/null 2>&1
- if [ $? -ne 0 ]; then
+ if ! systemctl status docker > /dev/null 2>&1; then
return 0
fi
@@ -146,9 +145,8 @@ function test_build_with_docker_daemon_output() {
}
# test build image with isulad output
-function test_build_with_isulad_output() {
- systemctl status isulad > /dev/null 2>&1
- if [ $? -ne 0 ]; then
+function test_build_with_isulad_output() {
+ if ! systemctl status isulad > /dev/null 2>&1; then
return 0
fi
@@ -172,41 +170,41 @@ function test_build_with_isulad_output() {
# test isula build base command
function test_isula_build_base_command() {
show_and_run_command "Build docker format image:" \
- " isula-build ctr-img build --tag "$1"-docker:latest --output=docker-archive:/tmp/"$1"-docker.tar:"$1"-docker:latest "$2""
+ " isula-build ctr-img build --tag $1-docker:latest --output=docker-archive:/tmp/$1-docker.tar:$1-docker:latest $2"
show_and_run_command "Build oci format image:" \
- "isula-build ctr-img build --tag "$1"-oci:latest --output=oci-archive:/tmp/"$1"-oci.tar:"$1"-oci:latest "$2""
+ "isula-build ctr-img build --tag $1-oci:latest --output=oci-archive:/tmp/$1-oci.tar:$1-oci:latest $2"
show_and_run_command "List all images:" \
"isula-build ctr-img images"
show_and_run_command "List docker format image:" \
- "isula-build ctr-img images "$1"-docker:latest"
+ "isula-build ctr-img images $1-docker:latest"
show_and_run_command "List oci format image:" \
- "isula-build ctr-img images "$1"-oci:latest"
+ "isula-build ctr-img images $1-oci:latest"
rm -f /tmp/"$1"-docker.tar /tmp/"$1"-oci.tar
show_and_run_command "Save image with docker format:" \
- "isula-build ctr-img save -f docker "$1"-docker:latest -o /tmp/"$1"-docker.tar"
+ "isula-build ctr-img save -f docker $1-docker:latest -o /tmp/$1-docker.tar"
show_and_run_command "Save image with oci format:" \
- "isula-build ctr-img save -f oci "$1"-oci:latest -o /tmp/"$1"-oci.tar"
+ "isula-build ctr-img save -f oci $1-oci:latest -o /tmp/$1-oci.tar"
show_and_run_command "Load docker format images:" \
- "isula-build ctr-img load -i /tmp/"$1"-docker.tar"
+ "isula-build ctr-img load -i /tmp/$1-docker.tar"
show_and_run_command "Load oci format images:" \
- "isula-build ctr-img load -i /tmp/"$1"-oci.tar"
+ "isula-build ctr-img load -i /tmp/$1-oci.tar"
show_and_run_command "Save multipile images with docker format:" \
- "isula-build ctr-img save -f docker "$1"-docker:latest "$1"-oci:latest -o /tmp/"$1"-all.tar"
+ "isula-build ctr-img save -f docker $1-docker:latest $1-oci:latest -o /tmp/$1-all.tar"
rm -f /tmp/"$1"-docker.tar /tmp/"$1"-oci.tar /tmp/"$1"-all.tar
show_and_run_command "Remove images:" \
- "isula-build ctr-img rm "$1"-docker:latest "$1"-oci:latest"
+ "isula-build ctr-img rm $1-docker:latest $1-oci:latest"
}
function show_and_run_command() {
--
1.8.3.1