简体   繁体   中英

Jenkins, Poll SCM update the hash manually

I have the following configuration of Jenkins to publish automatically on TestFlight:

1- SCM Poll on bitbucket testflight branch
2- version bump (using fastlane)
3- git add & commit
4- git push testflight
5- build (using fastlane)
6- publish testflight (using fastlane)

The issue it's the following, after I perform the push Jenkins detect a new branch and start the building again giving birth to a deadly infinite building loop. I would like to manually set the new Hash to the SCM Poll after the push. ... Any other approach the avoid this infinite loop it's welcome ^_^

I ended up adding a check before starting the actual build. I check the hash of the remote and the local branch, in case they are the same i skip the actual build, here is the bash script I run in jenkins

REMOTE=$(git ls-remote origin refs/heads/Feature/fastlane-jenkins | cut -f 1)
LOCAL=$(git rev-parse Feature/fastlane-jenkins)
if [ "$REMOTE" == "$LOCAL" ]; then
    echo "local branch already up to date, nothing need"
    exit
else
    echo "New commit found, performing release"
    git checkout Feature/fastlane-jenkins
    git pull origin Feature/fastlane-jenkins
    git push --set-upstream origin Feature/fastlane-jenkins
    /usr/local/bin/fastlane ios tf_all 
fi

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM