Serve custom commit-msg hook from Gerrit - gerrit

Gerrit comes with a default commit message hook to insert a Change-Id in the footer. The hook defines that the Change-Id should be inserted after Issue or Bug in the footer:
CHANGE_ID_AFTER="Bug|Issue"
Now I would like to modify this so it becomes:
CHANGE_ID_AFTER="Refs|Closes|Fixes"
This is because the issue tracker in use doesn't work with Bug or Issue but with an issue identifier starting with a #.
Now of course I can apply this locally but uniformity is desired across the complete development team. It would help a lot if Gerrit would serve this modified file.
I can't seem to find anything in Gerrit's docs that describes what I would like to achieve.
Since the hook is pulled in through scp I thought I might be able to upload a modified hook the same way. This of course didn't work.
I have administrative rights to Gerrit, so that can't be the issue.

Related

BitBucket Cloud: Enable Auto Fork Sync

How can I enable auto fork syncing on BitBucket cloud ? I cant find the option and have to manually keep the fork updated.
Thanks!
While originally I found this article, it seems this only applies to their server product: https://confluence.atlassian.com/bitbucketserver/keeping-forks-synchronized-776639961.html
This article indicates that its a process you will need to manage manually on local:
https://confluence.atlassian.com/bitbucket/forking-a-repository-221449527.html
After you fork a repository, the original repository is likely to continue to evolve as other users commit changes to it. These changes do not appear in your fork. However, you can pull these changes into your fork later by syncing changes locally from the command line.
While this describes pulling upstream manually, you could probably script something to do this more automatically for your purposes. If I end up doing something like this for our team, I'll update this answer with more details or perhaps someone else will do the same.

Change configuration once, and gets multiple config change history

I work with a Jenkins server in which JobConfigHistory plugin is installed.
This server has been used for a while, and I think many other plugins are installed as well.
On this server, I get multiple config change history recorded when I make a change to job configuration.
I don't want this behavior; I want only single history change for a single configuration change.
I guess some Jenkins server config or some installed plugin is the cause of this problem, but I have no clue what I should do to find it out.
Any idea?
There is a Jenkins issue that has been resolved recently:
[JENKINS-22224] one job configuration change results in three Job Config History entries.
But:
Danny Staple added a comment - 20/Nov/14 5:17 PM
We are seeing a general problem here - some of the plugins appear (parameterizedTrigger, ThrottleConcurrentbuilds, NodeLabel, ExtendedChoice are current suspects) to do this too - we are now having as many as 8 (!!) saves in the config. For some plugins, it seems that when there is no change, they save a no-diff config. Almost as if each is doing their own save in order.
Marc Günther added a comment - 20/Nov/14 5:23 PM
+1
We are not using disk-usage plugin anymore, cause it's so slow, but I still see this behaviour. So it's definitely not restricted to disk-usage plugin alone....
The plugin persists the changes whenever the configurable entity is saved regardless there is any change or not. Note there is a global option for the plugin Do not save duplicate history to save only unique changes.

Jenkins + Gerrit Trigger Not Automatically Building

Jenkins does not seem to be automatically pulling in changes that need to be reviewed from Gerrit.
We're using Gerrit Trigger.
Also If I try to manually trigger some, it seems like nothing ever happens.
The "control" in the Gerrit Trigger management area, doesn't seem to much... flashes either "starting", "stopping" or "restarting"
Any ideas where I went wrong?
I was just having the same problem, and it had to do with the default Gerritt setting in my job for matching branches.
In your job, under Gerritt Trigger, if your Branches Pattern says "**", make sure the Type is set to Path, or else it won't match any branches.
I've actually stumbled over the same problem and it took me a while to figure out the UI, since I thought the branch and project configuration belongs to Dynamic Trigger Configuration. The configuration will basically need to look like this:
Note: my configuration uses the Silent Mode, since I don't want the plug-in to communicate back to gerrit.

iOS SVN check in rules

I am new to iOS development. We are using SVN for code repository.
I wanted to know whether there is a way to set some rules on code check in? i.e. suppose we have a code guideline and we want everyone in the team to adher to it religiously. We can set some rules via which automatically it can be found out whether the person has followed the guidelines or not.
Something like TFS check in policies?
You can use on server side the so called "hooks".
Most important is the pre-commit-hook
You can found them on the server inside the repository in the directory hooks
You can place any executable there and it will be called during commit. There is a svncommand called svnlook which you can use to look directly into the transaction to be committed.
In each repository there is one example for each hook SVN provides. These templates showing a sample implementation with some meanigful bash script.
more infos about hooks

Setting up git commit hook for Redmine

I am trying to migrate the setup here at the office from SVN to Git and am setting up Redmine as the host for our projects and issue management (Currently we use a version of Gforge + SVN). I should preface by saying that I'm an embedded C software developer by day and have basically zero experience with Rails or web apps, but I like trying new things so I volunteered to set up the project management tools which will take us into the future.
I have Redmine setup and am using Gitolite as the Git repo manager. Additionally, I am using the ericpaulbishop/redmine_git_hosting plugin to facilitate automatic public ssh key pushing to Gitolite and automatic repo creation when we register a new project. Everything seems to work except the repo view within the project does not keep track of the changesets. (The "History" is just empty, although when you view the files, it does show the latest version correctly)
I copied the post-receive hook from the plugin's contrib directory to the .gitolite/ common hooks, but again I know little about Ruby and how these gitolite hooks work so I don't know how to debug this. I notice there are log messages and things in the hook, but I have no idea where those are printed, etc...
I even tried the Howto on the Redmine wiki, HowTo setup automatic refresh of repositories in Redmine on commit:
#!/bin/sh
curl "http://<redmine url>/sys/fetch_changesets?key=<your service key>"
Any ideas on where I start debugging? I've been able to resolve every problem up to this point, but I'm a little stuck now. The plugin doesn't make it obvious how this is supposed to work, and to be honest, I'm not even sure if this is a problem with Redmine not reading the repo correctly (or at all), or gitolite not communicating as Redmine expects, etc...
I guess I could answer this...
I checked the issues under the Github page and I found this on:
https://github.com/ericpaulbishop/redmine_git_hosting/issues/89
Which was pretty much exactly my problem. This does appear to be a small bug in the plugin, but you can work around it by changing Max Cache Time to "1 minute or until next commit". This immediately fixed my problem. I simply left it like that but one of the posters claimed that you could change it back to until next commit and it works from then on...

Resources