Skip to content

Instantly share code, notes, and snippets.

@chellakarthik24
chellakarthik24 / Jenkinsfile
Created June 7, 2023 21:01 — forked from alces/Jenkinsfile
Ask for password in Jenkins pipeline
pipeline {
agent {
label 'Linux'
}
stages {
stage('ask') {
steps {
script {
def askpass = input(
message: 'Please enter the password',
@chellakarthik24
chellakarthik24 / Jenkinsfile
Created December 9, 2022 20:16 — forked from merikan/Jenkinsfile
Some Jenkinsfile examples
Some Jenkinsfile examples
$files = Get-ChildItem "app*.config" -Recurse
$find = 'some-string-to-find'
$replace = 'some-string-to-replace-with'
Get-ChildItem $files -Recurse |
select -ExpandProperty fullname |
foreach {
If(Select-String -Path $_ -SimpleMatch $find -quiet){
@chellakarthik24
chellakarthik24 / useful-jboss-cli-cmds.md
Created May 27, 2020 02:30 — forked from rafaeltuelho/useful-jboss-cli-cmds.md
Useful JBoss EAP CLI commands and configuration...
  • To restart a specif Managed Server in a Domain
./jboss-cli.sh --connect --controller=10.25.236.195:9999 --user <admin user> --password <admin pwd>

/host=136-slave/server-config=srv-163:start(blocking=true)
/host=136-slave/server-config=srv-163:stop(blocking=true)

./jboss-cli.sh --connect --controller=10.25.236.195:9999 --command='/host=136-slave/server-config=srv-163:stop(blocking=true)'
{
@chellakarthik24
chellakarthik24 / cleanupUnusedWorkspaceInSlaves.groovy
Created October 17, 2018 13:54 — forked from ceilfors/cleanupUnusedWorkspaceInSlaves.groovy
When you delete jobs in Jenkins, the corresponding workspaces in the build slaves won't be deleted automatically. This Jenkins script will go to each slave and check if the jobs are already deleted in Jenkins master and delete the workspace.
import com.cloudbees.hudson.plugins.folder.Folder
import hudson.FilePath
import jenkins.model.Jenkins
def boolean isFolder(String name) {
def item = Jenkins.instance.getItemByFullName(name)
return item instanceof Folder
}
def deleteUnusedWorkspace(FilePath root, String path) {
@chellakarthik24
chellakarthik24 / check-slave-jar-version.groovy
Last active August 14, 2019 20:57 — forked from ctran/check-slave-jar-version.groovy
Check slave.jar versions of slaves against expected version on Jenkins master
import jenkins.model.*
import hudson.remoting.Launcher
import hudson.slaves.SlaveComputer
def expectedVersion = Launcher.VERSION
println ">> Expected Slave remoting verison- ${expectedVersion}"
for (computer in Jenkins.instance.getComputers()) {
if (!(computer instanceof SlaveComputer)) continue
if (!computer.getChannel()) continue
@chellakarthik24
chellakarthik24 / cleanupJenkinsWorkspaces.groovy
Created August 6, 2018 20:13 — forked from EvilBeaver/cleanupJenkinsWorkspaces.groovy
A jenkins script to clean up workspaces on slaves
// Check if a slave has < 10 GB of free space, wipe out workspaces if it does
import hudson.model.*;
import hudson.util.*;
import jenkins.model.*;
import hudson.FilePath.FileCallable;
import hudson.slaves.OfflineCause;
import hudson.node_monitors.*;
@chellakarthik24
chellakarthik24 / README.md
Created August 6, 2018 18:55 — forked from dnozay/_Jenkins+Script+Console.md
jenkins groovy scripts collection.