-if [ ! $generator_only -eq 1 ] && [ ! $loopvm_only -eq 1 ]; then
- echo "Build loop VM image"
- build_image $loopvm_image_name
- echo "Build generator image"
- build_image $generator_image_name
-else
- if [ $loopvm_only -eq 1 ]; then
- echo "Build loop VM image"
- build_image $loopvm_image_name
- fi
- if [ $generator_only -eq 1 ]; then
- echo "Build generator image"
- build_image $generator_image_name
+if [ $build_loopvm -eq 1 ]; then
+ echo "Build loop VM image"
+ build_image $loopvm_image_name
+fi
+
+if [ $build_generator -eq 1 ]; then
+ echo "Build generator image"
+
+ if [[ "${DIB_NFVBENCH_CODE_ORIGIN}" == "static" ]]; then
+ echo "Use local nfvbench code"
+ copy_local_nfvbench_code_to_static_dir
+
+ # Append nfvbench version number to the image name:
+ # during development, this is useful to distinguish the development
+ # images from the latest published image.
+ #
+ # To avoid confusion, we use the same versioning as nfvbench (see
+ # nfvbench/__init__.py), although "git describe" would give us a better
+ # number with respect to uniqueness. So we will typically get something
+ # like "5.0.4.dev31" where "5.0.4" is the latest annotated tag ("5.0.3")
+ # plus one and where dev31 indicates the number of commits (31) since
+ # that tag.
+ nfvbench_version=$(python -c 'import pbr.version; print(pbr.version.VersionInfo("nfvbench").version_string_with_vcs())')
+ generator_image_name="${generator_image_name}-${nfvbench_version}"