Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Git: cannot tag during promotion #1638

ikotlova ·
Hello Robin,

I have a problem while pushing the tag to the Git repository. Here is my log below. I get 'bad command: git-receive-pack' error. Your help is very appreciated.

I use git@host.[:port]:path/to/repo.git notation for both pulling and pushing. Pulling works fine. We have Gitolite and have to use git@.

Thanks much,
Irina

INFO - Creating label '2.0.0.75_RC1' on repository 'CommonAgent-core'...
INFO - Repository setting changed, deleting working directory [/opt/buildagent/workspace/root/builds/CommonComponents/CommonAgent/gry-core/Mainline/milestone/gry-core]
] INFO - Updated tag '2.0.0.75_RC1' (was 0000000)
ERROR - bad command: git-receive-pack --quiet 'gry-core.git'
ERROR - fatal: The remote end hung up unexpectedly
INFO - Executing post-execute action...
ERROR - Step 'master>ReleaseMilestone>SelectUnixSystem-Label>SCM.LabelSource' is failed.
com.pmease.quickbuild.QuickbuildException: Failed to run command: /usr/bin/git push --tags -q git@git.englab.local:gry-core.git
Command return code: 128
Command error output: bad command: git-receive-pack --quiet 'gry-core.git'
  • replies 6
  • views 3873
  • stars 0
steveluo ADMIN ·
I noticed that when creating tag, QuickBuild detected the repository setting has been changed and then the working dir was deleted. Did you modify the repository setting at that time?

Please make sure the agent is using the correct gitolite user and ssh-key which should be without any password. And if no problems found, you can try run command:
/usr/bin/git push --tags -q git@git.englab.local:gry-core.git
on the agent workspace dir.

If still no problem, then please turn configuration log level to debug and clean the workspace, then run build again to see what happens. Let me know your result.
ikotlova ·
Thank you very much, Steve.

What repository settings are you asking about?

What I did was:
-configured Git repository with certain setting, without specifying username/password;
-built the project with the Git repository successfully, including checking out from the Git repository;
-immediately after this recommended just created build and then promoted it.
On my hand there was no manual repository settings change in between the build completion and its promotion.

Although what was different for these 2 steps is the place where they were executed. The build's itself checkout was done on the QB client build machine. The promotion's tagging was done on the separate build agent on the QB server.
steveluo ADMIN ·
Hi Irina,

I tested as what you did and without any problems. You needn't care about the repository setting changed info in the log, it's my fault, for first time, QuickBuild always thinks the setting is changed and will delete the working directory to make sure there is not any content. Below is what I did:
1. Create two configurations, CONF-A, CONF-D, in both configurations, I have defined a repository named GIT with setting: fetch url: gitolite@gitolite.server:testing
and CONF-A has a promotion to CONF-D
2. Tow agents are used, AGENT1 and AGENT2, they run on different machines. Both QuickBuild agents run as user 'quickbuild' and home directory is /home/quickbuild, and both have same ssh-key named gitolite_rsa in /home/quickbuild/.ssh/, also I created a file 'config' to tell ssh use gitolite_rsa to connect with gitolite.server, i.e.,

Host gitolite.server
IdentityFile ~/.ssh/gitolite_rsa

3. Add gitolite_rsa.pub (I copied it to quickbuild.pub) to gitolite-admin repository and also update the conf/gitolite.conf:

repo testing
RW+ = steve quickbuild

commit and push to gitolite server, so user 'quickbuild' has read write access to repository testing.
4. Build configuration CONF-A and promote to CONF-D, no problem.

Please make some verification/tests as I suggested in previous post:
1. Make sure you have configured user and ssh-key correctly on the agent which you are using in QuickBuild to create and push tag, i.e., build agent on server
2. Run create tag and push tag command directly on the agent working directory, in your case which should be the working directory of the build agent on server. I think in this step, you may find some problems, if not, then:
3. Clean the workspace for both configurations. Turn configuration log level to debug for both configurations and run your build process (build your configuration and promote to another) to get more detailed information.

Hope this can help you debug the problem.
ikotlova ·
Thank you so much, Steve.

Your advise to set up Debug Level of logging was a real help. Here is the log snippet:
--------------
INFO - Checking step execute condition...
INFO - Step execute condition satisfied, executing...
INFO - Executing pre-execute action...
INFO - Running step...
INFO - Creating label '2.0.0.82a_RC1' on repository 'CommonAgent-core'...
DEBUG - sync working directory [/opt/buildagent/workspace/root/builds/CommonComponents/CommonAgent/gry-core/Mainline/milestone/gry-core]...
DEBUG - Detect whether repository settings have been changed ...
DEBUG - Loading scm rc file ...
DEBUG - Executing command: /usr/bin/git fetch
DEBUG - Command working directory: /opt/buildagent/workspace/root/builds/CommonComponents/CommonAgent/gry-core/Mainline/milestone/gry-core
ERROR - From git://git.englab.local/gry-core
ERROR - d6eaaf5..f773954 feature/sprint -> origin/feature/sprint
ERROR - 135b7e1..11f3cfe feature/user/earroyo/platform -> origin/feature/user/earroyo/platform
ERROR - 637bb5c..0a08557 master -> origin/master
ERROR - * [new tag] 2.0.0.80_official_GA -> 2.0.0.80_official_GA
ERROR - * [new tag] 2.0.0.80_official_RC1 -> 2.0.0.80_official_RC1
ERROR - * [new tag] 2.0.0.80a_GA -> 2.0.0.80a_GA
ERROR - * [new tag] 2.0.0.80a_RC1 -> 2.0.0.80a_RC1
ERROR - * [new tag] 2.0.0.82_RC1 -> 2.0.0.82_RC1
DEBUG - Executing command: /usr/bin/git tag -a -f -m "CACORE build 2.0.0.82 tagged as milestone RC1 of version 2.0.0.82a." 2.0.0.82a_RC1 0a08557fa1bfb955d23f3e632d39416473df71f1
DEBUG - Command working directory: /opt/buildagent/workspace/root/builds/CommonComponents/CommonAgent/gry-core/Mainline/milestone/gry-core
INFO - Updated tag '2.0.0.82a_RC1' (was 0000000)
DEBUG - Executing command: /usr/bin/git push --tags git@git.englab.local:gry-core.git
DEBUG - Command working directory: /opt/buildagent/workspace/root/builds/CommonComponents/CommonAgent/gry-core/Mainline/milestone/gry-core
ERROR - To git@git.englab.local:gry-core.git
ERROR - * [new tag] 2.0.0.82a_RC1 -> 2.0.0.82a_RC1
ERROR - ! [rejected] 2.0.0.80_RC1 -> 2.0.0.80_RC1 (non-fast-forward)
ERROR - error: failed to push some refs to 'git@git.englab.local:gry-core.git'
ERROR - To prevent you from losing history, non-fast-forward updates were rejected
ERROR - Merge the remote changes (e.g. 'git pull') before pushing again. See the
ERROR - 'Note about fast-forwards' section of 'git push --help' for details.
INFO - Executing post-execute action...
ERROR - Step 'master>ReleaseMilestone>SelectUnixSystem-Label>SCM.LabelSource' is failed.
com.pmease.quickbuild.QuickbuildException: Failed to run command: /usr/bin/git push --tags git@git.englab.local:gry-core.git
Command return code: 1
Command error output: To git@git.englab.local:gry-core.git
* [new tag] 2.0.0.82a_RC1 -> 2.0.0.82a_RC1
! [rejected] 2.0.0.80_RC1 -> 2.0.0.80_RC1 (non-fast-forward)
error: failed to push some refs to 'git@git.englab.local:gry-core.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
---------
I logged in to the server and found out that the workspace is out of date - its version does not correspond to the build repository commit signature. And this is what log is complaining about as well. For instance, 2.0.0.80_official_RC1 tag and 2.0.0.80_official_GA tag do not show up there. Interesting that the promotion demo is missing repository update step <!-- s;-) --><img src="{SMILIES_PATH}/icon_wink.gif" alt=";-)" title="Wink" /><!-- s;-) -->. So, I need to update the workspace to the build's commit version before labeling, don't I? Could you advise the way of getting the original recommended build's commit signature in the script?

Thank you,
Irina
steveluo ADMIN ·
Hi Irina,

I think the version is old is because you haven't any checkout step in your promotion configuration, right? But it doesn't matter the tag/label process as QuickBuild always does below commands to fetch objects/refs from remote and then tag it by revision

git fetch
git tag -a -f tagName revSpec


Below case may lead to the problem. Tow configurations: CONFA, CONFD, CONFA will be promoted to CONFD,
1. Build CONFA and tag with 1.1-RC1
2. Promote to CONFD and tag with 1.1-REL1
3. Do some modifications and push to the repository
4. Build CONFA and still tag with 1.1-RC1
5. Promote to CONFD, then the error will be occurred

In this case, tag 1.1-RC1 was modified in step 3 which make the git think it is a non-fast-forward updates (modify an old tag). So please avoid such kind of operation, as tag is considered to be read-only in most cases. So you have to clean the workspace for CONFD to force update(re-clone) from the remote repository.

To get the recommended build's commit SHA in the script, you may use below snippet:

repositories.get("<repo name>").revision.value
ikotlova ·
Hi Steve,

After I added clean/checkout workspace steps I got a success. Seems like every time I tried to label the git repository there was no sync between the original build workspace and the server workspace.

Thanks much for your help!
Irina