setup AOSP source on local gerrit - gerrit

I would like to setup a local copy of android source into local gerrit.
I installed gerrit and used git clone --mirror to clone android under
/home/gerrit2/review_site/git/ with repo sync , restarted gerrit and i can see all repositories as projects in Gerrit, but I cannot access them when I click on the project I get:
Code Review - Error The page you requested was not found, or you do
not have permission to view this page
Then I found that I'm able to browse two repositories: git-repo and kernel
I looked at my /home/gerrit2/review_site/git/ and I understand that everything that is in nested directories cannot be accessed:
.repo
device
git-repo.git
kernel.git
platform
vendor
So only kernel.git and git-repo.git can be accessed normally in gerrit.

well i found the solution.
What i did not mention is that i am using http proxy with gerrit and i found the fix in the Apache httpd configuration, had to add "nocanon" option into following line:
ProxyPass /gerrit/ http://MY_GERRIT_IP:8081/gerrit/ nocanon

Related

How to configure rebar3 to fetch dependencies from another host?

I have an app which uses rebar3, eg cowboy. My question is: how can I easily configure it to fetch cowboy from another host? That is I want to point it from github to another host.
You want to build cowboy that has two dependencies which are git repositories on GitHub (https://github.com/ninenines/cowlib and https://github.com/ninenines/ranch to be specific). But you want to fetch the repositories from some other host, like your company's own git server where you mirrored all public repositories you need.
You have a number of options:
Fork cowboy and change the dependency URL-s in the rebar.config. This is the only (sane) way I know to make Rebar3 fetch the dependencies from a different location. The other options will target the layers below Rebar3 to achieve the same result.
Configure git to rewrite GitHub URL-s to URL-s on your server, following e.g. https://stackoverflow.com/a/11383587/9015322
git config --global url.https://git.mycompany.com/.insteadOf https://github.com/
Add an /etc/hosts entry that resolves github.com to the IP of your server. You'll probably have to create a fake self-signed certificate for github.com, and make git on the build machine trust it. But you can do that following the advice here: https://stackoverflow.com/a/16543283/9015322
By default, rebar3 will only grab packages from either hex.pm, any git repository, or any mercurial repository. You can see your options here.
If these defaults are not enough for you, you can create your own dependency resources. This will require you to write some Erlang code in order to tell rebar3 how to find and download the package(s) you are trying to use.

Running job on local jenkins with local repository

I have Selenium project and i want to run my job on local Jenkins 2.176.1 from local repository (using path to my project folder on disc).
Do You know where's that option? I remember that I use this option few months ago, but now I can't find box for path to files on disc.
Now I only see git/subversion option.
[]
Linking-jenkins-local-git-repository.
Go to Source Code Management tab and select Git
The critical part is what you enter here as the “Repository URL”. The correct value should start with file://// for a local repository which is created on your PCs local file system.
For a test project which was created under “/usr/local/projects/reporting-servicet” the Repository URL should be entered as “file:////usr/local/projects/reporting-service”.
Now save this configuration, go to “Jenkins” dashboard (http://localhost:8080/) and click your projects name on the right
#Sunny Sharma's answer works well for a local git repository. I setup a Multibranch Pipeline Project, added the following into Branch Sources > Git > Project Repository
file:///<path-to-local-git-repository>
or simply w/o file:///
<path-to-local-git-repository>
Where file:/// or file://// both are working for *nix style forward slash path. Even though you're using a local git repository, any changes you made needed to be committed locally first in order to let Jenkins check out and pick them up. Validated on Jenkins 2.263.4.

Gerrit - Reload Plugins to incorporate changes

I am developing some plugins for Gerrit 2.9 and usually copy the jar file into the Gerrit site's plugin folder.
However, I notice that it usually takes a while for Gerrit to pick up the changes made in the plugin jar file. One thing that automatically forces Gerrit to reload the plugins is to restart the server itself.
Next, I tried ssh -p 29418 localhost gerrit plugin reload <plugin-name>, however I get an error saying that "Fatal: Remote plugin administration is disabled".
To solve the above message, I was able to find this post where the suggestion is to add missing configuration option: "plugins.allowRemoteAdmin = true". However I am not sure where to add this configuration option.
So any ideas on how to do a force reload of Plugins without having to restart the Gerrit server itself ?
Open YOUR_GERRIT_DIR/etc/gerrit.config file and add the following entry:
[plugins]
allowRemoteAdmin = true
Save changes and restart your Gerrit instance. You will be able to reload / install plugins from remote host.

Whats the best way to work with Github and multiple computers?

I am developing some school grading software and decided to use Github to host the project. After building some code on my Ubuntu box I pushed it to Github and then cloned it down to my MacBook Pro. After editing the code on the MBP I pushed it back to Github. The next morning I tried to update my repo on the Ubuntu box with a git pull and it gave me all kinds of trouble.
Whats the best way to work in this situation? I don't want to fork my own repo and I don't really want to send myself emails or pull requests. Why can't I just treat Github like a master and push/pull from it onto all of my personal repos on different computers?
I'll assume your problem was that the machine on which you first created the repo crapped out when you tried to issue the git pull command.
When you clone an existing git repository (like you did on your 2nd machine, the MacBook Pro), you're automatically set up to so your git pull commands will automatically merge the remote with your local changes.
However, when you initially create a repo and then share it on a remote repository, you have to issue a few commands to make things as automated as a on cloned repo.
# GitHub gives you that instruction, you've already done that
# git remote add origin git#github.com:user_name/repo_name.git
# GitHub doesn't specify the following instructions
git config branch.master.remote origin
git config branch.master.merge refs/heads/master
These last few instructions configure git so future git pull's from this repo will merge all remote changes automatically.
The following is a bit of shameless self-promotion. If you use Ruby, I have created a Ruby-based tool that lets you deal with all these kinds of things with git remote branches. The tool is called, unsurprisingly, git_remote_branch :-)
If you don't use Ruby, my tool is probably gonna be too much of a hassle to install. What you can do is look at an old post on my blog, where most of the stuff grb can do for you was explicitly shown. Whip out your git notes file :-)
You can also add multiple SSH public keys.

Where is the Jenkins working directory located?

Situation:
I installed Jenkins on my vserver and setup a "freestyle pipeline". I connected it via webhook push to my github which works (when I push to the repository, a new build job is started in jenkins).
Problem:
I can't seem to find the working directory where the git pull is executed in. I already searched for answers and many people say $JENKINS_HOME, but echo $JENKINS_HOMEreturns a blank line for me. Did I do anything wrong or where is my project then? Also, can I set the path to where the repository is pulled to a custom path (say /root/myprojectname)?
EDIT:
I can see the workspace in Jenkins webuserinterface but I can't find the corresponding folder on the vservers drive.
Did you check in /var/lib/jenkins. By default the jenkins home directory lies there as well in case of linux servers. It should also show you the home directory by browsing Manage Jenkins--> Configure System

Resources