I'm using a shared library with jenkins 2. Meaning, I'm utilizing the ability to reuse some of the pipeline code I'm writing in various stages.
here is an example of module vars/utils.groovy
def set_virtual_env() {
sh """
chmod 777 virt_run_pytest.sh
chmod 777 install_python_venv.sh
pip install -U setuptools
bash install_python_venv.sh
"""
}
When trying to execute it in a pipeline script, it gets failed with the following error:
groovy.lang.MissingPropertyException: No such property: set_virtual_env for class: groovy.lang.Binding
I suspect that the reason for that is because I'm not passing any variable to this function and as a result it's not instantiated correctly.
So the actual question might be, "How can I call a shared library function that does not needs arguments"?