GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Devops-Notes-20Sep/Jenkins-Notes-23Sep at main · Sonal0409/Devops-Notes-20Sep

Expand file tree

/

Jenkins-Notes-23Sep

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
194 lines (95 loc) · 3.72 KB
/

Jenkins-Notes-23Sep

Copy path

File metadata and controls

194 lines (95 loc) · 3.72 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
Jenkins Set up:
Create an ec2 Instance or use the same instance used in GIT sessions.
If git is not present:
Git installation:
yum install git -y
SEE THAT YOU ARE IN ROOT DIRECTORY
# cd
# pwd
************************************
JAVA Installation
SEE THAT YOU ARE IN ROOT DIRECTORY
# sudo amazon-linux-extras install java-openjdk11
Check Java version:
alternatives --config java
On the browser open https://www.jenkins.io/
Go to downloads section
Select centos OS
Go to Ec2 machine and execute commands:
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
yum install jenkins -y
Execute command to start jenkins server:
systemctl start jenkins
systemctl status jenkins
Installation is complete on the server.
We need to now set up jenkins dashboard
For this, take public ip address of ec2 server, copy it and go to your browser and give
publicipaddress:8080
On the ec2 server, execute below command
$ cat /var/lib/jenkins/secrets/initialAdminPassword
Copy the password and paste in the browser (jenkins)
Click on continue
Click on Jenkins suggested plugin tab(on left side)
On the next page
Username: admin
Password : admin
Retype password: admin
Email: [email protected]
Click on continue
Click on finish
You will be on the jenkins dashboard
How to integrate Jenkins with Github repository
> Connect to AWS ec2 machine- Start the server & start jenkins
> Execute command :
sudo su -
systemctl start jenkins
Go to browser : give public ip ofec2 server:8080
http://3.144.203.98:8080/
Demo 1: Create a Jenkisn job that will clone a github repository in jenkins workspace
Create a new job in jenkins
Click on + sign to create new item/job/project
Give a name to the job : CloneRepo
Select freestyle project and click on OK button
On the project click on Source code management
Select git option
Give git hub repo path
https://github.com/Sonal0409/myproject05Aug
Branch name as ===> Master
Save the job
Click on Build now
Repository will be cloned in jenkins workspace
You can go to job → workspace folder to see the files
Jenkins Triggers.
To automatically execute a jenkins job, you will use Jenkins triggers
Based on:
Periodic time- schedule
Whenever there is a commit in github repo
A parent job can trigger execution of child job
Execute a job from remote script
You will go to build triggered section in the job to set up a trigger for automatic execution of the job
Trigger prieodically
Go to Job Clone repo --> build trigger--> build preodically --> give */2 * * * * --> Save and build now
All build will be generated automatically every 2 mins
Build Triggers--> Poll SCM --> * * * * *
Build will be generated each time there is a chnage in the repository only.
Webhook:
Webhooks allow Jenkins to be notified when certain events happen on the repo. When the specified events happen, we’ll send a POST request to each of the URLs you provide.
GitHub hook trigger for GITScm polling
> Select the above option
Save the job and now go to git hub
Always save the job and then only go to git hub, perform these steps
go to the repository setting
select webhooks on left side
delete if any exisitng webhook
click on createwebhook on right side
provide following information:
Payload URL : jenkinsurl/github-webhook/ ===> http://3.140.252.165:8080/github-webhook/
Content type : select application/json
Secret: no need of any value
Which events would you like to trigger this webhook?
select first option -- Just the push event.
Select Active
click on add webhook.
now make some changes in repo,
go to jenkins--> you will see a new build has been created.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.