I am using a Jenkins declarative pipeline to build from a remote repo. In order to do so, I have an 'Update' stage, which looks like this:
stage('Update') {
steps {
echo 'Starting update...'
dir ('C:/Program Files (x86)/Jenkins/workspace/Bootloader/_RELEASE_SCRIPTS') {
powershell './_RUN_STAGE.ps1 -stage 0'
}
echo 'DONE!'
}
}
_RUN_STAGE.ps1 is a script which calls .sh scripts through an MSYS2 console, so it's contents are irrelevant. The first script it calls is _UPDATE_ALL.sh, which looks like this:
#!/bin/sh
echo $(git stash)
echo $(git pull)
echo $(git submodule update --force --init --recursive)
echo $(git fetch --all)
echo $(git tag -l | xargs git tag -d)
echo $(git fetch --tags)
After 'git stash' is run, the Jenkins build hangs. I know this, because this is the output log:
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in C:\Program Files (x86)\Jenkins\workspace\Bootloader
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Update)
[Pipeline] echo
Starting update...
[Pipeline] dir
Running in C:/Program Files (x86)/Jenkins/workspace/Bootloader/_RELEASE_SCRIPTS
[Pipeline] {
[Pipeline] powershell
STAGE: UPDATE.
No local changes to save
'No local changes to save' is returned from 'git stash', which in my eyes means that it is 'git pull' that hangs the build. Why? Additionally, running the _UPDATE_ALL.sh script manually works exactly as expected, only when I run it through Jenkins does it hang.
NOTE: This question may be similar to this one, but I can not extract any useful info from it, hence why I ask this.