In order to test the plugin on different versions of GitLab and Jenkins you may want to use Docker containers.
An example docker-compose file is available at gitlab-plugin/src/docker which the user can use to set up instances of the latest GitLab version and latest Jenkins LTS version for linux/amd64.
If they don't already exist, create the following directories and make sure the user that Docker is running as owns them:
- /srv/docker/gitlab/postgresql
- /srv/docker/gitlab/gitlab
- /srv/docker/gitlab/redis
- /srv/docker/jenkins
To start the containers for Linux, run docker-compose up -d from the src/docker folder. If you have problems accessing the services in the containers, run docker-compose up by itself to see output from the services as they start, and the latter command is the verbose version of the former.
You need to modify the example docker-compose file available at src/docker to set up instances of the latest GitLab and Jenkins versions for MacOS/arm64.
Due to Apple's System Integrity Protection (SIP), the suggested paths cannot be simply created and accessed, so you may need to use the home directory (~) as a root for the new directories to be created.
In the docker-compose.yml file:
- Change the ports to
- '55580:80'
- '55522:22' as the browser may block the ports in original docker-compose file.
- Change the gitlab volumes to
/Users/yourusername/srv/docker/gitlab/config:/etc/gitlab/Users/yourusername/srv/docker/gitlab/logs:/var/log/gitlab/Users/yourusername/srv/docker/gitlab/data:/var/opt/gitlab - Change the jenkins volumes to
/Users/yourusername/srv/docker/jenkins:/var/jenkins_home - In your Docker-Desktop go to
Settings > General > Choose file sharing implementation for your containersand switch toosxfs (Legacy). Asosxfs (Legacy)utilizes more resources of the system, make sure the assigned resources are sufficient by going toSettings > Resourcesand make suitable adjustments where necessary, otherwise Docker Desktop may go on start mode forever on restarting.
Like the instructions for Linux, for macOS users to start the containers, run docker-compose up -d from the docker folder. If you have any problems accessing the services in the containers, run docker-compose up by itself to see output from the services as they start.
To access GitLab, you first need to create a user - root with some password. To do so, follow the following steps:
- Point your browser to
http://localhost:55580and log in withrootas the username andp@ssw0rdas the password. - Then create a user for Jenkins, impersonate that user, get its API key, set up test repos, etc. When creating webhooks to trigger Jenkins jobs, use
http://jenkins:8080as the base URL.
If you have trouble cloning a GitLab repository, it may be because you have a leftover host key from an SSH connection to a previous installation of GitLab in Docker. To troubleshoot, run ssh -vT git@localhost -p 55522.
Please note that it is no longer recommended to use ports 10080 and 10022 even for local testing, as more modern browsers have policies set to block the use of such ports.
To see Jenkins, point your browser to http://localhost:8080. Jenkins will be able to access GitLab at http://gitlab.
Note: you need to change the security settings in Admin -> Settings -> Network -> Outbound Requests -> Allow requests to the local network from hooks and services in order for local webhooks to work.
For more information on the supported Jenkins tags and how to configure the containers, visit https://hub.docker.com/r/jenkins/jenkins/.