Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Checking out a Git project does something strange

Bjorn Harvold March 24, 2019

Hi,

I am trying to integrate Sentry CLI into my CI/CD workflow.

Once everything builds, I send artifacts to Sentry. Sentry will look at the Git log to see what changed since last release.

The problem is, Sentry complains because it cannot match the remote Git repo. When i run git remote -v inside the plan folder, it shows me a local file directory instead of my remote hosted repo on Bitbucket.

 

So Sentry complains with:

DEBUG   2019-03-15 16:52:01.492404779 +07:00   not a match: file:///media/user/external/bamboo/xml-data/build-dir/_git-repositories-cache/debbfac5447105f03d2e672cc6b40afd775f0a46 != https://bitbucket.org/uberdevelopment/uber-spa

1 answer

1 accepted

1 vote
Answer accepted
Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 26, 2019

Hi @Bjorn Harvold

This is indeed expected behavior.

Bamboo does use cache repositories for better scalability. Multiple plans can use the same repository, therefore, saving network bandwidth. There are other reasons for this that I would not be the better person to explain.

In the repository advanced configuration, you will see that we can disable caching on remote agents, but this will still not solve your issue. The Bamboo server will still have the cache.

There are some articles written to provide alternatives for users trying to commit and push during a build. You will be able to see in those articles that the remote URL is manually configured:

What I suggest as a workaround for you is manually configuring the remote repository as performed on those articles.

Bjorn Harvold March 27, 2019

Hi Daniel,

Thank you for your feedback.

 

Specifically for my purposes, you are suggesting that I add a remote like so:

git remote add central https://username:${bamboo_bitbucket_password}@bitbucket.org/path/to/reponame.git

 

Sentry is failing when it tries to verify that the repo is indeed the repo at origin. Will adding another remote fix that?

 

Cheers

Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 27, 2019

I don't really know Sentry, what I know is that Sentry seems to expect the local repository to be pointing to the main repository directly. If this is the case, setting the remote should fix the issue or at least move you forward. 

Let's give it a try and check what happens.

Bjorn Harvold March 28, 2019

Hi Daniel,

 

I added a remote as I wrote above. It shows up as central, above origin, when I do a "git remote -v".

 

central https://<hidden>:<hidden>@bitbucket.org/uberdevelopment/uber-spa (fetch)
central https://<hidden>:<hidden>@bitbucket.org/uberdevelopment/uber-spa (push)
origin file:///media/user/external/bamboo/xml-data/build-dir/_git-repositories-cache/c0db605baf9e80f875cbed09008f36a37fe6f6f2 (fetch)
origin file:///media/user/external/bamboo/xml-data/build-dir/_git-repositories-cache/c0db605baf9e80f875cbed09008f36a37fe6f6f2 (push)

 

But it is not being picked up by Sentry. Sentry logs are still only comparing origin entry.

Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 1, 2019

Hi @Bjorn Harvold

Like I shared before, I'm not sure how Sentry works. I just shared a suggestion to set the remote repository configuration once I know that Bamboo uses a shared repository.

I think that you should try seeking for Sentry direct support. This seems to be their channel https://sentry.io/contact/support/.

Bjorn Harvold April 1, 2019

Hi Daniel,

I do believe this is a Bamboo issue if it does something to the Git remote repository to not point at the original remote origin. It's not expected Git behavior and not a use case I think Sentry could anticipate.

What happens if I set remote origin back to its original Bitbucket location? Will Bamboo barf?

Thanks

Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 2, 2019

Hi @Bjorn Harvold

I shared two links with you. In the first one, the solution comes from setting a central repository. In the second one, it comes from setting a new origin.

What happens if I set remote origin back to its original Bitbucket location? Will Bamboo barf?

I don't think that is a big deal, it should work in my opinion. I just share a warning that it might affect the new commit/push tasks added in latest versions of Bamboo.

Do you want to try this and share here what you get?

Bjorn Harvold April 3, 2019

Hi Daniel,

 

Thank you for the feedback. So I set the origin to Bitbucket then tried to run a build. The build immediately succeeded and nothing happened. I tried adding the local Git repo, that Bamboo creates, as central but still nothing. My current setup is like this:

 

central file:///media/user/external/bamboo/xml-data/build-dir/_git-repositories-cache/c0db605baf9e80f875cbed09008f36a37fe6f6f2 (fetch)
central file:///media/user/external/bamboo/xml-data/build-dir/_git-repositories-cache/c0db605baf9e80f875cbed09008f36a37fe6f6f2 (push)
origin https://<username>:<password>@bitbucket.org/uberdevelopment/uber-spa (fetch)
origin https://<username>:<password>@bitbucket.org/uberdevelopment/uber-spa (push)

 

Am I missing something?

 

Thoughts?

Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 4, 2019

Hi @Bjorn Harvold

Have you tried leaving only the origin configured?
I don't know how Sentry works and extra entries might be confusing it.

Maybe it worths a try.

Bjorn Harvold April 4, 2019

Hi Daniel,

 

The job never gets that far. Bamboo stops working a few seconds after I start it whether I have only origin or origin and central remotes configured. Thinking it doesn't like that the local cached version of the repo isn't origin.

 

Thoughts?

Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 5, 2019

I think you are right, the checkout task may be expecting something different from the git repository configuration.

Thoughts?

Yes, please try to check the option Force Clean Build in your source code checkout task or add the task Clean working directory at the beginning of your job. That should work around this problem.

Bjorn Harvold April 6, 2019

Hi Daniel,

 

When I Force Clean Build, Bamboo removes the git remote I manually added through the console and resets Git back to how Bamboo likes it.

 

Sentry works if I set git origin while the job is building. Pretty hacky but I could run a script that sets git remote origin every time.

 

Any better suggestions?

Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 8, 2019

Hi @Bjorn Harvold

That is the way I see it could work, still using the Bamboo checkout task. Yes, you will need to change the origin of every build.

Other option would be cloning the repository manually using a script task and taking control of the whole process involving the git repository.

Please keep in mind that the checkout task is supposed to provide you with the repository source code, and that is the way Bamboo does to make it scalable. There is no right and wrong on how to clone a source, but if you think this should be done differently, please create a feature request in our issue system https://jira.atlassian.com/issues/ and share your reasons there. Our developers will be happy to have your feedback.

Bjorn Harvold April 9, 2019

Hi Daniel,

 

Yes that's what I did. Working :-) Thank you for your patience and help.

 

Cheers!

Like Daniel Santos likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events