Monday, April 17, 2017

Tuesday, March 14, 2017

settings.xml mirrors repositories proxy

 <distributionManagement>
  <repository>
   <id>fxg-releases</id>
   <url>https://nexus.x.com:8443/nexus/content/repositories/fxg-releases</url>
  </repository>
  <snapshotRepository>
   <id>fxg-snapshots</id>
   <url>https://nexus.x.com:8443/nexus/content/repositories/fxg-snapshots</url>
  </snapshotRepository>
  <site>
   <id>mvnown</id>
   <url>scpexe://maven.x.com/var/fedex/scm/mvn/httproot/site/${project.artifactId}/${project.artifactId}-${project.version}</url>
  </site>
 </distributionManagement>


SETTINGS XML 


<settings>
 <!-- Switching to c:/temp for the "document and settings" spacing issues some projects have when stepping out of the java realm to perform 
  function by a plugin. -->
 <localRepository>${java.io.tmpdir}/${user.name}/repository</localRepository>
 <interactiveMode>true</interactiveMode>
 <proxies>
  <proxy>
   <active />
   <port>3128</port>
   <host>internet.proxy.fedex.com</host>
   <id>FedEx VPN Proxy</id>
  </proxy>
 </proxies>
 <servers>
  <server>
   <id>releases</id>
   <username>scm</username>
   <password>****</password>
  </server>
  <server>
   <id>snapshots</id>
   <username>dev</username>
   <password>LKLKLJLKJL</password>
  </server>
 </servers>
 <mirrors>
  <mirror>
   <id>proxy</id>
   <name>Maven Proxy</name>
   <url>http://maven.x.com:9999/nexus/content/groups/m2/</url>
   <mirrorOf>external:*,!my-nexus</mirrorOf>
  </mirror>
  <mirror>
   <id>my-nexus</id>
   <name>
    Maven Repository Manager running on 
   </name>
   <url>https://nexus.x.com:8443/nexus/content/groups/m2/</url>
   <mirrorOf>*</mirrorOf>
  </mirror>
 </mirrors>
 <profiles>
  <profile>
   <id>nexus</id>
   <repositories>
    <repository>
     <id>corp-nexus-snapshots</id>
     <url>https://nexus.x.com:8443/nexus/content/repositories/fxg-snapshots</url>
     <releases>
      <enabled>false</enabled>
     </releases>
     <snapshots>
      <enabled>true</enabled>
     </snapshots>
    </repository>
    <repository>
     <id>corp-nexus-releases</id>
     <url>https://nexus.x.com:8443/nexus/content/repositories/fxg-releases</url>
     <releases>
      <enabled>false</enabled>
     </releases>
     <snapshots>
      <enabled>true</enabled>
     </snapshots>
    </repository>
   </repositories>
  </profile>
 </profiles>
 <activeProfiles>
  <activeProfile>nexus</activeProfile>
 </activeProfiles>
</settings>



Monday, March 6, 2017

Jenkins/Cloudbees Available Environment Variables

Name  ↓Value   
_/usr/bin/java
ANDROID_HOME/opt/jenkins/tools/android-sdk-linux
BUILD_CAUSEMANUALTRIGGER
BUILD_CAUSE_MANUALTRIGGERtrue
BUILD_DISPLAY_NAME#39
BUILD_ID39
BUILD_NUMBER39
BUILD_TAGjenkins-EFS-SEFS_COMMON-6270-JOBS-EFS_DASHBOARD_RELEASE_CUT_JOB-39
BUILD_URLhttps://company.com:8443/jenkins/job/ShipmentEFS/job/SEFS_COMMON-6270/job/JOBS/job/SEFS_DASHBOARD_RELEASE_CUT_JOB/39/
DONT_DEPLOYfalse
EXECUTOR_NUMBER3
grunt/opt/jenkins/tools/node-v4.6.0-linux-x64/lib/node_modules/grunt-cli/bin
HOME/opt/jenkins
HUDSON_HOME/opt/jenkins
HUDSON_SERVER_COOKIE4b4586c89a3e8abe
HUDSON_URLhttps://company.com:8443/jenkins/
JAVA_HOME/opt/jenkins/tools/jdk1.7.0_79
JENKINS_HOME/opt/jenkins
JENKINS_SERVER_COOKIE4b4586c89a3e8abe
JENKINS_URLhttps://company.com:8443/jenkins/
JOB_BASE_NAMEEFS_DASHBOARD_RELEASE_CUT_JOB
JOB_NAMEEFS/EFS_COMMON-6270/JOBS/SEFS_DASHBOARD_RELEASE_CUT_JOB
JOB_URLhttps://company.com:8443/jenkins/job/EFS/job/EFS_COMMON-6270/job/JOBS/job/SEFS_DASHBOARD_RELEASE_CUT_JOB/
LOGNAMEjenkins
MAIL/var/mail/jenkins
NLSPATH/usr/dt/lib/nls/msg/%L/%N.cat
NODE_LABELS2144 Android Java7 Java8 Tomcat Tomcat (2144)
NODE_NAMETomcat (2144)
OLDPWD/opt/jenkins
PATH/usr/local/bin:/bin:/usr/bin
PATH+JDK/opt/jenkins/tools/jdk1.7.0_79/bin
PWD/opt/jenkins
RELEASE_TAG1.3.2.6
ROOT_BUILD_CAUSEMANUALTRIGGER
ROOT_BUILD_CAUSE_MANUALTRIGGERtrue
SHELL/bin/bash
SHLVL1
SOURCE_BRANCH1.3.0-SNAPSHOT
SSH_CLIENT10.236.10.51 60556 22
SSH_CONNECTION10.236.10.51 60556 10.236.14.54 22
USERjenkins
XFILESEARCHPATH/usr/dt/app-defaults/%L/Dt

Friday, February 24, 2017

Remove arbitrary columns from text lines with perl and splice

Probably not the shorted ... remove the 9th and 0th column from an ls with perl and splice
find . -type f -ls | sort -k11 | perl -ne '@x=split;splice @x,9,1;splice @x,0,1; print join("\t", @x), "\n";' | tail 

Friday, February 3, 2017

Moving one git repository to another git repository host

You can refer to the GitHub page "Duplicating a repository"
It uses:
That would give:
git clone --mirror https://bitbucket.org/exampleuser/repository-to-mirror.git
# Make a bare mirrored clone of the repository

cd repository-to-mirror.git
git remote set-url --push origin https://github.com/exampleuser/mirrored
# Set the push location to your mirror

git push --mirror

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 button
If 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