100%[=====================================================================================================================================================================================================================================>] 71 --.-K/s in 0s
Total download size: 74 M Installed size: 74 M Is this ok [y/d/N]: y Downloading packages: jenkins-2.182-1.1.noarch.rpm | 74 MB 00:05:37 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : jenkins-2.182-1.1.noarch 1/1 Verifying : jenkins-2.182-1.1.noarch 1/1
Installed: jenkins.noarch 0:2.182-1.1
Complete!
web port & firewall
jenkins의 서비스 port를 설정 하고 열어준다.
[root@localhost devops]# cd /etc/sysconfig/ [root@localhost sysconfig]# vi jenkins
## Type: integer(0:65535) ## Default: 8080 ## ServiceRestart: jenkins # # Port Jenkins is listening on. # Set to -1 to disable # JENKINS_PORT="9090"
Total download size: 9.8 M Installed size: 40 M Is this ok [y/d/N]: y Downloading packages: java-1.8.0-openjdk-devel-1.8.0.212.b04-0.el7_6.x86_64.rpm | 9.8 MB 00:00:01 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : 1:java-1.8.0-openjdk-devel-1.8.0.212.b04-0.el7_6.x86_64 1/1 Verifying : 1:java-1.8.0-openjdk-devel-1.8.0.212.b04-0.el7_6.x86_64 1/1
[root@localhost secrets]# git bash: git: 명령을 찾을 수 없습니다... [root@localhost secrets]# yum install git Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: centos.mirror.moack.net * extras: centos.mirror.moack.net * updates: centos.mirror.moack.net Resolving Dependencies --> Running transaction check ---> Package git.x86_64 0:1.8.3.1-20.el7 will be installed --> Processing Dependency: perl-Git = 1.8.3.1-20.el7 for package: git-1.8.3.1-20.el7.x86_64 --> Processing Dependency: perl(Term::ReadKey) for package: git-1.8.3.1-20.el7.x86_64 --> Processing Dependency: perl(Git) for package: git-1.8.3.1-20.el7.x86_64 --> Processing Dependency: perl(Error) for package: git-1.8.3.1-20.el7.x86_64 --> Running transaction check ---> Package perl-Error.noarch 1:0.17020-2.el7 will be installed ---> Package perl-Git.noarch 0:1.8.3.1-20.el7 will be installed ---> Package perl-TermReadKey.x86_64 0:2.30-20.el7 will be installed --> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================================================================================================================================================== Package Arch Version Repository Size =============================================================================================================================================================================================================================================================================== Installing: git x86_64 1.8.3.1-20.el7 updates 4.4 M Installing for dependencies: perl-Error noarch 1:0.17020-2.el7 base 32 k perl-Git noarch 1.8.3.1-20.el7 updates 55 k perl-TermReadKey x86_64 2.30-20.el7 base 31 k
새로운 아이템 > Enter an item name "아무거나"> pipeline 선택 > ok
"아무거나" 파이프라인 설정 페이지 > pipeline tab 클릭
definition : pipeline script > github + maven > 저장
처음화면으로 이동
아무거나 파이프라인 > name > 아래화살표 > build now
파이프라인 스크립트 기초
node { def mvnHome stage('Preparation') { // for display purposes // Get some code from a GitHub repository git 'https://github.com/jglick/simple-maven-project-with-tests.git' // Get the Maven tool. // ** NOTE: This 'M3' Maven tool must be configured // ** in the global configuration. mvnHome = tool 'M3' } stage('Build') { // Run the maven build withEnv(["MVN_HOME=$mvnHome"]) { if (isUnix()) { sh '"$MVN_HOME/bin/mvn" -Dmaven.test.failure.ignore clean package' } else { bat(/"%MVN_HOME%\bin\mvn" -Dmaven.test.failure.ignore clean package/) } } } stage('Results') { junit '**/target/surefire-reports/TEST-*.xml' archiveArtifacts 'target/*.jar' } }
서술적 파이프 라인
Node 블록 + 스테이지 블록 + 디렉티브 스탭 = 서술적 파이프라인
node 블록 (필수)
node (<parameter>){<constituents>}
노드 블록(젠킨스 에이전트) = 스테이지 블록 + 디렉티브 + 스탭
node {
스테이지 블록 (필수)
stage (<parameter>){<constituents>}
스테이지 블록 = 스텝 + 디렉티브
stage('Preparation') { // for display purposes
} stage('Build') { // Run the maven build
} stage('Results') {
}
디렉티브 (옵션)
def mvnHome
mvnHome = tool 'M3'
환경변수, 옵션, 파라미터, 트리거 등을 표현
github 연결하기
Credentials 설정
Jenkins 대쉬보드(최상위 화면)
Credentials > System > Global credentials > Add Credentials
Kind : Username with password
Scope : Global
Username : github id, name 또는 email
password : github password
ID : id
Description : 아무거나
Credentials 연결
Jenkins 대쉬보드(최상위 화면)
Jenkins관리 > 시스템설정
GitHub 영역으로 이동
Name : 아무거나
API URL : https://api.github.com
Manage hooks : 선택
2번째 고급 클릭
Additional actions : Convert login and password to token 선택
From credentionas > Credentilas > 상위 만든 Credentials 선택
Create token credentials 클릭
정상적으로 토큰이 생성 되었다면 "저장" 후 종료
github 사이트 > 우상단 내 아이콘 클릭 > Setting 클릭
Developer setting 클릭
Personal access tokens 선택
github 사이트에 기 등록된 token이 양쪽다 등록 되었다면 정상 처리 완료 된 것임
# Modify these options if you want to change the way the docker daemon runs OPTIONS='--selinux-enabled --log-driver=journald --signature-verification=false' if [ -z "${DOCKER_CERT_PATH}" ]; then DOCKER_CERT_PATH=/etc/docker fi
# Do not add registries in this file anymore. Use /etc/containers/registries.conf # instead. For more information reference the registries.conf(5) man page.
# Location used for temporary files, such as those created by # docker load and build operations. Default is /var/lib/docker/tmp # Can be overriden by setting the following environment variable. # DOCKER_TMPDIR=/var/tmp
# Controls the /etc/cron.daily/docker-logrotate cron job status. # To disable, uncomment the line below. # LOGROTATE=false
# docker-latest daemon can be used by starting the docker-latest unitfile. # To use docker-latest client, uncomment below lines #DOCKERBINARY=/usr/bin/docker-latest #DOCKERDBINARY=/usr/bin/dockerd-latest #DOCKER_CONTAINERD_BINARY=/usr/bin/docker-containerd-latest #DOCKER_CONTAINERD_SHIM_BINARY=/usr/bin/docker-containerd-shim-latest
저는 상위 파일 수정으로 성공 하였습니다. 주의 해야하는 것은 tcp 이후 0.0.0.0 이 아니 127.0.0.1로 쓰게 되면 local 접근만 되고 대외 접근은 불가 합니다.
서비스 재 실행 및 TEST
demon 재실행 : systemctl daemon-reload
서비스 재실행 : service docker restart
Test : curl -X GET http://localhost:4243/images/json
[root@localhost system]# systemctl daemon-reload [root@localhost system]# service docker restart Redirecting to /bin/systemctl restart docker.service [root@localhost system]# curl -X GET http://localhost:4243/images/json [{"Containers":-1,"Created":1561408399,"Id":"sha256:36b0df681a47e5948f2088a446652766132141175dece2d6d47ef6e749385c05","Labels":{"com.sonatype.license":"Apache License, Version 2.0","com.sonatype.name":"Nexus Repository Manager base image","org.label-schema.build-date":"20190305","org.label-schema.license":"GPLv2","org.label-schema.name":"CentOS Base Image","org.label-schema.schema-version":"1.0","org.label-schema.vendor":"CentOS","vendor":"Sonatype"},"ParentId":"","RepoDigests":["docker.io/sonatype/nexus3@sha256:970b09779992bf88d041d074428c54dc153f7b9c8cafe4ff364dd26d69200f7a"],"RepoTags":["docker.io/sonatype/nexus3:latest"],"SharedSize":-1,"Size":581556647,"VirtualSize":581556647},{"Containers":-1,"Created":1546306167,"Id":"sha256:fce289e99eb9bca977dae136fbe2a82b6b7d4c372474c9235adc1741675f587e","Labels":null,"ParentId":"","RepoDigests":["docker.io/hello-world@sha256:41a65640635299bab090f783209c1e3a3f11934cf7756b09cb2f1e02147c6ed8"],"RepoTags":["docker.io/hello-world:latest"],"SharedSize":-1,"Size":1840,"VirtualSize":1840}]