Just a place for links to getting Jenkins working for CICD for my projects.
That gets you started.
Probably overkill and more than you need but I tried to cover most of the stuff I have in github
. You may want to add others as well.
You can jump past the Docker setup if you already did the above by scrolling down to Fork and clone the sample repository. Also ignore docker stuff in project setup.
I can't seem to login to Jenkins after restart.
Lots of posts say to do something like
sed -i 's/<useSecurity>true<\/useSecurity>/<useSecurity>false<\/useSecurity>/g' /var/lib/jenkins/config.xml
but that assumes you set up with a local DB instead of the linux users. If you make the change and are using the local auth Jenkins will not even start. Worse yet, it fails quietly wasting even more time digging uselessly to try and find an error to solve. Here is the rub. In order to use the local auth system the user Jenkins runs at needs to be able to read /etc/shadow which means running root or hacking perms. So despite using the local users making the most sense logistically, it makes little sense security wise so you want to switch to something else but first you need to get in. The way that works is to set the password for the user you are running Jenkins as.
Now you can login with that user and password and change the Security Realm in Configure Global Security to something else. Jenkins’ own user database makes the most sense for me.
|Jenkins Configure Global Security page|
Info on options can be found here
To be closer to my work setup I made it a bit fancier.
|Project-based Matrix Authorization Strategy example|
If you do the above project based auth you will also want to config Access Control for Builds
To make life somewhat simpler though I'm defaulting to running builds as the jenkins user. To sort perms then I needed to run
chown jenkins.jenkins -R /var/lib/jenkins/workspace/
I hit this because I added a project and built it before restarting so everything was owned by and restricted to root.