forked from devopsmohiuddin/DevOps
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
220 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Enable email notification on Jenkins | ||
|
||
## pre-requisites | ||
1. A Jenkins Server [Click here to create]() | ||
|
||
## Integration Steps | ||
Log into the Jenkins to install mailer plugin | ||
|
||
1. Install "mailer" plug-in | ||
- `Manage Jenkins` -> `Manage Plugins` -> `available` -> `mailer` | ||
|
||
2. Configure Mailer | ||
- `Manage Jenkins` -> `Configure System` | ||
- E-mail Notification: | ||
- SMTP server : `smtp.gmail.com` | ||
- Advanced: | ||
- [x] `Use SMTP Authentication` | ||
- User Name : `valaxytech@gmail.com` | ||
- Passwrod : `<password>` | ||
- [x] `Use SSL` | ||
- SMTP Port: `465` | ||
- Charset : `UTF-8 (Auto filled)` | ||
#### Unable to authonticate? | ||
please allow your gmail to access "less security apps" [click here to enable](https://myaccount.google.com/intro/security) | ||
--- | ||
--- | ||
### Create a Freestyle Project | ||
|
||
1. Create a new job | ||
- Job Name : `test-email-job` | ||
- Source code management | ||
- Git URL : [get URL here](https://github.com/yankils/hello-world.git) | ||
- Build Environment | ||
- Maven3-Artifactory Integration : `<provide Artifactory server and repository details | ||
>` | ||
- Build --> Invoke Artifactory Maven3 | ||
- Goals: ` clean install` | ||
|
||
# Still working |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Run a Jenkins job with GitHub webhook | ||
|
||
## pre-requisites | ||
1. A Jenkins Server [Click here for help]() | ||
1. A GitHub repository [Click here for help]() | ||
|
||
## Integration Steps | ||
Log into the Jenkins | ||
|
||
--- | ||
### Create a Freestyle Project | ||
|
||
1. Create a new job | ||
- Job Name : `WebhookTestJob` | ||
- Source code management | ||
- Git URL : [get URL here](https://github.com/yankils/hello-world.git) | ||
- Build Triggers | ||
- [X] `GitHub hook trigger for GITScm polling` | ||
|
||
- Build --> `Add Build Step` --> `Invoke Top Level Maven Triggers` | ||
- Maven Version: `Maven` | ||
- Goals: ` clean install` | ||
|
||
2. On GitHub repository | ||
|
||
`repository` --> `settings` --> `webhooks` | ||
- Add webhook | ||
- Payload URL : `Jenkins_IP>:8080/github-webhook` | ||
- Content type : `Application/JSON` | ||
|
||
3. Update the code with new commit. It should trigger our job in the jenkins | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
pipeline { | ||
agent any | ||
|
||
stages { | ||
stage('Build') { | ||
steps { | ||
echo 'Building..' | ||
} | ||
} | ||
stage('Test') { | ||
steps { | ||
echo 'Testing..' | ||
} | ||
} | ||
stage('Deploy') { | ||
steps { | ||
echo 'Deploying....' | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
pipeline { | ||
agent any | ||
stages { | ||
stage('Build') { | ||
steps { | ||
sh 'echo "My first pipeline"' | ||
sh ''' | ||
echo "By the way, I can do more stuff in here" | ||
ls -lah | ||
''' | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
pipeline { | ||
agent any | ||
stages { | ||
stage('Timeout') { | ||
steps { | ||
retry(3) { | ||
sh 'I am not going to work :c' | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
pipeline { | ||
agent any | ||
stages { | ||
stage('Deploy') { | ||
steps { | ||
retry(3) { | ||
sh 'echo hello' | ||
} | ||
|
||
timeout(time: 3, unit: 'SECONDS') { | ||
sh 'sleep 5' | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
pipeline { | ||
agent any | ||
|
||
environment { | ||
NAME = 'AR' | ||
LASTNAME = 'Shankar' | ||
} | ||
|
||
stages { | ||
stage('Build') { | ||
steps { | ||
sh 'echo $NAME $LASTNAME' | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
pipeline { | ||
agent any | ||
|
||
environment { | ||
secret = credentials('TEST') | ||
} | ||
stages { | ||
stage('Example stage 1') { | ||
steps { | ||
sh 'echo $secret' | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
pipeline { | ||
agent any | ||
stages { | ||
stage('Test') { | ||
steps { | ||
sh 'echo "Fail!"; exit 1' | ||
} | ||
} | ||
} | ||
post { | ||
always { | ||
echo 'I will always get executed :D' | ||
} | ||
success { | ||
echo 'I will only get executed if this success' | ||
} | ||
failure { | ||
echo 'I will only get executed if this fails' | ||
} | ||
unstable { | ||
echo 'I will only get executed if this is unstable' | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
pipeline { | ||
agent any | ||
|
||
stages { | ||
stage ('Compile Stage') { | ||
|
||
steps { | ||
withMaven(maven : 'maven') { | ||
sh 'mvn clean compile' | ||
} | ||
} | ||
} | ||
|
||
stage ('Testing Stage') { | ||
|
||
steps { | ||
withMaven(maven : 'maven') { | ||
sh 'mvn test' | ||
} | ||
} | ||
} | ||
|
||
|
||
stage ('Deployment Stage') { | ||
steps { | ||
withMaven(maven : 'maven') { | ||
sh 'mvn deploy' | ||
} | ||
} | ||
} | ||
} | ||
} |