Active Git branch is “(no branch)” on hudson CI

前端 未结 3 959
忘了有多久
忘了有多久 2020-12-13 15:10

My Ant build.xml script starts with


GIT_BRANCH = ${env.GIT_BRANCH}
PWD = ${env.PWD         


        
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-13 15:45

    RESOLVED

    After seeing the comment by abayer in Hudson bug 6856, I took the following steps:

    • Using the Hudson Plugin Manager, I updated my Hudson Git Plugin version 1.1) to get abayer's fix.
    • Using the Hudson Job Configuration, I clicked the "Advanced" button under "Source Code Management" -> "Branches to Build". I then changed the "Local branch to use" to something to use for a name. It doesn't matter what.
    • Then I clicked the "Save" button and started a build with "Build Now"

    alt text

    The build log shows

    [workspace] $ git.exe checkout -b ChangeTester d6caef27759495c5714923c1ddf19551a70d6083
    

    Instead of

    [workspace] $ git.exe checkout -f d6caef27759495c5714923c1ddf19551a70d6083
    

    Which means that I am not in a 'detached head' state and can therefore do commits, create tags, and push.

    I can use 'git rev-parse HEAD' to get the commit hash and find that in the output of 'git show-ref' to find the real name of the branch if I need it.

    I'm now able to push successful build tags to my git repo.

提交回复
热议问题