Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

capstone-project

TERRAFORM

Initialize and Apply Terraform Configuration: Initialize Terraform: terraform init

Apply the configuration: terraform apply

terraform apply output

JENKINS

Launch an ec2 instance on aws

ec2-instance

In your security group ensure to open these ports 443, 8080, 22, 80

security group

ssh into your ec2 instance (in this case i will be using EC2 instance connect)

ssh-into-ec2-instance

sudo apt update

ec2 instance update

sudo apt install openjdk-11-jre

openjdk installation begins

openjdk completed

Now; visit this site on your browser

pkg.jenkins.io

jenkins package website

Click debian-stable/

debian-stable page

Then copy the copy one by one and paste in your ec2 instance

wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add - sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

jenkins show ok

sudo apt update ec2 update again

sudo apt-get install fontconfig openjdk-17-jre

font config

font config completed

sudo apt-get install jenkins

installing jenkins jenkins installed

Access your jenkins in you browser with your ec2 public ipv4 address include :8080 at the end of the public ipv4 address

jenkins page

To get Administrator Password on the jenkins admin page

jenkins admin page

cat the the directory shown there in your ec2 server you already ssh into sudo cat /var/lib/jenkins/secrets/initialAdminPassword (you will see on your jenkins page), this command will help you get your admin password

cat to see the admin password

Create an Admin user

admin user sample page

Then you will be taken to another page to customize jenkins

customize jenkins

Install all plugins or specific depending on your used case (here i will be installing all recommendded plugins)

install plugins

You will see Jenkins path Url

jenkins path

Then you will receive a prompt noting that Jenkins is Ready

Jenkins is Ready

CICD with Jenkins

Create New Job with Pipeline Under pipeline

  • select pipeline script
  • select hello world as sample

hello world script on pipeline script

Run Sample Code

build hello world sample code

Do Check-out Using Declarative Format

copy git repo url

click configure, then click pipeline syntax

click pipeline syntax

From the Sample step

  • select checkout: Check out from version control

select checkout from git version control

  • provide your git repository url (copy that by clicking code on your git repository)

provide git url in jenkins

Now, we need to provide some Aunthentication

*click on Add Jenkins

click Add

select Jenkins

  • you should see username with password then add your username and password, username: your github account username

type your github username

password: you need to generate the password from your github by generating a token for Authentication

How to generate password

  • go to github
  • go to setting (ensure you access the setting from clicking the placeholder for your github profile picture, that's where you can see develpoer settings)

go to settings but from the profile placeholder

  • click developer settings

developer setting shown

  • go to personal access tokens

Personal Token under developer setting

  • click generate new token drop down, click generate new token (classic)

generate new token image shown

  • give any name in the tab called "Note" provided

  • select expiration time from the Expiration* drop down

  • Check all boxes in the Select Scopes

  • Click generate token

image showing the action listed above

image showing the action listed above

image showing the action listed above

token generated

Copy the token from github then paste in the password column on Jenkins, give it an ID then Add

copy and paste token generated

In the credentials, select your credential at the far end of the list

select the newly added credential

Ensure you are on Either Master or Main branch, confirm that from your github

be sure you typed in the correct branch nanme

Generate pipeline script, then copy

generate pipeline script

Paste the generated script replacing Hello World

paste the generated script

Now run build again to comfirm no build error

build 2

TO Configure Webhook in Github and Jenkins

Go to github setting, click webhook

click webhook

Paste Jenkins url, ensure to add this to the jenkins url /github-webhook/ then click add webhook

paste jenkins url

Check if you get green tick icon

webhook Successful

Now Let's configure github in JENKINS

  • go to Jenkins pipeling, tick configure

Github hook trigger for GitScm polling, then save

tick the box

Jenkins Github integration is then fully completed

build incrasing

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages