diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2021-07-01 09:30:45 +0200 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2021-07-01 10:33:35 +0200 |
commit | b7bf83ddffbb3c7228ab9a6baf7f6b3b6ff714f3 (patch) | |
tree | cc6b3792bbacb8503332f8e7012064fbfd7f5be3 | |
parent | 00cf0af21949ddcff4811702848f0cce5d492cff (diff) |
Protect if {volumes} or env is None
Change-Id: Ieedf854c0a8e3a993f22e4e6e8fc7d9e5973771c
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
-rw-r--r-- | jjb/functest/functest-kubernetes-pi.yaml | 10 | ||||
-rw-r--r-- | jjb/functest/functest-kubernetes.yaml | 10 | ||||
-rw-r--r-- | jjb/functest/functest-pi.yaml | 10 | ||||
-rw-r--r-- | jjb/functest/functest.yaml | 10 | ||||
-rw-r--r-- | jjb/functest/xtesting-pi.yaml | 10 | ||||
-rw-r--r-- | jjb/functest/xtesting.yaml | 12 |
6 files changed, 49 insertions, 13 deletions
diff --git a/jjb/functest/functest-kubernetes-pi.yaml b/jjb/functest/functest-kubernetes-pi.yaml index 986ea58d5..42c1a8c86 100644 --- a/jjb/functest/functest-kubernetes-pi.yaml +++ b/jjb/functest/functest-kubernetes-pi.yaml @@ -95,8 +95,14 @@ builders: - shell: | set +x - volumes=; for i in $(echo {volumes} | tr -d '[] ' |sed "s/,/ /g" ); do volumes="-v $i $volumes"; done - env=; for i in $(eval echo {env} | tr -d '[] ' |sed "s/,/ /g" ); do env="-e $i $env"; done + volumes=; + if [ "{volumes}" != "None" ]; then + for i in $(echo {volumes} | tr -d '[] ' |sed "s/,/ /g" ); do volumes="-v $i $volumes"; done + fi + env=; + if [ "{env}" != "None" ]; then + for i in $(eval echo {env} | tr -d '[] ' |sed "s/,/ /g" ); do env="-e $i $env"; done + fi [ ! -z "$WORKSPACE" ] && rm -rf $WORKSPACE/results || true if [ "{repo}" = "_" ]; then image={container}:{tag} diff --git a/jjb/functest/functest-kubernetes.yaml b/jjb/functest/functest-kubernetes.yaml index a42784ab3..a0bc4c2df 100644 --- a/jjb/functest/functest-kubernetes.yaml +++ b/jjb/functest/functest-kubernetes.yaml @@ -95,8 +95,14 @@ builders: - shell: | set +x - volumes=; for i in $(echo {volumes} | tr -d '[] ' |sed "s/,/ /g" ); do volumes="-v $i $volumes"; done - env=; for i in $(eval echo {env} | tr -d '[] ' |sed "s/,/ /g" ); do env="-e $i $env"; done + volumes=; + if [ "{volumes}" != "None" ]; then + for i in $(echo {volumes} | tr -d '[] ' |sed "s/,/ /g" ); do volumes="-v $i $volumes"; done + fi + env=; + if [ "{env}" != "None" ]; then + for i in $(eval echo {env} | tr -d '[] ' |sed "s/,/ /g" ); do env="-e $i $env"; done + fi [ ! -z "$WORKSPACE" ] && rm -rf $WORKSPACE/results || true if [ "{repo}" = "_" ]; then image={container}:{tag} diff --git a/jjb/functest/functest-pi.yaml b/jjb/functest/functest-pi.yaml index 663810ce0..a4d4b52b5 100644 --- a/jjb/functest/functest-pi.yaml +++ b/jjb/functest/functest-pi.yaml @@ -124,8 +124,14 @@ builders: - shell: | set +x - volumes=; for i in $(echo {volumes} | tr -d '[] ' |sed "s/,/ /g" ); do volumes="-v $i $volumes"; done - env=; for i in $(eval echo {env} | tr -d '[] ' |sed "s/,/ /g" ); do env="-e $i $env"; done + volumes=; + if [ "{volumes}" != "None" ]; then + for i in $(echo {volumes} | tr -d '[] ' |sed "s/,/ /g" ); do volumes="-v $i $volumes"; done + fi + env=; + if [ "{env}" != "None" ]; then + for i in $(eval echo {env} | tr -d '[] ' |sed "s/,/ /g" ); do env="-e $i $env"; done + fi [ ! -z "$WORKSPACE" ] && sudo rm -rf $WORKSPACE/results || true if [ "{repo}" = "_" ]; then image={container}:{tag} diff --git a/jjb/functest/functest.yaml b/jjb/functest/functest.yaml index e9086f07d..0b4d1b7e9 100644 --- a/jjb/functest/functest.yaml +++ b/jjb/functest/functest.yaml @@ -114,8 +114,14 @@ builders: - shell: | set +x - volumes=; for i in $(echo {volumes} | tr -d '[] ' |sed "s/,/ /g" ); do volumes="-v $i $volumes"; done - env=; for i in $(eval echo {env} | tr -d '[] ' |sed "s/,/ /g" ); do env="-e $i $env"; done + volumes=; + if [ "{volumes}" != "None" ]; then + for i in $(echo {volumes} | tr -d '[] ' |sed "s/,/ /g" ); do volumes="-v $i $volumes"; done + fi + env=; + if [ "{env}" != "None" ]; then + for i in $(eval echo {env} | tr -d '[] ' |sed "s/,/ /g" ); do env="-e $i $env"; done + fi [ ! -z "$WORKSPACE" ] && sudo rm -rf $WORKSPACE/results || true if [ "{repo}" = "_" ]; then image={container}:{tag} diff --git a/jjb/functest/xtesting-pi.yaml b/jjb/functest/xtesting-pi.yaml index 2ed916888..fa3c64427 100644 --- a/jjb/functest/xtesting-pi.yaml +++ b/jjb/functest/xtesting-pi.yaml @@ -87,8 +87,14 @@ builders: - shell: | set +x - volumes=; for i in $(echo {volumes} | tr -d '[] ' |sed "s/,/ /g" ); do volumes="-v $i $volumes"; done - env=; for i in $(eval echo {env} | tr -d '[] ' |sed "s/,/ /g" ); do env="-e $i $env"; done + volumes=; + if [ "{volumes}" != "None" ]; then + for i in $(echo {volumes} | tr -d '[] ' |sed "s/,/ /g" ); do volumes="-v $i $volumes"; done + fi + env=; + if [ "{env}" != "None" ]; then + for i in $(eval echo {env} | tr -d '[] ' |sed "s/,/ /g" ); do env="-e $i $env"; done + fi [ ! -z "$WORKSPACE" ] && rm -rf $WORKSPACE/results || true if [ "{repo}" = "_" ]; then image={container}:{tag} diff --git a/jjb/functest/xtesting.yaml b/jjb/functest/xtesting.yaml index 573e02ca5..ab770cd7b 100644 --- a/jjb/functest/xtesting.yaml +++ b/jjb/functest/xtesting.yaml @@ -86,9 +86,15 @@ name: xtesting-run-containers builders: - shell: | - set -ex - volumes=; for i in $(echo {volumes} | tr -d '[] ' |sed "s/,/ /g" ); do volumes="-v $i $volumes"; done - env=; for i in $(eval echo {env} | tr -d '[] ' |sed "s/,/ /g" ); do env="-e $i $env"; done + set +x + volumes=; + if [ "{volumes}" != "None" ]; then + for i in $(echo {volumes} | tr -d '[] ' |sed "s/,/ /g" ); do volumes="-v $i $volumes"; done + fi + env=; + if [ "{env}" != "None" ]; then + for i in $(eval echo {env} | tr -d '[] ' |sed "s/,/ /g" ); do env="-e $i $env"; done + fi [ ! -z "$WORKSPACE" ] && rm -rf $WORKSPACE/results || true if [ "{repo}" = "_" ]; then image={container}:{tag} |