Archive for the ‘continuous_delivery’ Category

register jenkins service on mac os

2018/12/26

reference : https://medium.com/@fahimhossain_16989/adding-startup-scripts-to-launch-daemon-on-mac-os-x-sierra-10-12-6-7e0318c74de1

to /Library/LaunchDaemons/com.jenkins02.startup.plist ( root )

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>EnvironmentVariables</key>
    <dict>
      <key>PATH</key>
      <string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:</string>
    </dict>
    <key>Label</key>             <string>com.jenkins02.startup</string>
    <key>Disabled</key>          <false/>
    <key>RunAtLoad</key>         <true/>
    <key>KeepAlive</key>         <true/>
    <key>LaunchOnlyOnce</key>    <true/>
    <key>SessionCreate</key>     <true/>
    <key>ThrottleInterval</key>  <integer>180</integer>
    <key>StandardOutPath</key>
    <string>/Volumes/Data/APP/jenkins/jenkins-slave-02/startup.stdout</string>
    <key>StandardErrorPath</key>
    <string>/Volumes/Data/APP/jenkins/jenkins-slave-02/startup.stderr</string>
    <key>UserName</key>
    <string>admin</string>
    <key>GroupName</key>
    <string>staff</string>
    <key>ProgramArguments</key>
    <array>
        <string>/Volumes/Data/APP/jenkins/jenkins-slave-02/start-jenkins-slave-service.sh</string>
    </array>
</dict>
</plist>

load> sudo launchctl load -w /Library/LaunchDaemons/com.jenkins02.startup.plist

unload> sudo launchctl unload -w /Library/LaunchDaemons/com.jenkins02.startup.plist

log> StandardOutPath  , StandardErrorPath

cf) no background process

광고

config file provider plugin in jenkins

2018/11/28

https://plugins.jenkins.io/config-file-provider

  • Maven 은 3개의 settings.xml 이 존재
    • conf/settings.xml (Global)
    • .m2/settings.xml (User)
    • .m2/repository/settings.xml (Local)
  • 3개 settings.xml을 모두 사용하며, 3개가 merge된다. merge시 Local > User > Global 우선순위
  • Plugins는 Global Maven settings.xml을 설정시, (Global세팅)파일을 대체
  • Plugins는 Maven settings.xml을 설정시, (User세팅)파일을 대체
  • 프로젝트 별로 Global Maven settings.xml 설정시 서버의 .m2/settings.xml 과 id 가 충돌할 경우, 서버가 우선순위가 있기 때문에 Global Maven settings.xml 설정이 안먹음
  • Config Files > Add a new Config > Type에 Maven settings.xml,  Global Maven settings.xml  then Submit
    1. Global Maven Settings.xml: A global maven settings.xml which can be referenced within Apache Maven jobs. (ex) conf/settings.xml)
    2. Maven Settings.xml:  A settings.xml which can be referenced within Apache Maven jobs. ( .m2/settings.xml )
  • credential 사용시에는 username/password 방식의 credential을 등록.
  • 적용 Freestyle): Build Tab > Add build step > Invoke top-level Maven targets > 고급… > Global settings files > provided Global settings.xml >  Provided Settings
  • 적용 Maven project) : Build Tab > 고급… > Global settings files > provided Global settings.xml > Provided Settings

ansible plugin setting in jenkins

2018/11/28

prerequisites : install ansible  to slave ( default /usr/bin/ansible )

1) playbook 을 github 형상 내에 추가 ( ex. echo.yaml )

2) jenkins의 Source Code Management > git 에서 github 정보를 추가

3) jenkins의 build > invoke ansible playbook 선택 후 playbook 파일 경로 입력 ( 형상 checkout 받은 위치를 현재 위치로 보면 됩니다. )

inventory 항목에서 직접 입력 하거나 또는 형상 내 inventory file을 추가하여 지정하는 방식을 사용할 수 있음

 

참고자료 : https://wiki.jenkins.io/display/JENKINS/Ansible+Plugin

about jenkins’s ProcessTreeKiller

2018/11/13

link : https://wiki.jenkins.io/display/JENKINS/ProcessTreeKiller

you can disable this feature by setting a java property to the value “true”

e.g. java -Dhudson.util.ProcessTreeDisable=true -jar jenkins.jar ( or slave JVM)

  • how it works
    Killer는 프로세스 스폰/생성시의 환경변수 복사본을 가지고 있다가  job 종료시에 프로세스 목록을 뒤져서 동일한 환경변수를 가지고 있는 프로세스를 종료시키는 역할을 함.
  • if your build wants to leave a daemon running behind
    BUILD_ID 값을 바꾸면, jenkins는 빌드에서 스폰된 프로세스로 생각하지 않는다.
    e.g. BUILD_ID=dontkillmeJenkins /usr/apache/bin/httpd
    cf) pipeline의 경우에는 BUILD_ID 대신 JENKINS_NODE_COOKIE 값을 사용해야함

 

jenkins – change user id to include dot(.) char

2018/05/24

add init.groovy.d/init.groovy

// SECURITY-786 change user id to include dot(.) char // default : /^[\w-]+$
hudson.security.HudsonPrivateSecurityRealm.ID_REGEX=/^[\w-\.]+$/

notice : hudson.model.HudsonPrivateSecurityRealm.ID_REGEX (X)

 

jenkins NullPointerException MultiSCM

2018/05/15
  • error log

Reason: java.lang.NullPointerException: Descriptor list is null for context ‘class com.cloudbees.hudson.plugins.folder.Folder’
in thread ‘Handling GET /job/XXX/configure from XXX.XX.X.X :
RequestHandlerThread[#8] AbstractFolder/configure.jelly FolderLibraries/DescriptorImpl/config.jelly LibraryConfiguration/config.jelly
SCMRetriever/DescriptorImpl/config.jelly MultiSCM/DescriptorImpl/config.jelly’
jenkins_1 | java.lang.NullPointerException: Descriptor list is null for context

  • cause
    • multiple-scm.jpi it is derecated plugin.
  • solution
    • remove multiple-scm.jpi then, restart jenkins

jenkins node secret 정보 확인하기

2018/04/09

jenkins에서 신규 slave node를 만든 뒤 slave에서 추가해야 하는 secret 값을 jenkins master에서 확인하기 위한 방법

script console에서 실행..

  1. 모든 Node의 secret 정보 조회
for (aSlave in hudson.model.Hudson.instance.slaves)
{
println aSlave.name + "," + aSlave.getComputer().getJnlpMac()
}

2. 특정 Node 의 secret 정보 조회


def nodeName = "qa-test-slave"
hudson.model.Hudson.instance.slaves.find(){ it.name == nodeName }.computer.jnlpMac

jenkins install with centOS virtualbox

2015/11/23

/// Virtual Box 에서 생성한 Linux Cent OS 에 Jenkins install 하기 …

  1. virtualbox 생성

CentOS 7.1

2. jenkins install
// http://starkapin.tistory.com/529

yum install wget
wget -O /etc/yum.repos.d/jekins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
sudo rpm -import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
yum install jenkins // install

3. jenkins setting , execute
service jenkins start/stop/restart  // 실행, 종료, 재시작
chkconfig jenkins on // 부팅시 자동실행

config : /etc/sysconfig/jenkins
home : /var/lib/jenkins ( from config)
logs : /var/log/jenkins

4. port open
// 8080 추가
iptables -A INPUT -p tcp –dport 8080 -j ACCEPT
// iptable flush
iptables -F

5. virtual box port mapping
VirtualBox Manager 실행
target os > 설정 > Network > Port Forwarding
name TCP 127.0.0.1 hostport (8084) , guestport 8080

6. 접속
http://localhost:8084/