File tree Expand file tree Collapse file tree 10 files changed +220
-0
lines changed Expand file tree Collapse file tree 10 files changed +220
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Enable email notification on Jenkins
2
+
3
+ ## pre-requisites
4
+ 1 . A Jenkins Server [ Click here to create] ( )
5
+
6
+ ## Integration Steps
7
+ Log into the Jenkins to install mailer plugin
8
+
9
+ 1 . Install "mailer" plug-in
10
+ - ` Manage Jenkins ` -> ` Manage Plugins ` -> ` available ` -> ` mailer `
11
+
12
+ 2 . Configure Mailer
13
+ - ` Manage Jenkins ` -> ` Configure System `
14
+ - E-mail Notification:
15
+ - SMTP server : ` smtp.gmail.com `
16
+ - Advanced:
17
+ - [x] `Use SMTP Authentication`
18
+
19
+ - Passwrod : `<password>`
20
+ - [x] ` Use SSL `
21
+ - SMTP Port: `465`
22
+ - Charset : `UTF-8 (Auto filled)`
23
+ #### Unable to authonticate?
24
+ please allow your gmail to access "less security apps" [ click here to enable] ( https://myaccount.google.com/intro/security )
25
+ ---
26
+ ---
27
+ ### Create a Freestyle Project
28
+
29
+ 1 . Create a new job
30
+ - Job Name : ` test-email-job `
31
+ - Source code management
32
+ - Git URL : [ get URL here] ( https://github.com/yankils/hello-world.git )
33
+ - Build Environment
34
+ - Maven3-Artifactory Integration : `<provide Artifactory server and repository details
35
+ > `
36
+ - Build --> Invoke Artifactory Maven3
37
+ - Goals: ` clean install`
38
+
39
+ # Still working
Original file line number Diff line number Diff line change
1
+ # Run a Jenkins job with GitHub webhook
2
+
3
+ ## pre-requisites
4
+ 1. A Jenkins Server [Click here for help]()
5
+ 1. A GitHub repository [Click here for help]()
6
+
7
+ ## Integration Steps
8
+ Log into the Jenkins
9
+
10
+ ---
11
+ ### Create a Freestyle Project
12
+
13
+ 1. Create a new job
14
+ - Job Name : `WebhookTestJob`
15
+ - Source code management
16
+ - Git URL : [get URL here](https://github.com/yankils/hello-world.git)
17
+ - Build Triggers
18
+ - [X] `GitHub hook trigger for GITScm polling`
19
+
20
+ - Build --> `Add Build Step` --> `Invoke Top Level Maven Triggers`
21
+ - Maven Version: `Maven`
22
+ - Goals: ` clean install`
23
+
24
+ 2. On GitHub repository
25
+
26
+ `repository` --> `settings` --> `webhooks`
27
+ - Add webhook
28
+ - Payload URL : `Jenkins_IP>:8080/github-webhook`
29
+ - Content type : `Application/JSON`
30
+
31
+ 3. Update the code with new commit. It should trigger our job in the jenkins
32
+
Original file line number Diff line number Diff line change
1
+ pipeline {
2
+ agent any
3
+
4
+ stages {
5
+ stage('Build') {
6
+ steps {
7
+ echo 'Building..'
8
+ }
9
+ }
10
+ stage('Test') {
11
+ steps {
12
+ echo 'Testing..'
13
+ }
14
+ }
15
+ stage('Deploy') {
16
+ steps {
17
+ echo 'Deploying....'
18
+ }
19
+ }
20
+ }
21
+ }
Original file line number Diff line number Diff line change
1
+ pipeline {
2
+ agent any
3
+ stages {
4
+ stage('Build') {
5
+ steps {
6
+ sh 'echo "My first pipeline"'
7
+ sh '''
8
+ echo "By the way, I can do more stuff in here"
9
+ ls -lah
10
+ '''
11
+ }
12
+ }
13
+ }
14
+ }
Original file line number Diff line number Diff line change
1
+ pipeline {
2
+ agent any
3
+ stages {
4
+ stage('Timeout') {
5
+ steps {
6
+ retry(3) {
7
+ sh 'I am not going to work :c'
8
+ }
9
+ }
10
+ }
11
+ }
12
+ }
Original file line number Diff line number Diff line change
1
+ pipeline {
2
+ agent any
3
+ stages {
4
+ stage('Deploy') {
5
+ steps {
6
+ retry(3) {
7
+ sh 'echo hello'
8
+ }
9
+
10
+ timeout(time: 3, unit: 'SECONDS') {
11
+ sh 'sleep 5'
12
+ }
13
+ }
14
+ }
15
+ }
16
+ }
Original file line number Diff line number Diff line change
1
+ pipeline {
2
+ agent any
3
+
4
+ environment {
5
+ NAME = 'AR'
6
+ LASTNAME = 'Shankar'
7
+ }
8
+
9
+ stages {
10
+ stage('Build') {
11
+ steps {
12
+ sh 'echo $NAME $LASTNAME'
13
+ }
14
+ }
15
+ }
16
+ }
Original file line number Diff line number Diff line change
1
+ pipeline {
2
+ agent any
3
+
4
+ environment {
5
+ secret = credentials('TEST')
6
+ }
7
+ stages {
8
+ stage('Example stage 1') {
9
+ steps {
10
+ sh 'echo $secret'
11
+ }
12
+ }
13
+ }
14
+ }
Original file line number Diff line number Diff line change
1
+ pipeline {
2
+ agent any
3
+ stages {
4
+ stage('Test') {
5
+ steps {
6
+ sh 'echo "Fail!"; exit 1'
7
+ }
8
+ }
9
+ }
10
+ post {
11
+ always {
12
+ echo 'I will always get executed :D'
13
+ }
14
+ success {
15
+ echo 'I will only get executed if this success'
16
+ }
17
+ failure {
18
+ echo 'I will only get executed if this fails'
19
+ }
20
+ unstable {
21
+ echo 'I will only get executed if this is unstable'
22
+ }
23
+ }
24
+ }
Original file line number Diff line number Diff line change
1
+ pipeline {
2
+ agent any
3
+
4
+ stages {
5
+ stage ('Compile Stage') {
6
+
7
+ steps {
8
+ withMaven(maven : 'maven') {
9
+ sh 'mvn clean compile'
10
+ }
11
+ }
12
+ }
13
+
14
+ stage ('Testing Stage') {
15
+
16
+ steps {
17
+ withMaven(maven : 'maven') {
18
+ sh 'mvn test'
19
+ }
20
+ }
21
+ }
22
+
23
+
24
+ stage ('Deployment Stage') {
25
+ steps {
26
+ withMaven(maven : 'maven') {
27
+ sh 'mvn deploy'
28
+ }
29
+ }
30
+ }
31
+ }
32
+ }
You can’t perform that action at this time.
0 commit comments