Fix trivy calls 14/73314/1
authorCédric Ollivier <cedric.ollivier@orange.com>
Thu, 21 Apr 2022 14:57:24 +0000 (16:57 +0200)
committerCédric Ollivier <cedric.ollivier@orange.com>
Thu, 21 Apr 2022 14:57:24 +0000 (16:57 +0200)
Trivy remove the exit code option.
It also takes into account last XtestingCI updates.

Change-Id: I33c7a0c8651dc1805af1f3f743cd58618b2b7d3c
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
jjb/functest/functest-kubernetes-ng.yaml
jjb/functest/functest-kubernetes-pi.yaml
jjb/functest/functest-kubernetes.yaml
jjb/functest/functest-pi.yaml
jjb/functest/functest.yaml
jjb/functest/xtesting-pi.yaml
jjb/functest/xtesting.yaml

index 170014b..b9353f9 100644 (file)
           else
             image={repo}:{port}/{container}:{tag}
           fi
-          ./trivy --exit-code 1 $image
+          ./trivy $image
 
 - job-template:
     name: 'functest-kubernetes-ng-{repo}-{container}-{tag}-trivy'
index 21c298f..9dc8dcb 100644 (file)
@@ -89,6 +89,7 @@
     network: '{network}'
     uid: '{uid}'
     gid: '{gid}'
+    published_ports: '{published_ports}'
 
 - builder:
     name: functest-kubernetes-pi-pull-containers
             for i in $(eval echo {env} | tr -d '[]' |sed "s/, / /g" ); \
               do env="-e $i $env"; done
           fi
+          published_ports=;
+          if [ "{published_ports}" != "None" ]; then
+            for i in $(echo {published_ports} | tr -d '[]' |sed "s/, / /g" ); \
+              do published_ports="-p $i $published_ports"; done
+          fi
           [ ! -z "$WORKSPACE" ] && rm -rf $WORKSPACE/results || true
           if [ "{repo}" = "_" ]; then
             image={container}:{tag}
             --network={network} \
             $volumes \
             $env \
+            $published_ports \
             -e S3_ENDPOINT_URL=https://storage.googleapis.com \
             -e S3_DST_URL=s3://artifacts.opnfv.org/functest-kubernetes/$BUILD_TAG/$JOB_NAME-$BUILD_ID \
             -e HTTP_DST_URL=http://artifacts.opnfv.org/functest-kubernetes/$BUILD_TAG/$JOB_NAME-$BUILD_ID \
     env:
       - DEPLOY_SCENARIO=$DEPLOY_SCENARIO
       - E2E_TEST_OPTS=$E2E_TEST_OPTS
+    published_ports:
     container: 'functest-kubernetes-healthcheck'
     test:
       - k8s_quick
     env:
       - DEPLOY_SCENARIO=$DEPLOY_SCENARIO
       - E2E_TEST_OPTS=$E2E_TEST_OPTS
+    published_ports:
     container: 'functest-kubernetes-smoke'
     test:
       - xrally_kubernetes
     env:
       - DEPLOY_SCENARIO=$DEPLOY_SCENARIO
       - E2E_TEST_OPTS=$E2E_TEST_OPTS
+    published_ports:
     container: 'functest-kubernetes-security'
     test:
       - kube_hunter
     env:
       - DEPLOY_SCENARIO=$DEPLOY_SCENARIO
       - E2E_TEST_OPTS=$E2E_TEST_OPTS
+    published_ports:
     container: 'functest-kubernetes-benchmarking'
     test:
       - xrally_kubernetes_full
     env:
       - DEPLOY_SCENARIO=$DEPLOY_SCENARIO
       - E2E_TEST_OPTS=$E2E_TEST_OPTS
+    published_ports:
     container: 'functest-kubernetes-cnf'
     test:
       - k8s_vims
             for i in $(eval echo {env} | tr -d '[]' |sed "s/, / /g" ); \
               do env="-e $i $env"; done
           fi
+          published_ports=;
+          if [ "{published_ports}" != "None" ]; then
+            for i in $(echo {published_ports} | tr -d '[]' |sed "s/, / /g" ); \
+              do published_ports="-p $i $published_ports"; done
+          fi
           [ ! -z "$WORKSPACE" ] && rm -rf $WORKSPACE/results || true
           if [ "{repo}" = "_" ]; then
             image={container}:{tag}
           docker run --rm \
             $volumes \
             $env \
+            $published_ports \
             -e S3_ENDPOINT_URL=https://storage.googleapis.com \
             -e S3_DST_URL=s3://artifacts.opnfv.org/functest-kubernetes \
             -e HTTP_DST_URL=http://artifacts.opnfv.org/functest-kubernetes \
           env: '{env}'
           uid: '{uid}'
           gid: '{gid}'
+          published_ports: '{published_ports}'
 
 - project:
     name: 'functest-kubernetes-pi-{tag}-zip'
     env:
       - DEPLOY_SCENARIO=$DEPLOY_SCENARIO
       - E2E_TEST_OPTS=$E2E_TEST_OPTS
+    published_ports:
     container: 'functest-kubernetes-healthcheck'
     uid: 1000
     gid: 1000
index 91c93e6..6cf3093 100644 (file)
@@ -89,6 +89,7 @@
     network: '{network}'
     uid: '{uid}'
     gid: '{gid}'
+    published_ports: '{published_ports}'
 
 - builder:
     name: functest-kubernetes-pull-containers
             for i in $(eval echo {env} | tr -d '[]' |sed "s/, / /g" ); \
               do env="-e $i $env"; done
           fi
+          published_ports=;
+          if [ "{published_ports}" != "None" ]; then
+            for i in $(echo {published_ports} | tr -d '[]' |sed "s/, / /g" ); \
+              do published_ports="-p $i $published_ports"; done
+          fi
           [ ! -z "$WORKSPACE" ] && rm -rf $WORKSPACE/results || true
           if [ "{repo}" = "_" ]; then
             image={container}:{tag}
             --network={network} \
             $volumes \
             $env \
+            $published_ports \
             -e S3_ENDPOINT_URL=https://storage.googleapis.com \
             -e S3_DST_URL=s3://artifacts.opnfv.org/functest-kubernetes/$BUILD_TAG/$JOB_NAME-$BUILD_ID \
             -e HTTP_DST_URL=http://artifacts.opnfv.org/functest-kubernetes/$BUILD_TAG/$JOB_NAME-$BUILD_ID \
     env:
       - DEPLOY_SCENARIO=$DEPLOY_SCENARIO
       - E2E_TEST_OPTS=$E2E_TEST_OPTS
+    published_ports:
     container: 'functest-kubernetes-healthcheck'
     test:
       - k8s_quick
     env:
       - DEPLOY_SCENARIO=$DEPLOY_SCENARIO
       - E2E_TEST_OPTS=$E2E_TEST_OPTS
+    published_ports:
     container: 'functest-kubernetes-smoke'
     test:
       - xrally_kubernetes
     env:
       - DEPLOY_SCENARIO=$DEPLOY_SCENARIO
       - E2E_TEST_OPTS=$E2E_TEST_OPTS
+    published_ports:
     container: 'functest-kubernetes-security'
     test:
       - kube_hunter
     env:
       - DEPLOY_SCENARIO=$DEPLOY_SCENARIO
       - E2E_TEST_OPTS=$E2E_TEST_OPTS
+    published_ports:
     container: 'functest-kubernetes-benchmarking'
     test:
       - xrally_kubernetes_full
     env:
       - DEPLOY_SCENARIO=$DEPLOY_SCENARIO
       - E2E_TEST_OPTS=$E2E_TEST_OPTS
+    published_ports:
     container: 'functest-kubernetes-cnf'
     test:
       - k8s_vims
             for i in $(eval echo {env} | tr -d '[]' |sed "s/, / /g" ); \
               do env="-e $i $env"; done
           fi
+          published_ports=;
+          if [ "{published_ports}" != "None" ]; then
+            for i in $(echo {published_ports} | tr -d '[]' |sed "s/, / /g" ); \
+              do published_ports="-p $i $published_ports"; done
+          fi
           [ ! -z "$WORKSPACE" ] && rm -rf $WORKSPACE/results || true
           if [ "{repo}" = "_" ]; then
             image={container}:{tag}
           docker run --rm \
             $volumes \
             $env \
+            $published_ports \
             -e S3_ENDPOINT_URL=https://storage.googleapis.com \
             -e S3_DST_URL=s3://artifacts.opnfv.org/functest-kubernetes \
             -e HTTP_DST_URL=http://artifacts.opnfv.org/functest-kubernetes \
           env: '{env}'
           uid: '{uid}'
           gid: '{gid}'
+          published_ports: '{published_ports}'
 
 - project:
     name: 'functest-kubernetes-{tag}-zip'
     env:
       - DEPLOY_SCENARIO=$DEPLOY_SCENARIO
       - E2E_TEST_OPTS=$E2E_TEST_OPTS
+    published_ports:
     container: 'functest-kubernetes-healthcheck'
     uid: 1000
     gid: 1000
           else
             image={repo}:{port}/{container}:{tag}
           fi
-          ./trivy --exit-code 1 $image
+          ./trivy $image
 
 - job-template:
     name: 'functest-kubernetes-{repo}-{container}-{tag}-trivy'
index 6fb2ed8..241884e 100644 (file)
     network: '{network}'
     uid: '{uid}'
     gid: '{gid}'
+    published_ports: '{published_ports}'
     DASHBOARD_URL: '{DASHBOARD_URL}'
 
 - builder:
             for i in $(eval echo {env} | tr -d '[]' |sed "s/, / /g" ); \
               do env="-e $i $env"; done
           fi
+          published_ports=;
+          if [ "{published_ports}" != "None" ]; then
+            for i in $(echo {published_ports} | tr -d '[]' |sed "s/, / /g" ); \
+              do published_ports="-p $i $published_ports"; done
+          fi
           [ ! -z "$WORKSPACE" ] && sudo rm -rf $WORKSPACE/results || true
           if [ "{repo}" = "_" ]; then
             image={container}:{tag}
             --network={network} \
             $volumes \
             $env \
+            $published_ports \
             -e S3_ENDPOINT_URL=https://storage.googleapis.com \
             -e S3_DST_URL=s3://artifacts.opnfv.org/functest/$BUILD_TAG/$JOB_NAME-$BUILD_ID \
             -e HTTP_DST_URL=http://artifacts.opnfv.org/functest/$BUILD_TAG/$JOB_NAME-$BUILD_ID \
       - EXTERNAL_NETWORK=$EXTERNAL_NETWORK
       - VOLUME_DEVICE_NAME=$VOLUME_DEVICE_NAME
       - IMAGE_PROPERTIES=$IMAGE_PROPERTIES
+    published_ports:
     container: 'functest-healthcheck'
     test:
       - connection_check
       - EXTERNAL_NETWORK=$EXTERNAL_NETWORK
       - VOLUME_DEVICE_NAME=$VOLUME_DEVICE_NAME
       - IMAGE_PROPERTIES=$IMAGE_PROPERTIES
+    published_ports:
     container: 'functest-smoke'
     test:
       - tempest_neutron
       - EXTERNAL_NETWORK=$EXTERNAL_NETWORK
       - VOLUME_DEVICE_NAME=$VOLUME_DEVICE_NAME
       - IMAGE_PROPERTIES=$IMAGE_PROPERTIES
+    published_ports:
     container: 'functest-smoke-cntt'
     test:
       - tempest_neutron_cntt
       - EXTERNAL_NETWORK=$EXTERNAL_NETWORK
       - VOLUME_DEVICE_NAME=$VOLUME_DEVICE_NAME
       - IMAGE_PROPERTIES=$IMAGE_PROPERTIES
+    published_ports:
     container: 'functest-benchmarking'
     test:
       - rally_full
       - EXTERNAL_NETWORK=$EXTERNAL_NETWORK
       - VOLUME_DEVICE_NAME=$VOLUME_DEVICE_NAME
       - IMAGE_PROPERTIES=$IMAGE_PROPERTIES
+    published_ports:
     container: 'functest-benchmarking-cntt'
     test:
       - rally_full_cntt
       - EXTERNAL_NETWORK=$EXTERNAL_NETWORK
       - VOLUME_DEVICE_NAME=$VOLUME_DEVICE_NAME
       - IMAGE_PROPERTIES=$IMAGE_PROPERTIES
+    published_ports:
     container: 'functest-vnf'
     test:
       - cloudify
             for i in $(eval echo {env} | tr -d '[]' |sed "s/, / /g" ); \
               do env="-e $i $env"; done
           fi
+          published_ports=;
+          if [ "{published_ports}" != "None" ]; then
+            for i in $(echo {published_ports} | tr -d '[]' |sed "s/, / /g" ); \
+              do published_ports="-p $i $published_ports"; done
+          fi
           [ ! -z "$WORKSPACE" ] && sudo rm -rf $WORKSPACE/results || true
           if [ "{repo}" = "_" ]; then
             image={container}:{tag}
           sudo docker run --rm \
             $volumes \
             $env \
+            $published_ports \
             -e S3_ENDPOINT_URL=https://storage.googleapis.com \
             -e S3_DST_URL=s3://artifacts.opnfv.org/functest \
             -e HTTP_DST_URL=http://artifacts.opnfv.org/functest \
           env: '{env}'
           uid: '{uid}'
           gid: '{gid}'
+          published_ports: '{published_ports}'
 
 - project:
     name: 'functest-pi-{tag}-zip'
       - EXTERNAL_NETWORK=$EXTERNAL_NETWORK
       - VOLUME_DEVICE_NAME=$VOLUME_DEVICE_NAME
       - IMAGE_PROPERTIES=$IMAGE_PROPERTIES
+    published_ports:
     container: 'functest-healthcheck'
     uid: 1000
     gid: 1000
index 33f6850..c0d57d1 100644 (file)
     network: '{network}'
     uid: '{uid}'
     gid: '{gid}'
+    published_ports: '{published_ports}'
     DASHBOARD_URL: '{DASHBOARD_URL}'
 
 - builder:
             for i in $(eval echo {env} | tr -d '[]' |sed "s/, / /g" ); \
               do env="-e $i $env"; done
           fi
+          published_ports=;
+          if [ "{published_ports}" != "None" ]; then
+            for i in $(echo {published_ports} | tr -d '[]' |sed "s/, / /g" ); \
+              do published_ports="-p $i $published_ports"; done
+          fi
           [ ! -z "$WORKSPACE" ] && sudo rm -rf $WORKSPACE/results || true
           if [ "{repo}" = "_" ]; then
             image={container}:{tag}
             --network={network} \
             $volumes \
             $env \
+            $published_ports \
             -e S3_ENDPOINT_URL=https://storage.googleapis.com \
             -e S3_DST_URL=s3://artifacts.opnfv.org/functest/$BUILD_TAG/$JOB_NAME-$BUILD_ID \
             -e HTTP_DST_URL=http://artifacts.opnfv.org/functest/$BUILD_TAG/$JOB_NAME-$BUILD_ID \
       - EXTERNAL_NETWORK=$EXTERNAL_NETWORK
       - VOLUME_DEVICE_NAME=$VOLUME_DEVICE_NAME
       - IMAGE_PROPERTIES=$IMAGE_PROPERTIES
+    published_ports:
     container: 'functest-healthcheck'
     test:
       - connection_check
       - EXTERNAL_NETWORK=$EXTERNAL_NETWORK
       - VOLUME_DEVICE_NAME=$VOLUME_DEVICE_NAME
       - IMAGE_PROPERTIES=$IMAGE_PROPERTIES
+    published_ports:
     container: 'functest-smoke'
     test:
       - tempest_neutron
       - EXTERNAL_NETWORK=$EXTERNAL_NETWORK
       - VOLUME_DEVICE_NAME=$VOLUME_DEVICE_NAME
       - IMAGE_PROPERTIES=$IMAGE_PROPERTIES
+    published_ports:
     container: 'functest-smoke-cntt'
     test:
       - tempest_neutron_cntt
       - EXTERNAL_NETWORK=$EXTERNAL_NETWORK
       - VOLUME_DEVICE_NAME=$VOLUME_DEVICE_NAME
       - IMAGE_PROPERTIES=$IMAGE_PROPERTIES
+    published_ports:
     container: 'functest-benchmarking'
     test:
       - rally_full
       - EXTERNAL_NETWORK=$EXTERNAL_NETWORK
       - VOLUME_DEVICE_NAME=$VOLUME_DEVICE_NAME
       - IMAGE_PROPERTIES=$IMAGE_PROPERTIES
+    published_ports:
     container: 'functest-benchmarking-cntt'
     test:
       - rally_full_cntt
       - EXTERNAL_NETWORK=$EXTERNAL_NETWORK
       - VOLUME_DEVICE_NAME=$VOLUME_DEVICE_NAME
       - IMAGE_PROPERTIES=$IMAGE_PROPERTIES
+    published_ports:
     container: 'functest-vnf'
     test:
       - cloudify
             for i in $(eval echo {env} | tr -d '[]' |sed "s/, / /g" ); \
               do env="-e $i $env"; done
           fi
+          published_ports=;
+          if [ "{published_ports}" != "None" ]; then
+            for i in $(echo {published_ports} | tr -d '[]' |sed "s/, / /g" ); \
+              do published_ports="-p $i $published_ports"; done
+          fi
           [ ! -z "$WORKSPACE" ] && sudo rm -rf $WORKSPACE/results || true
           if [ "{repo}" = "_" ]; then
             image={container}:{tag}
           sudo docker run --rm \
             $volumes \
             $env \
+            $published_ports \
             -e S3_ENDPOINT_URL=https://storage.googleapis.com \
             -e S3_DST_URL=s3://artifacts.opnfv.org/functest \
             -e HTTP_DST_URL=http://artifacts.opnfv.org/functest \
           env: '{env}'
           uid: '{uid}'
           gid: '{gid}'
+          published_ports: '{published_ports}'
 
 - project:
     name: 'functest-{tag}-zip'
       - EXTERNAL_NETWORK=$EXTERNAL_NETWORK
       - VOLUME_DEVICE_NAME=$VOLUME_DEVICE_NAME
       - IMAGE_PROPERTIES=$IMAGE_PROPERTIES
+    published_ports:
     container: 'functest-healthcheck'
     uid: 1000
     gid: 1000
           else
             image={repo}:{port}/{container}:{tag}
           fi
-          ./trivy --exit-code 1 $image
+          ./trivy $image
 
 - job-template:
     name: 'functest-{repo}-{container}-{tag}-trivy'
index 9d2482e..9fb4ded 100644 (file)
@@ -75,6 +75,7 @@
     network: '{network}'
     uid: '{uid}'
     gid: '{gid}'
+    published_ports: '{published_ports}'
 
 - builder:
     name: xtesting-pi-pull-containers
             for i in $(eval echo {env} | tr -d '[]' |sed "s/, / /g" ); \
               do env="-e $i $env"; done
           fi
+          published_ports=;
+          if [ "{published_ports}" != "None" ]; then
+            for i in $(echo {published_ports} | tr -d '[]' |sed "s/, / /g" ); \
+              do published_ports="-p $i $published_ports"; done
+          fi
           [ ! -z "$WORKSPACE" ] && sudo rm -rf $WORKSPACE/results || true
           if [ "{repo}" = "_" ]; then
             image={container}:{tag}
             --network={network} \
             $volumes \
             $env \
+            $published_ports \
             -e S3_ENDPOINT_URL=https://storage.googleapis.com \
             -e S3_DST_URL=s3://artifacts.opnfv.org/xtesting/$BUILD_TAG/$JOB_NAME-$BUILD_ID \
             -e HTTP_DST_URL=http://artifacts.opnfv.org/xtesting/$BUILD_TAG/$JOB_NAME-$BUILD_ID \
     <<: *xtesting-pi-params
     volumes:
     env:
+    published_ports:
     container: 'xtesting'
     test:
       - first
     <<: *xtesting-pi-params
     volumes:
     env:
+    published_ports:
     container: 'xtesting-mts'
     test:
       - seventh
             for i in $(eval echo {env} | tr -d '[]' |sed "s/, / /g" ); \
               do env="-e $i $env"; done
           fi
+          published_ports=;
+          if [ "{published_ports}" != "None" ]; then
+            for i in $(echo {published_ports} | tr -d '[]' |sed "s/, / /g" ); \
+              do published_ports="-p $i $published_ports"; done
+          fi
           [ ! -z "$WORKSPACE" ] && sudo rm -rf $WORKSPACE/results || true
           if [ "{repo}" = "_" ]; then
             image={container}:{tag}
           sudo docker run --rm \
             $volumes \
             $env \
+            $published_ports \
             -e S3_ENDPOINT_URL=https://storage.googleapis.com \
             -e S3_DST_URL=s3://artifacts.opnfv.org/xtesting \
             -e HTTP_DST_URL=http://artifacts.opnfv.org/xtesting \
           env: '{env}'
           uid: '{uid}'
           gid: '{gid}'
+          published_ports: '{published_ports}'
 
 - project:
     name: 'xtesting-pi-{tag}-zip'
     <<: *xtesting-pi-params
     volumes:
     env:
+    published_ports:
     container: 'xtesting'
     uid: 1000
     gid: 1000
index 07b0eb3..e4000a4 100644 (file)
@@ -75,6 +75,7 @@
     network: '{network}'
     uid: '{uid}'
     gid: '{gid}'
+    published_ports: '{published_ports}'
 
 - builder:
     name: xtesting-pull-containers
             for i in $(eval echo {env} | tr -d '[]' |sed "s/, / /g" ); \
               do env="-e $i $env"; done
           fi
+          published_ports=;
+          if [ "{published_ports}" != "None" ]; then
+            for i in $(echo {published_ports} | tr -d '[]' |sed "s/, / /g" ); \
+              do published_ports="-p $i $published_ports"; done
+          fi
           [ ! -z "$WORKSPACE" ] && sudo rm -rf $WORKSPACE/results || true
           if [ "{repo}" = "_" ]; then
             image={container}:{tag}
             --network={network} \
             $volumes \
             $env \
+            $published_ports \
             -e S3_ENDPOINT_URL=https://storage.googleapis.com \
             -e S3_DST_URL=s3://artifacts.opnfv.org/xtesting/$BUILD_TAG/$JOB_NAME-$BUILD_ID \
             -e HTTP_DST_URL=http://artifacts.opnfv.org/xtesting/$BUILD_TAG/$JOB_NAME-$BUILD_ID \
     <<: *xtesting-params
     volumes:
     env:
+    published_ports:
     container: 'xtesting'
     test:
       - first
     <<: *xtesting-params
     volumes:
     env:
+    published_ports:
     container: 'xtesting-mts'
     test:
       - seventh
             for i in $(eval echo {env} | tr -d '[]' |sed "s/, / /g" ); \
               do env="-e $i $env"; done
           fi
+          published_ports=;
+          if [ "{published_ports}" != "None" ]; then
+            for i in $(echo {published_ports} | tr -d '[]' |sed "s/, / /g" ); \
+              do published_ports="-p $i $published_ports"; done
+          fi
           [ ! -z "$WORKSPACE" ] && sudo rm -rf $WORKSPACE/results || true
           if [ "{repo}" = "_" ]; then
             image={container}:{tag}
           sudo docker run --rm \
             $volumes \
             $env \
+            $published_ports \
             -e S3_ENDPOINT_URL=https://storage.googleapis.com \
             -e S3_DST_URL=s3://artifacts.opnfv.org/xtesting \
             -e HTTP_DST_URL=http://artifacts.opnfv.org/xtesting \
           env: '{env}'
           uid: '{uid}'
           gid: '{gid}'
+          published_ports: '{published_ports}'
 
 - project:
     name: 'xtesting-{tag}-zip'
     <<: *xtesting-params
     volumes:
     env:
+    published_ports:
     container: 'xtesting'
     uid: 1000
     gid: 1000
           else
             image={repo}:{port}/{container}:{tag}
           fi
-          ./trivy --exit-code 1 $image
+          ./trivy $image
 
 - job-template:
     name: 'xtesting-{repo}-{container}-{tag}-trivy'