DevOps Classroomnotes 17/Sep/2022

Recover a Deleted Commit

  • Commit 3 is deleted
    Preview
  • Check the reflog
    Preview
    Preview

Fork

  • This is a Git Server Repository Feature
  • Fork is used to create a local copy of the repository where you don’t have permissions.
  • Refer Here for the repository owned by someone else
    Preview
    Preview
    Preview

Pull Request

  • Once you fork the repository and make changes, then pull request is a way so that we can send our local changes to the actual repository.
  • Actual Repository admin, can review you pull request and merge if required, reject if not.
  • Now we have create a fork and commited a change in the forked repository
  • Now lets create the pull request to send the changes for approval to the original repo owner
    Preview
    Preview
  • Now the actual repo owner recieves a pull request
    Preview
    Preview
    Preview

CI/CD Pipeline

  • CI/CD Pipeline
    Preview

Jenkins CI/CD Engine

  • Jenkins is a CI/CD Engine which can be used to create pipelines.
  • Jenkins is developed in JAVA language, so jenkins requires JAVA installation on the servers.
  • Jenkins is CRON (Scheduler) on Steriods developed for CI/CD Purposes.

Installing Jenkins

  • Lab Setup: Jenkins Master
    Preview
  • For installing Jenkins Refer Here
  • For now lets create an ubuntu VM (free tier) & for installing refer here Refer Here
  • Ensure 22 and 8080 ports are open
  • Install java 11 (openjdk11)
# ubuntu
sudo apt-cache search openjdk
sudo apt install openjdk-11-jdk -y

#redhat
sudo yum search openjdk
  • Use the commands from the documentation
curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo tee \
  /usr/share/keyrings/jenkins-keyring.asc > /dev/null
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
  https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
  /etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update
sudo apt-get install jenkins -y
  • Now navigate to http://<public-ip&gt;:8080
    Preview
  • Now select install selected plugins
    Preview
    Preview
    Preview
  • Now as discussed in the class create a free style jenkins project (job) with 2 commands in build steps => invoke shell
whoami
pwd

Preview
* Verify /etc/passwd on jenkins master
Preview
* Observations:
* A user with name jenkins and home directory /var/lib/jenkins got created.
* Jenkins UI is as good as linux user jenkins and the permissions which jenkins user has.
* Experiment 2:
* Lets execute sudo apt update in the build step along with whoami and pwd
Preview
* Add jenkins to the visudo with no password and rerun the build then it will work.
* Experiment 3:
* Lets build a java code spring pet clinic Refer Here
* Softwares required to perform build
* git
* java 11
* maven
* Commands
git clone https://github.com/spring-projects/spring-petclinic.git
cd spring-petclinic
mvn package

Preview
* Execute the build
Preview
Preview
*

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner