I am encountering a strange issue, when i run vagrant up, the virtual machine builds up fine and works as intended, but when I run the same command in a Jenkinsfile pipeline, after the build is completed, the virtual machine shutsdown with a created log.
Log created: 2021-01-15T12:32:44.144568000Z
Process ID: 9678 (0x25ce)
Parent PID: 1 (0x1)
Executable: /usr/lib/virtualbox/VBoxSVC
Arg[0]: /usr/lib/virtualbox/VBoxSVC
Arg[1]: --auto-shutdown
AddRef: illegal refcnt=3221225469 state=2
This is the pipeline code for vagrant
stage('Run Vagrant'){
sh 'cd /var/lib/jenkins/workspace/jenkins-file_master/ansible/; vagrant up'
}
Jenkins config is set for the same user, so that the environment is the same.
# user and group to be invoked as (default to jenkins)
JENKINS_USER=myusername
JENKINS_GROUP="adm cdrom sudo dip plugdev lpadmin lxd sambashare docker vboxusers"