1- Install jenkins with docker image
docker run -d -p 8083:8080 jenkins/jenkins:lts
docker logs <container-ID>
docker exec -it <container-SHA-1> bash
cat <password-path>
2- Install role based authorization plugin
- In manage Plugins Install the plugin then restart jenkins
3- Create read role and assign it to the new user
4- Create free style pipeline and link it to private git repo(inside it create directory and create file with "hello world")
- Provide Repo URL then porivde credentials as Usrname and Password but use Access Token
5- Create declarative in jenkins GUI pipeline for your own repo to do "ls"
- I used 2 ways to do pass Credentials
- 1- Passed credentials ID to the script this ID is found in var/jenkins_home/credentials.xml
- 2- You can choose option from GUI to pull from SCM and provide credentials there
6- Create scripted in jenkins GUI pipeline for your own repo to do "ls"
- Same as declartive way with different syntax
7- Create the same with jenkinsfile in your branches as multibranch pipeline
- Each Branch has a Jenkinsfile
- The pipeline checks every branch for this files then run pipeline for each branch