| Name ↓ | Value |
|---|---|
| _ | |
| ANDROID_HOME | |
| BUILD_CAUSE | MANUALTRIGGER |
| BUILD_CAUSE_MANUALTRIGGER | true |
| BUILD_DISPLAY_NAME | |
| BUILD_ID | 39 |
| BUILD_NUMBER | 39 |
| BUILD_TAG | jenkins |
| BUILD_URL | https |
| DONT_DEPLOY | false |
| EXECUTOR_NUMBER | 3 |
| grunt | |
| HOME | |
| HUDSON_HOME | |
| HUDSON_SERVER_COOKIE | 4b4586c89a3e8abe |
| HUDSON_URL | https |
| JAVA_HOME | |
| JENKINS_HOME | |
| JENKINS_SERVER_COOKIE | 4b4586c89a3e8abe |
| JENKINS_URL | https |
| JOB_BASE_NAME | EFS |
| JOB_NAME | EFS |
| JOB_URL | https |
| LOGNAME | jenkins |
| NLSPATH | |
| NODE_LABELS | 2144 Android Java7 Java8 Tomcat Tomcat |
| NODE_NAME | Tomcat |
| OLDPWD | |
| PATH | |
| PATH+JDK | |
| PWD | |
| RELEASE_TAG | 1 |
| ROOT_BUILD_CAUSE | MANUALTRIGGER |
| ROOT_BUILD_CAUSE_MANUALTRIGGER | true |
| SHELL | |
| SHLVL | 1 |
| SOURCE_BRANCH | 1 |
| SSH_CLIENT | 10 |
| SSH_CONNECTION | 10 |
| USER | jenkins |
| XFILESEARCHPATH |
Rants and ravings of a semi-autistic developer who has a hard time remembering idiotic nonsense details. Why remember it, when you know where to find it.
Showing posts with label jenkins. Show all posts
Showing posts with label jenkins. Show all posts
Monday, March 6, 2017
Jenkins/Cloudbees Available Environment Variables
Wednesday, February 1, 2017
Jenkins / CloudBees : moving jobs between servers .... how ...
curl -s https://USER:API_TOKEIN@jenkins.prod.com:8443/jenkins/job/SCM_SVN_MODEL/config.xml | curl -X POST 'http://USER:APITOKEN@jenkins-dev.test.com:8080/jenkins/createItem?name=JOBNAME' --header "Content-Type: application/xml" -d @-Get the API token on the target machine (in this case jenkins-dev.test.com)
- Open browser and login on target machine - http://jenkins-dev.test.com:8080/jenkins/user/USER/configure - hit the API TOKEN buttonIf you want to directly copy to a folder do this ...
curl -s https://USER_SRC:APITOKEN_SRC@jenkins.prod.com:8443/jenkins/job/SCM_SVN_MODEL/config.xml | \ curl -X POST 'http://USER_TGT:APITOKEN_TGT@jenkins-dev.test.com:8080/jenkins/job/SANDBOX/createItem?name=JOBNAME' --header "Content-Type: application/xml" -d @-or if you have a list of them ....
declare -a arr=(
"SEFS_ABSTRACT_ACTION_MODEL"
"SEFS_ABSTRACT_BUILD_ENV_MODEL"
"SEFS_ABSTRACT_BUILD_MODEL"
"SEFS_ABSTRACT_SCM_MODEL"
"SEFS_ABSTRACT_TEST_MODEL"
"SEFS_BASE_AUX_MODEL"
"SEFS_BUILDER_TMPL"
"SEFS_JAVA_BUILD_MODEL"
"SEFS_MASTER_BUILD_TMPL"
"SEFS_PROJECT_TMPL"
"SEFS_SCM_GIT_MODEL"
"SEFS_SCM_SVN_MODEL"
"SEFS_SILVER_FABRIC_DEPLOY_TMPLT"
"SEFS_STANDARD_BUILD_ENV_MODEL"
"SEFS_TEST_JUNIT_MODEL"
"SEFS_TIBCO_BUILD_MODEL"
"SEFS_UC_DEPLOY_MODEL")
## now loop through the above array
for i in "${arr[@]}"
do
curl -s https://USERID_SRC:2615adec2asas558a20790eec2994096c3c455b43@jenkins.prod.com:8443/jenkins/job/$i/config.xml | curl -X POST "http://USERID_TGT:efd517beb69f2ca1sfasfd81371885a48a928cf565@jenkins-dev.test.com:8080/jenkins/job/SANDBOX/createItem?name=$i" --header "Content-Type: application/xml" -d @-
# or do whatever with individual element of the array
done
Tuesday, January 31, 2017
Jenkins Pipeline Groovy Snippets.
Moved some of the examples to gist.github.com for organizational purposes.
Show all binding variables:
echo "${this.binding.variables}"
Change spaces in underscores for the workspace
def getWorkspace() {
pwd().replace("%2F", "_")
}
def wipeWorkspace(String workspace) {
if (workspace) {
sh "find ${workspace} -mindepth 4 -depth -delete"
}
}
Show all environment variables.
node {
sh 'env | sort'
}
Getting absolute path to a Job:
SCM_JOB is a template attribute with item -> Pipelines
[Pipeline] echo
[name:ASSEMBLY_DESCRIPTORS_BUILD,SCM_JOB:org.jenkinsci.plugins.workflow.job.WorkflowJob@3d71aee8[ShipmentEFS/COMMON/JOBS/Pipeline_leaf_caan], steps:org.jenkinsci.plugins.workflow.cps.DSL@dfb3e3d]
${SCM_JOB['fullName']} = 'ShipmentEFS/Common/Jobs/Pipeline_leaf_caan'
then we can do
node {
build job: SCM_JOB['fullName']
}
AUXILARY MODELS AND GETTNG THERE CONTENT
// List all auxilary models for logging purpose
echo "${SEFS_CONTEXT}"
echo "${SCM_MODEL}"
echo "class:${BUILD_MODEL.metaClass.toString()}"
echo "methods:${BUILD_MODEL.metaClass.methods}"
echo "fields: ${BUILD_MODEL.metaClass.fields}"
echo "toSTring: ${BUILD_MODEL.toString()}"
echo "testmodel: ${BUILD_MODEL['BUILD_TEST_MODEL']}"
try {
echo "getbinding: ${BUILD_MODEL.getValue('BUILD_TEST_MODEL')}"
} catch (error) {
echo error
}
try {
echo "model: ${BUILD_MODEL.model}"
def m=BUILD_MODEL.model
echo "meta: ${m['BUILD_TEST_MODEL']}"
} catch (error) {
echo error
echo "model: ${m.metaClass.methods}"
}
try {
echo "getmodel: ${BUILD_MODEL.getModel()}"
} catch (error) {
echo error
}
Subscribe to:
Posts (Atom)