Skip to content

Commit

Permalink
delete useless file
Browse files Browse the repository at this point in the history
  • Loading branch information
dennyzhang committed Feb 17, 2019
1 parent 55211d6 commit 188c588
Show file tree
Hide file tree
Showing 16 changed files with 165 additions and 21 deletions.
12 changes: 12 additions & 0 deletions get-env.groovy
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
//-------------------------------------------------------------------
// @copyright 2018 DennyZhang.com
// Licensed under MIT
// https://www.dennyzhang.com/wp-content/mit_license.txt
//
// File: get-env.groovy
// Author : Denny <https://www.dennyzhang.com/contact>
// Link: https://cheatsheet.dennyzhang.com/cheatsheet-jenkins-groovy-a4
// https://stackoverflow.com/questions/31707667/how-to-access-jenkins-environment-variables-with-dsl
// --
// Created : <2018-04-20>
// Updated: Time-stamp: <2019-02-16 22:04:57>
//-------------------------------------------------------------------
def envVars = Jenkins.instance.getGlobalNodeProperties()[0].getEnvVars()
println envVars['myVar']

Expand Down
12 changes: 12 additions & 0 deletions get-ip-by-hostname.groovy
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
//-------------------------------------------------------------------
// @copyright 2018 DennyZhang.com
// Licensed under MIT
// https://www.dennyzhang.com/wp-content/mit_license.txt
//
// File: get-ip-by-hostname.groovy
// Author : Denny <https://www.dennyzhang.com/contact>
// https://asoftwareguy.com/2014/04/17/get-the-ip-address-for-a-host-name-in-groovy/
// Link: https://cheatsheet.dennyzhang.com/cheatsheet-jenkins-groovy-a4
// --
// Created : <2018-04-20>
// Updated: Time-stamp: <2019-02-16 22:04:40>
//-------------------------------------------------------------------
def hostname = 'google.com'
println InetAddress.getByName(hostname).address.collect { it & 0xFF }.join('.')
13 changes: 12 additions & 1 deletion jenkins-views.groovy
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
#!groovy

//-------------------------------------------------------------------
// @copyright 2018 DennyZhang.com
// Licensed under MIT
// https://www.dennyzhang.com/wp-content/mit_license.txt
//
// File: jenkins-views.groovy
// Author : Denny <https://www.dennyzhang.com/contact>
// Link: https://cheatsheet.dennyzhang.com/cheatsheet-jenkins-groovy-a4
// --
// Created : <2018-04-20>
// Updated: Time-stamp: <2019-02-16 22:03:51>
//-------------------------------------------------------------------
// imports
import jenkins.model.Jenkins
import hudson.model.ListView
Expand Down
14 changes: 13 additions & 1 deletion jenkinsfile-finally.groovy
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
//-------------------------------------------------------------------
// @copyright 2018 DennyZhang.com
// Licensed under MIT
// https://www.dennyzhang.com/wp-content/mit_license.txt
//
// File: jenkinsfile-finally.groovy
// Author : Denny <https://www.dennyzhang.com/contact>
// Link: https://cheatsheet.dennyzhang.com/cheatsheet-jenkins-groovy-a4
// --
// Created : <2018-04-20>
// Updated: Time-stamp: <2019-02-16 22:05:07>
//-------------------------------------------------------------------
node {
try {
def seconds = readFile("/tmp/test.txt")
Expand All @@ -17,4 +29,4 @@ node {
finally {
echo "finally"
}
}
}
12 changes: 12 additions & 0 deletions jenkinsfile-parallelly.groovy
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
//-------------------------------------------------------------------
// @copyright 2018 DennyZhang.com
// Licensed under MIT
// https://www.dennyzhang.com/wp-content/mit_license.txt
//
// File: jenkinsfile-parallelly.groovy
// Author : Denny <https://www.dennyzhang.com/contact>
// Link: https://cheatsheet.dennyzhang.com/cheatsheet-jenkins-groovy-a4
// --
// Created : <2018-04-20>
// Updated: Time-stamp: <2019-02-16 22:04:26>
//-------------------------------------------------------------------
stage('stage1') {
echo 'Hello World'
}
Expand Down
12 changes: 12 additions & 0 deletions jenkinsfile-pass-parameter.groovy
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
//-------------------------------------------------------------------
// @copyright 2018 DennyZhang.com
// Licensed under MIT
// https://www.dennyzhang.com/wp-content/mit_license.txt
//
// File: jenkinsfile-pass-parameter.groovy
// Author : Denny <https://www.dennyzhang.com/contact>
// Link: https://cheatsheet.dennyzhang.com/cheatsheet-jenkins-groovy-a4
// --
// Created : <2018-04-20>
// Updated: Time-stamp: <2019-02-16 22:05:21>
//-------------------------------------------------------------------
node {
def seconds = readFile("/tmp/test.txt")

Expand Down
12 changes: 0 additions & 12 deletions jenkinsfile-sequentially

This file was deleted.

14 changes: 13 additions & 1 deletion jenkinsfile-sequentially.groovy
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
//-------------------------------------------------------------------
// @copyright 2018 DennyZhang.com
// Licensed under MIT
// https://www.dennyzhang.com/wp-content/mit_license.txt
//
// File: jenkinsfile-sequentially.groovy
// Author : Denny <https://www.dennyzhang.com/contact>
// Link: https://cheatsheet.dennyzhang.com/cheatsheet-jenkins-groovy-a4
// --
// Created : <2018-04-20>
// Updated: Time-stamp: <2019-02-16 22:04:36>
//-------------------------------------------------------------------
stage('stage1') {
echo 'Hello World'
}
Expand All @@ -9,4 +21,4 @@ stage('stage2') {

stage('stage3') {
build job: 'dennyjob2', parameters: [string(name: 'env1', value: 'value3')]
}
}
15 changes: 13 additions & 2 deletions jenkinsfile-timeout-retry.groovy
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
//-------------------------------------------------------------------
// @copyright 2018 DennyZhang.com
// Licensed under MIT
// https://www.dennyzhang.com/wp-content/mit_license.txt
//
// File: jenkinsfile-timeout-retry.groovy
// Author : Denny <https://www.dennyzhang.com/contact>
// Link: https://cheatsheet.dennyzhang.com/cheatsheet-jenkins-groovy-a4
// https://jenkins.io/doc/pipeline/tour/running-multiple-steps/

// --
// Created : <2018-04-20>
// Updated: Time-stamp: <2019-02-16 22:05:16>
//-------------------------------------------------------------------
Jenkinsfile (Declarative Pipeline)
pipeline {
agent any
Expand All @@ -16,4 +27,4 @@ pipeline {
}
}
}
}
}
4 changes: 2 additions & 2 deletions keep-going-with-errors.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
// Author : Denny <https://www.dennyzhang.com/contact>
// Description :
// https://stackoverflow.com/questions/36852310/show-a-jenkins-pipeline-stage-as-failed-without-failing-the-whole-job
// Link: https://cheatsheet.dennyzhang.com/cheatsheet-jenkins-groovy-a4
// --
// Created : <2018-04-20>
// Updated: Time-stamp: <2019-02-16 21:47:16>
// Updated: Time-stamp: <2019-02-16 22:04:13>
//-------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
// Stages with shell commands
def tc_list = testsuites.tokenize(',')
tc_list.each {
Expand Down
12 changes: 12 additions & 0 deletions loop-map.groovy
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
//-------------------------------------------------------------------
// @copyright 2018 DennyZhang.com
// Licensed under MIT
// https://www.dennyzhang.com/wp-content/mit_license.txt
//
// File: loop-map.groovy
// Author : Denny <https://www.dennyzhang.com/contact>
// Link: https://cheatsheet.dennyzhang.com/cheatsheet-jenkins-groovy-a4
// --
// Created : <2018-04-20>
// Updated: Time-stamp: <2019-02-16 22:04:45>
//-------------------------------------------------------------------
def sampleMap = ['Key#1':'Value#1', 'Key#2':'Value#2']
println sampleMap['Key#1']
node{
Expand Down
12 changes: 12 additions & 0 deletions multi-line-string.groovy
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
//-------------------------------------------------------------------
// @copyright 2018 DennyZhang.com
// Licensed under MIT
// https://www.dennyzhang.com/wp-content/mit_license.txt
//
// File: multi-line-string.groovy
// Author : Denny <https://www.dennyzhang.com/contact>
// Link: https://cheatsheet.dennyzhang.com/cheatsheet-jenkins-groovy-a4
// --
// Created : <2018-04-20>
// Updated: Time-stamp: <2019-02-16 22:04:50>
//-------------------------------------------------------------------
// http://grails.asia/groovy-multiline-string
def a = """test
test
Expand Down
14 changes: 13 additions & 1 deletion print.groovy
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
//-------------------------------------------------------------------
// @copyright 2018 DennyZhang.com
// Licensed under MIT
// https://www.dennyzhang.com/wp-content/mit_license.txt
//
// File: print.groovy
// Author : Denny <https://www.dennyzhang.com/contact>
// Link: https://cheatsheet.dennyzhang.com/cheatsheet-jenkins-groovy-a4
// --
// Created : <2018-04-20>
// Updated: Time-stamp: <2019-02-16 22:05:02>
//-------------------------------------------------------------------
String message = 'Hello from Groovy'
println message
println message
3 changes: 2 additions & 1 deletion slack-notification.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
// https://stackoverflow.com/questions/39140191/how-to-send-slack-notification-after-jenkins-pipeline-build-failed
// https://jenkins.io/doc/pipeline/steps/slack/
// https://jenkins.io/blog/2016/07/18/pipeline-notifications/
// Link: https://cheatsheet.dennyzhang.com/cheatsheet-jenkins-groovy-a4
// --
// Created : <2018-04-20>
// Updated: Time-stamp: <2019-02-16 21:47:20>
// Updated: Time-stamp: <2019-02-16 22:01:54>
//-------------------------------------------------------------------
node(agent_label) {

Expand Down
12 changes: 12 additions & 0 deletions split-string.groovy
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
//-------------------------------------------------------------------
// @copyright 2018 DennyZhang.com
// Licensed under MIT
// https://www.dennyzhang.com/wp-content/mit_license.txt
//
// File: split-string.groovy
// Author : Denny <https://www.dennyzhang.com/contact>
// Link: https://cheatsheet.dennyzhang.com/cheatsheet-jenkins-groovy-a4
// --
// Created : <2018-04-20>
// Updated: Time-stamp: <2019-02-16 22:04:19>
//-------------------------------------------------------------------
String ip_hostname_list = """ 138.197.192.172 myenv-do-jenkins
138.68.254.56 myenv-do-lb-1
138.68.254.215 myenv-do-lb-2
Expand Down
13 changes: 13 additions & 0 deletions timezone.groovy
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
#!groovy
//-------------------------------------------------------------------
// @copyright 2018 DennyZhang.com
// Licensed under MIT
// https://www.dennyzhang.com/wp-content/mit_license.txt
//
// File: timezone.groovy
// Author : Denny <https://www.dennyzhang.com/contact>
// Link: https://cheatsheet.dennyzhang.com/cheatsheet-jenkins-groovy-a4
// --
// Created : <2018-04-20>
// Updated: Time-stamp: <2019-02-16 22:04:03>
//-------------------------------------------------------------------
// Configure Jenkins java options
// timezone: Asia/Shanghai, America/New_York, America/Los_Angeles
// https://www.epochconverter.com/timezones
Expand Down

0 comments on commit 188c588

Please sign in to comment.