JFactory is a ready to use CI/CD environment created as a series of a Docker containers. Currently it contains:
- Gerrit for management of the Git repositories
- Jenkins for verifying reviews and continuously deploying ready product
- Nexus for keeping binary files
- Nginx which acts as a proxy to Gerrit, Jenkins and Nexus
- Download starter repository.
git clone https://github.com/atteo/jfactory-starter
- Execute:
setup.sh
-
Edit '.env' file and set at least LDAP_URL and LDAP_ACCOUNT_BASE
-
Start Docker containers:
docker-compose up
Docker-compose will start Gerrit, Nexus, Jenkins and Nginx. As Gerrit setup is not finished yet, Jenkins might be unable to connect to Gerrit and the following error will be shown in the logs:
com.sonymobile.tools.gerrit.gerritevents.ssh.SshException: com.jcraft.jsch.JSchException: Auth fail
This is normal on first run.
- Open Gerrit web page:
http://172.179.0.1/gerrit
Note: URL might be different, if you modified MAIN_URL in .env file
Log in as some user. The first user to log in will have Administrator role in Gerrit. After the first user logs in the batch-user plugin in Gerrit will automatically create another user with appropriate permission for Jenkins Trigger plugin.
Nginx proxy can optionally use HTTPS instead of plain HTTP. To switch to HTTPS change MAIN_URL property in '.env' file from http:// to https:// . Using HTTPS requires valid SSL certificates. By default self-signed certificates generated by setup.sh script are used. You can provide your own key and certificate files by overwriting the files in which they are stored: certificates/nginx-server.key and certificates/nginx-server.crt.
Users need to have the server certificate imported as a trusted certificate in order for git commands to work without issuing an error.
If you receive the following error when cloning the repo
fatal: unable to access 'https://..../gerrit/example/': server certificate verification failed
the SSL certificate for HTTPS is not trusted on your machine. Import the certificates in your OS store. For ubuntu see this link.