History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: QB-3087
Type: Bug Bug
Status: Closed Closed
Resolution: Won't Fix
Priority: Major Major
Assignee: Steve Luo
Reporter: Sebastian Potasiak
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
QuickBuild

Git repository settings change detected improperly causing working directory to be deleted and recreated

Created: 24/Nov/17 02:08 PM   Updated: 22/Feb/18 03:09 AM
Component/s: None
Affects Version/s: 6.0.36, 7.0.28
Fix Version/s: None

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown


 Description  « Hide
We have a git repository configured in our setup. We observe that once in a while before a build starts, it deletes the whole working directory.

In logs we have observed an INFO message:

INFO - Repository setting changed, deleting working directory [...]

QuickBuild detects settings change, resulting in working directory deletion, even though nothing changed. It is a big problem for us since we have big repositories that require 5 - 30 minutes to be checked out.

What we have noticed is that the setting change is detected only after new revision is created in a repository - problem doesn't occur when there are no changes in code.

In theory, QB deletes working directory when it detects changes in its properties located in .qbcache/git-scm.xml, eg.:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<entry key="fetchurl">https://git_user_name:******@bitbucket.tomtomgroup.com/scm/project/repository_name.git&lt;/entry>
<entry key="pushurl">https://git_user_name:******@bitbucket.tomtomgroup.com/scm/project/repository_name.git&lt;/entry>
</properties>

The settings change detection compares each <entry> with values read from Git repository settings, using java.util.Properties objects, and com.google.common.base.Objects.equal() function in com.pmease.quickbuild.plugin.scm.helper.AbstractRepository<>.getChangedSettings() method (called by com.pmease.quickbuild.plugin.scm.helper.AbstractRepository<>.hasSettingChanged()).

Current repository configuration is being read using com.pmease.quickbuild.plugin.scm.git.GitRepository.getCurrentRC() method and returns java.util.Properties object with URLs corresponding to the git-scm.xml file eg.:

fetchurl = https://git_user_name:******@bitbucket.tomtomgroup.com/scm/project/repository_name.git
pushurl = https://git_user_name:******@bitbucket.tomtomgroup.com/scm/project/repository_name.git

Note that asterisks come from QuickBuild itself (we use masked passwords stored in secret variables).

 All   Comments   Work Log   Change History      Sort Order:
Steve Luo [25/Nov/17 02:50 AM]
Hi Sebastian,

Thank you very much for the detailed information. But sorry I still don't get your point.

As you already know, we compare previous git settings (load from git-scm.xml) with current settings (read from git definition) one entry by one entry. Do you mean here can cause the error? Or do you mean anything else?

Sebastian Potasiak [27/Nov/17 06:44 AM]
Hi Steve,

I mean that despite the fact we do not change repository settings, and git-scm.xml stays the same, QuickBuild detects some change (we get "Repository setting changed, removing working directory", or something like that in logs), which results in entire working directory being deleted, even though it is not necessary (as the settings do not change).

It is very troublesome for us as we have huge Git repository, and checking it out again takes up to 30 minutes, casuing build to last over 30% longer.

We want repository to not be deleted when it is not necessary, and we don't know why it is being deleted in first place, since we don't change its settings.

Steve Luo [27/Nov/17 02:27 PM]
I can't reproduce this issue and I have added some logs to see what setting is changed, please replace your old plugin with the below one:

https://www.dropbox.com/s/cm4skncenpjl6qu/com.pmease.quickbuild.plugin.scm.helper_7.0.56.jar?dl=0

to replace the old plugin:

1. shutdown the server
2. copy the plugin to ${quickbuild-home}/plugins
3. delete the old plugin
4. start the server again

Sebastian Potasiak [06/Dec/17 07:49 AM]
We don't want to shutdown our server since it's a production environment, and is critical for our operations. Will do it though, if we have no other choice.

Can you tell me instead, whether running any git commands in build steps, like git remote add, or any other, can affect properties in .qbcache directory?

Also, maybe I'm wrong, not sure now to be honest, I have probably seen two kinds of files: .qbcache/git-scm.xml, and .qbcache/qb-scm.xml (doesn't exist simultaneously). Is it a thing? If it is, why the files have different names, while they have the exact same content?

Steve Luo [07/Dec/17 09:59 AM]
Hi Sebastian,

I notice that one of our own configuration also cleaned up the directory. But finally I found that it was because we clean up the workspace in master step. So please verify whether you have also cleaned up the workspace before check out step.

I have also searched our code base and don't see any text "git-scm", so I don't know why you see this file.

Sebastian Potasiak [07/Dec/17 10:31 AM]
Hi,

Thanks for the response.

We don't clean up workspace, that's the point. It is being cleaned whenever it detects a change in the mentioned qb-scm.xml file (even though it doesn't change), and indicates it with log:

INFO - Repository setting changed, deleting working directory

As for git-scm.xml, you are right, I got it wrong. It's qb-scm.xml only. Sorry for confusion.

Steve Luo [07/Dec/17 12:34 PM]
Hi Sebastian,

Sorry, I can't reproduce the issue here. If you don't want to use that plugin, I will create a new patch release which includes the log and some possible fix and let's see what will happen then.

Sebastian Potasiak [07/Dec/17 12:52 PM]
What about the other thing I asked about: does executing a command / script running git commands on checked out repository might have impact on the qb-sc.xml files?

Sebastian Potasiak [15/Dec/17 07:23 AM]
Ping. Can you answer the question above?

Steve Luo [15/Dec/17 07:51 AM]
Hi Sebastian,

A possible reason I think may be that you have checked in qb-scm.xml to git, which is different from the actual properties. So you may check if this is the case. If so, please add .qbcache/** to your .gitignore file.

We have also published a new patch release 7.0.30 which added some logs so we can know what kind of settings have been changed and whether the file itself is there or not. So please upgrade to that version and then you can look through the build log.

The changes including below words:

Repository setting changed: xxxxxx, deleting working directory xxxxxx

if you see this, you can know which settings have been changed.

or

Repository RC file xxxx doesn't exist!

This means that your workspace has been deleted for some reasons.

Sebastian Potasiak [15/Dec/17 08:00 AM]
Hi Steve,

Thanks for a quick answer. As for .qbcache directory, we already have it in .gitignore, so that's not the case. We will probably upgrade to 7.0.30.

Are there any breaking changes since 7.0.28? (I think not, but we have to be sure)

Steve Luo [15/Dec/17 02:53 PM]
I don't think there is any breaking changes.

Martin [21/Feb/18 01:41 PM]
Hi there,
you can close this ticket as it came out that there was an issue on our side. One step was by accident removing the git repository which is used by the "Record changes" step.