Skip to content

Instantly share code, notes, and snippets.

View rameshz23's full-sized avatar

ram rameshz23

View GitHub Profile
@rameshz23
rameshz23 / Jenkinsfile
Created November 28, 2017 14:39 — forked from abayer/Jenkinsfile
An example Declarative Pipeline Jenkinsfile for Feb 15 2017 demo
// A Declarative Pipeline is defined within a 'pipeline' block.
pipeline {
// agent defines where the pipeline will run.
agent {
// This also could have been 'agent any' - that has the same meaning.
label ""
// Other possible built-in agent types are 'agent none', for not running the
// top-level on any agent (which results in you needing to specify agents on
// each stage and do explicit checkouts of scm in those stages), 'docker',
@rameshz23
rameshz23 / jenkins_delete_user_credentials.groovy
Created April 18, 2018 07:42 — forked from grawert/jenkins_delete_user_credentials.groovy
Delete user credentials by username in Jenkins
import com.cloudbees.plugins.credentials.*
import com.cloudbees.plugins.credentials.common.*
import com.cloudbees.plugins.credentials.domains.*
def credentials_for_username(String username) {
def username_matcher = CredentialsMatchers.withUsername(username)
def available_credentials =
CredentialsProvider.lookupCredentials(
StandardUsernameCredentials.class,
Jenkins.getInstance(),
@rameshz23
rameshz23 / job.groovy
Created April 18, 2018 07:43 — forked from aespinosa/job.groovy
create a jenkins job in the script console
import jenkins.model.Jenkins;
import hudson.model.FreeStyleProject;
import hudson.tasks.Shell;
job = Jenkins.instance.createProject(FreeStyleProject, 'job-name')
job.buildersList.add(new Shell('echo hello world'))
job.save()
@rameshz23
rameshz23 / README.md
Created April 18, 2018 07:44 — forked from dnozay/_Jenkins+Script+Console.md
jenkins groovy scripts collection.
@rameshz23
rameshz23 / groovy.groovy
Created June 14, 2018 04:31 — forked from adampats/groovy.groovy
Jenkins groovy script to execute shell command
def cmd = 'hostname'
def sout = new StringBuffer(), serr = new StringBuffer()
def proc = cmd.execute()
proc.consumeProcessOutput(sout, serr)
proc.waitForOrKill(1000)
println sout
rem
rem Please download curl from https://curl.haxx.se/download.html and add it to your path.
rem
@echo on
rem if command fails, exit and do not ping
if %errorlevel% neq 0 goto ERROR
set URL_STRING=http://pshmn.com/eaFnY
curl %URL_STRING%
@rameshz23
rameshz23 / powerssh.ps1
Created July 26, 2018 12:55 — forked from sveinn-steinarsson/powerssh.ps1
Use Powershell to connect to a remote server via SSH and run a shell script/command
# Script Name: powerssh
# Version: 1.1.0 (9. July, 2014)
# Author: Sveinn Steinarsson
# Description: Use Powershell to connect to a remote server via SSH and run a shell script/command
# Prerequisite:
# plink.exe in script path (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html)
# Examples:
# With key file (*.ppk) and script file
@rameshz23
rameshz23 / list-git-branches.groovy
Created April 1, 2020 12:04 — forked from vStone/list-git-branches.groovy
Jenkins groovy script which lists remote branches.
/*** BEGIN META {
"name": "List GIT Branches",
"comment": "You can use this to fill up a dynamic list parameter with branches. Optionally, you can filter the branches to show.",
"parameters": [ 'FILTER', 'REMOTE' ],
"core": "1.580",
"authors": [
{ name : "Jan Vansteenkiste" }
]
} END META**/
@rameshz23
rameshz23 / co
Created September 16, 2020 08:55 — forked from rkulla/co
Bash script for easier SVN checkouts
#!/bin/bash
# Author Ryan Kulla (rkulla@gmail.com)
#
# A shell script (in Bash) that allows you to do SVN checkouts
# with a shorter command than the default subversion command.
# Handy if your repos have long, hard to remember URLs.
#
# Put this script in your PATH (e.g., ~/bin/)
# Make sure it's executable:
# $ chmod u+x ~/bin/co