Posts

Jenkins file | declarative pipeline scripting

Image
 https://www.youtube.com/watch?v=7KCS70sCoK0&t=843s https://plugins.jenkins.io/ ------------------------------------------------------------------------------------------------------------------------------- Post Job -- some automated script such as sending an email etc on the status of the built whether it is successful or not. Define conditional run of the steps for instance you want to run the test in development branch build . The current / active branch name in the build is always available in the jenkins file through and environmental that jenkins provides it . BRANCH_NAME /OR env.BRANCH_NAME  check if this is dev branch This part of the buuild will only execute if the current branch is dev. If you only want to build your application when there are code changes. if branch name and code changes are true CODE_CHANGES is the variable that you define yourself globally like below. getGitChanges()  -- This would be a groovy script to check if there is any changes mad...

Jenkins Interview Question

 https://www.youtube.com/watch?v=7KCS70sCoK0&t=843s   ------------------------------------------------------------------------------------------------------------------------------- Jenkins Basics What is Jenkins, and why is it used? Explain the difference between Jenkins and Hudson. How can you install Jenkins? Describe the architecture of Jenkins. What is a Jenkins pipeline? What are Jenkins plugins, and why are they important? What is the role of the Jenkins Master in a Jenkins setup? What is a Jenkins agent or node? How do you back up Jenkins configurations and data? Explain what the Jenkinsfile is and its significance. Jobs and Builds How can you create a new Jenkins job? What is a Jenkins build? What is a Jenkins workspace? How do you schedule jobs in Jenkins? Explain the concept of parameterized builds in Jenkins. What are build triggers in Jenkins? How do you archive artifacts in Jenkins? How can you secure your Jenkins job? Explain the difference between a Freesty...

Jenkins : Pipeline Coding : Declarative

 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Using Multiple agents in s Jenkins Pipeline :  https://www.youtube.com/watch?v=a25n3NeXD2o  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ https://www.jenkins.io/doc/pipeline/tour/running-multiple-steps/ On Linux, BSD, and Mac OS (Unix-like) systems, the  sh  step is used to execute a shell command in a Pipeline. Jenkinsfile (Declarative Pipeline) pipeline { agent any stages { stage( ' Build ' ) { steps { sh ' echo "Hello World" ' sh ''' echo "Multiline shell steps works too" ls -lah ''' } } } } Executing an Ansible Job using pipeline { agent any stages { stage ("SCM checkout") { steps { git "https://github.com/muzakkirsaifi123/...

Jenkins - Quick Navigation

 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++   +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  

Jenkins : Pipeline Creation : With Webhooks

Image
 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  JENKINS   https://www.jenkins.io/doc/book/pipeline/running-pipelines/ CentsOS - Jenkins File location : /etc/sysconfig/jenkins  Username :sreejith Password : Orange999 Jenkins executable path on Jenkins  :  Linux : /usr/bin/git +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ How to Install Jenkins in CentOS-7 https://www.vultr.com/docs/how-to-install-jenkins-on-centos-7/ Installing Jenkins while downloading the repo got a message certificate has expired bash-4.2$ sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo --no-check-certificate --2022-08-18 07:05:19--  https://pkg.jenkins.io/redhat-stable/jenkins.repo Resolving pkg.jenkins.io (pkg.jenkins.io)... 151.101.130.133, 151.101.194.133, 151.101.2.133, ... Connecting to pkg.jenkins.io (pkg.jenkins.io)|151.101.130.133|:443... connected. WARNING: cannot verif...

Python : Policy as a Code :

 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  YAML - Policy as a Code https://pynative.com/python-yaml/ We can read the YAML file using the PyYAML module's yaml. load() function.  This function parse and converts a YAML object to a Python dictionary ( dict object). This process is known as Deserializing YAML into a Python.05-Apr-2021 Installing PyYAML   Installing PIP :   https://linuxize.com/post/how-to-install-pip-on-centos-7/ 1. Pip is not available in CentOS 7 core repositories. To install pip we need to enable the EPEL repository   $ sudo yum install epel-release 2. Once the EPEL repository is enabled we can install pip and all of its dependencies with the following command: $ sudo yum install python-pip Installed Python version 3, Use the below link to install : Version https://phoenixnap.com/kb/how-to-install-python-3-centos-7 bash-4.2...

JENKINS : Work Project : Using AWS

Image
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  ec2-instance.tf resource "aws_instance" "sreejith_instance" {   ami           = data . aws_ami . amz_linux2 . id   #instance_type = "t2.micro"   instance_type = var . instance_type   count         = var . instance_count   # user_data = file("${path.module}/app1-install.sh")   key_name = var . instance_keypair   vpc_security_group_ids = [ aws_security_group . vpc-ssh . id , aws_security_group . vpc-web . id ]   # count = 3   tags = {     Name  = element ( var . instance_tags , count. index )   } }  ami-datasource.tf # While launching the EC2 - You ger the image id taking that image id search in # AMI -- on the left - search in public images -- copy past the id you will get the Image id # ...