\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{azka123} \pdfinfo{ /Title (jenkins.pdf) /Creator (Cheatography) /Author (azka123) /Subject (JENKINS Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{2521A3} \definecolor{LightBackground}{HTML}{F1F1F9} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{JENKINS Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{azka123} via \textcolor{DarkBackground}{\uline{cheatography.com/144422/cs/30998/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}azka123 \\ \uline{cheatography.com/azka123} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 3rd March, 2022.\\ Updated 3rd March, 2022.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{JENKINS}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{Jenkins}} is an open source automation tool written in Java that allows continuous integration and continuous delivery of projects.% Row Count 3 (+ 3) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{INSTALL JENKINS}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{{\emph{ON WINDOWS:}}}} \newline % Row Count 1 (+ 1) 1. Install Java Development Kit (JDK) \newline % Row Count 2 (+ 1) 2. Set the Path for the Environmental Variable for JDK. \newline % Row Count 4 (+ 2) 3. Download and Install Jenkins. \newline % Row Count 5 (+ 1) 4. Run Jenkins on Localhost 8080. \newline % Row Count 6 (+ 1) {\bf{{\emph{ON UBUNTU:}}}} \newline % Row Count 7 (+ 1) 1. Install Java (\$sudo apt install openjdk-8-jdk or 11-jdk). \newline % Row Count 9 (+ 2) 2. Add the Jenkins repository. \newline % Row Count 10 (+ 1) 3. Install Jenkins (\$sudo apt update, \$sudo apt install Jenkins). \newline % Row Count 12 (+ 2) 4. Set up Jenkins (http://localhost:8080).% Row Count 13 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{JOB TYPES}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{1.{\bf{ Freestyle build jobs}} are general-purpose build jobs, which provides maximum flexibility. It can be used for any type of project. \newline % Row Count 3 (+ 3) 2. {\bf{Pipeline}} runs the entire software development workflow as code. \newline % Row Count 5 (+ 2) 3. {\bf{Multiconfiguration project}} allows us to run the same build job on different environments. \newline % Row Count 7 (+ 2) 4. {\bf{Folder}} allows users to create folders to organize and categorize similar jobs. \newline % Row Count 9 (+ 2) 5. {\bf{GitHub Organization}} scans your entire GitHub organization and creates Pipeline jobs for each repository containing a Jenkinsfile. \newline % Row Count 12 (+ 3) 6. {\bf{Multibranch Pipeline}} lets us implement different Jenkinsfiles for different branches of the same project. \newline % Row Count 15 (+ 3) 7. {\bf{Maven}} builds a maven project. Jenkins takes advantage of our POM files for packaging.% Row Count 17 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{BUILD PIPELINE}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Build Pipeline can be used to chain several jobs together and run them in a sequence. \newline % Row Count 2 (+ 2) {\bf{BUILD PIPELINE EXAMPLE:}} \newline % Row Count 3 (+ 1) 1. Create 3 freestyle Jobs. \newline % Row Count 4 (+ 1) 2. Chain the 3 jobs together. \newline % Row Count 5 (+ 1) {\emph{ {\bf{Job1 -\textgreater{}configure -\textgreater{}Post Build -\textgreater{}Build other projects -\textgreater{}Job2}} }} \newline % Row Count 7 (+ 2) {\emph{ {\bf{Job2 -\textgreater{}configure -\textgreater{}Post Build -\textgreater{}Build other projects -\textgreater{}Job3}} }} \newline % Row Count 9 (+ 2) 3. Create a build pipeline view. \newline % Row Count 10 (+ 1) {\bf{ {\emph{Jenkins Dashboard -\textgreater{}Add view -\textgreater{}Enter a name -\textgreater{}Build pipeline view -\textgreater{}ok -\textgreater{}configure -\textgreater{}Pipeline flow -\textgreater{}Select Initial job -\textgreater{}Job1 -\textgreater{}ok}} }} \newline % Row Count 13 (+ 3) 4. Run the Build Pipeline.% Row Count 14 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{JENKINS PIPELINE}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Jenkins pipeline is a single platform that runs the entire pipeline as code instead of building several jobs for each \newline % Row Count 3 (+ 3) phase and it puts it in a Jenkinsfile. Jenkinsfile is a text file that stores the pipeline as code. It is written using the Groovy DSL. It can be written based on two syntaxes: \newline % Row Count 7 (+ 4) 1. {\bf{Scripted pipeline}}: Code is written on the Jenkins UI instance and is enclosed within the node block. \newline % Row Count 10 (+ 3) {\bf{node \{}} \newline % Row Count 11 (+ 1) {\bf{scripted pipeline code}} \newline % Row Count 12 (+ 1) {\bf{\}}} \newline % Row Count 13 (+ 1) 2. {\bf{Declarative pipeline}}: Code is written locally in a file and is checked into a SCM and is enclosed within the pipeline block. \newline % Row Count 16 (+ 3) {\bf{node \{}} \newline % Row Count 17 (+ 1) {\bf{declarative pipeline code}} \newline % Row Count 18 (+ 1) {\bf{\}}}% Row Count 19 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{JENKINS PLUGINS}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{Most Commonly Used Jenkins Plugins:}} \newline % Row Count 1 (+ 1) Jenkins comes with over 2000 plugins and each plugin has a unique functionality. But when it comes to software development most developers use a set of plugins, such as, {\bf{Maven, Git, Ant, Docker, Amazon EC2, HTML publisher, Copy artefact, }}etc. \newline % Row Count 6 (+ 5) Follow the below step to install the above plugins or any other Jenkins plugin. \newline % Row Count 8 (+ 2) {\bf{{\emph{Jenkins Dashboard-\textgreater{} Manage Jenkins-\textgreater{} Manage Plugins-\textgreater{} Available }}}} \newline % Row Count 10 (+ 2) In the filter text field enter the name of the plugin you want to install.% Row Count 12 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{MAVEN PROJECT}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{1. Build Step where we can write goals and options. We can write different maven commands \newline % Row Count 2 (+ 2) here such as {\bf{CLEAN, INSTALL, COMPILE, TEST, PACKAGE,}} etc. that affect the {\bf{POM.xml}} file present on our system or GitHub Repository. \newline % Row Count 5 (+ 3) 2. We can also deploy war/ear to a container using post-build actions and archive the same. \newline % Row Count 7 (+ 2) 3. We can execute batch or shell commands as a part of pre-build steps.% Row Count 9 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{AUTOMATED DEPLOYMENT}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{1. Head to the manage plugins and install the respective plugins \newline % Row Count 2 (+ 2) 2. It takes the war/ear file and deploys that to the running remote application build. \newline % Row Count 4 (+ 2) 3. Go-to build and configure and click on 'deploy to war/ear to container' \newline % Row Count 6 (+ 2) 4. In the war container section save details about the destination server and click save. \newline % Row Count 8 (+ 2) {\bf{EXAMPLE:}} \newline % Row Count 9 (+ 1) {\emph{Open a freestyle project. Paste the URL of GitHub repository where POM.xml file is stored in SCM. Add a maven command {\bf{(MVN CLEAN INSTALL)}}. This will give us a war/jar file which we can deploy onto TOMCAT.}}% Row Count 14 (+ 5) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{MANAGE USERS \& ROLES}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Jenkins allows us to give different permissions to a user across different jobs using {\bf{"Project Based Matrix Authorization strategy"}}. \newline % Row Count 3 (+ 3) To use Project-based Matrix Authorization Strategy, First login with Admin user go to \newline % Row Count 5 (+ 2) {\bf{{\emph{Manage Jenkins -\textgreater{} Configure Global Security.}}}} \newline % Row Count 7 (+ 2) In {\bf{"Authorization"}}, Select {\bf{"Project-based Matrix Authorization Strategy"}}. Then add {\bf{"Admin"}}user and check all the checkbox to grant all permission to admin user.% Row Count 11 (+ 4) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}