Variables are set in the main script based on the options.
`--unsafe-caching` option is used because our VM instances are throw-away's.
`--template ci-scripts/template-host.xml` is used to duplicate the CPU properties to the VM instance. **VERY IMPORTANT to build OAI**
## 2.2. Lock / Unlock functions ##
There are `acquire_vm_create_lock` and `release_vm_create_lock` functions.
Creating Virtual Machines instances in parallel **creates a lot of stress** on the host server HW. If you launch creations in parallel (Jenkins pipeline could do it) or you are several people working on the same host server, this mechanism atomizes the creation process and wait until the previous VM creation is finished.
$ ./ci-scripts/oai-ci-vm-tool create -jn toto -id 1 -v2
```
The Jenkins pipeline uses the master job name as `job-name` option and the job-build ID.
Try to be unique if you are several developers working on the same host server.
Finally, typically I never use the `create` command. I use directly the build command that checks if VM is created and if not, will create it. See next step.
---
Next step: [how to build an OAI variant](./vm_based_simulator_build.md)
You can also go back to the [CI dev main page](./ci_dev_home.md)
To define a new variant you just need to define a function which name conforms to `function variant__v<n>__<variant_name>` where n and variant_name will respectively define the short and long options for your variant. The function only needs to define the variant dependent variables. For many variables, default values are set in the `check_set_variant` function. When a variant doesn't define the BUILD_OPTIONS variable it cannot be used for the `build``wait` and `create` commands.
The main scripts also allows the definition of non variant-dependant variable via the `--setvar_<variable name> <variable value>` options.
You can get the list of these variables by using `help setvar`:
```BASH
./ci-scripts/oai-ci-vm-tool help setvar
--setvar_<varname> <value> where varname is one of:
VM_OSREL : OS release to use in virtual machines
RUN_EXPERIMENTAL : Enforce execution of variants with EXPERIMENTAL variable set to "true"
```
To add a new non-variant dependant variable you need:
* Add an item to the `AUTHORIZED_VAR` array
* In the `setvar_usage`function, add your help string in the HELP_VAR["<yourvariablename>"] variable.
You can also use your current cloned workspace and any `develop`-based branch.
```bash
$ cd /home/raphael/openairinterface5g
$ git fetch
$ git checkout develop-improved-documentation
# CAUTION: the following command will remove any file that has not already been added to GIT
$ sudo git clean -x-d-ff
$ git status
On branch develop-improved-documentation
Your branch is up-to-date with 'origin/develop-improved-documentation'.
nothing to commit, working directory clean
```
You can also have modified files.
**The main point is to have NO ARTIFACTS from a previous build in your workspace.**
Last point, the workspace folder name is not necesseraly `openairinterface5g`. But all the following commands will be run for the root of the workspace.
For clarity, I will always use `/tmp/CI-raphael` as $WORKSPACE.
# 3. Create the ZIP file #
```bash
# go to root of workspace
$ cd /tmp/CI-raphael
$ zip -r-qq localZip.zip .
```
The **Jenkins Pipeline** performs automatically these operations.
In addition, in case of a merge request, it tries to merge with the target branch and might create a dummy local commit.
See [section](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/ci/enb-master-job#32-verify-guidelines-stage)
---
Next step: [the main scripts](./vm_based_simulator_main_scripts.md)
You can also go back to the [CI dev main page](./ci_dev_home.md)
echo" <strong>CPPCHECK found NO error and $NB_WARNINGS warnings <span class=\"glyphicon glyphicon-warning-sign\"></span></strong>">> ./build_results.html
fi
if[$MR_TRIG-eq 1 ]
then
if[$ADDED_WARNINGS-eq 0 ]
then
echo" <strong>CPPCHECK found NO error and $NB_WARNINGS warnings <span class=\"glyphicon glyphicon-warning-sign\"></span></strong>">> ./build_results.html
else
echo" <strong>CPPCHECK found NO error and $NB_WARNINGS warnings <span class=\"glyphicon glyphicon-warning-sign\"></span></strong>">> ./build_results.html
echo" <strong>CPPCHECK found $NB_ERRORS errors and $NB_WARNINGS warnings <span class=\"glyphicon glyphicon-ban-circle\"></span></strong>">> ./build_results.html
fi
if[$MR_TRIG-eq 1 ]
then
if[$ADDED_ERRORS-eq 0 ]&&[$ADDED_WARNINGS-eq 0 ]
then
echo" <strong>CPPCHECK found $NB_ERRORS errors and $NB_WARNINGS warnings <span class=\"glyphicon glyphicon-ban-circle\"></span></strong>">> ./build_results.html
else
echo" <strong>CPPCHECK found $NB_ERRORS errors and $NB_WARNINGS warnings <span class=\"glyphicon glyphicon-ban-circle\"></span>">> ./build_results.html
echo" <br>">> ./build_results.html
echo" <br>">> ./build_results.html
echo" <span class=\"glyphicon glyphicon-alert\"></span> This Merge Request may have introduced up to $ADDED_ERRORS errors and $ADDED_WARNINGS warnings. <span class=\"glyphicon glyphicon-alert\"></span></strong>">> ./build_results.html
fi
fi
echo" </div>">> ./build_results.html
fi
fi
if[$PU_TRIG-eq 1 ]
then
if[-d ../../cppcheck_archives ]
then
if[-d ../../cppcheck_archives/$JOB_NAME]
then
cp$1 ../../cppcheck_archives/$JOB_NAME
fi
fi
fi
echo" <button data-toggle=\"collapse\" data-target=\"#oai-cppcheck-details\">More details on CPPCHECK results</button>">> ./build_results.html
if[$MR_TRIG-eq 1 ];then echo" <strong>${NB_FILES_IN_ERROR} modified files MAY NOT HAVE CIRCULAR DEPENDENCY PROTECTION</strong>">> ./build_results.html;fi
if[$PU_TRIG-eq 1 ];then echo" <strong>${NB_FILES_IN_ERROR} files in repository MAY NOT HAVE CIRCULAR DEPENDENCY PROTECTION in the whole repository</strong>">> ./build_results.html;fi
awk'{if($0 ~/error in/){print " <tr><td>error in declaration</td><td>"$4"</td><td>"$5"</td></tr>"};if($0 ~/files with same/){print " <tr><td>files with same #define</td><td>"$5"</td><td>"$6"</td></tr>"}}' ./header-files-w-incorrect-define.txt >> ./build_results.html
echo" <strong>COULD NOT DETERMINE TEST FINAL STATUS! <span class=\"glyphicon glyphicon-ban-circle\"></span></strong>">> ./test_simulator_results.html
echo" </div>">> ./test_simulator_results.html
fi
echo" <button data-toggle=\"collapse\" data-target=\"#oai-nr-rf-sim-test-details\">More details on 5G NR RF Simulator test results</button>">> ./test_simulator_results.html
echo" <div class=\"well well-lg\">End of Test Report -- Copyright <span class=\"glyphicon glyphicon-copyright-mark\"></span> 2018 <a href=\"http://www.openairinterface.org/\">OpenAirInterface</a>. All Rights Reserved.</div>">> ./test_simulator_results.html