12. Gitlab -Jenkins 연동

2020. 3. 9. 11:34Git

[Jenkins관리] - [Plugin관리] - gitlab 추가

재부팅하고 root 계정으로 로그인

 

Gitlab 연동을 위해서 Gitlab로그인 - User Setting - Access Tokens

Name과 만기일 입력 (1년으로 함)

Scope는 다 선택하고  ' Create personal access token' 

그러면 상단에 토큰이 보이는데 저장해 둬야함. 새로고침하면안보임 

토큰키를 복사해서 Jenkins 접속

Credential - System - Global credentials

후, adding credential?을 누르고 아래와같이 입력

Token 생성

 

 

 

 

 


 

 

 

 

 

 

새작업 - Freestyle project 생성

 

구성에서 설명넣고

 

소스코드관리에서 Git 선택


[오류] Jenkins에 인증서 등록해야됨

https://yjunyoung.tistory.com/entry/13-git-gitlab-%EC%97%B0%EB%8F%99?category=797840

 

13. git-gitlab 연동

# apt-get install git-core // git 설치 # git config --global user.name "yang" # git config --global user.email "jhg080@naver.com" # git clone https://192/168.182.129/root/gitlab-jenkins.git staging..

yjunyoung.tistory.com

참고해서 인증서 이동 및 등록


 

빌드에 Add build step 선택 후, 

특정 Build 명령을 적어준다. 테스트로 Shell echo 명령어 작성

 

빌드후 조치는 Publish build status to Gitlab 선택

고급을 눌러서 Build name도 적어준다

 

 

Jenkins의 빌드유발에 나와있는 URL을 기억한뒤

여기에 URL 나오므로 기억

Gitlab으로 넘어가서 project - settings - integrations에서 아래와 같이 setting


[오류] localhost가안된다고 해서 바꾸자.

 

Gitlab에서 Webhook 관련 허용

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

# vim /etc/hosts 에디터로 내용 수정

yang.test.8081로 들어가짐

 

 

 

 

 

 

 

 

 

 

 

인증서 문제여서 git의 ssl verif

y 설정을 끈다

-> 해결안됐음..

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


젠킨스 관리 -시스템설정

Gitlab의 - gitlab connections 입력

   - connection name은 알아서, URL은 gitlab이 설치된 URL

ssl(https)부분을 skip하기 위해
https://updates.jenkins-ci.org/download/plugins/skip-certificate-check/
해당 플러그인을 다운받아 젠킨스 플러그인 디렉토리에 넣고 

# service jenkins restart

재시작했는데도 그대로 에러..

 

 

'Git' 카테고리의 다른 글

14. Gitlab - Jira 연동  (0) 2020.03.13
13. git-gitlab 연동  (0) 2020.03.09
11. Jenkins 기본설정  (0) 2020.03.09
10. Jenkins 설치  (0) 2020.03.08
8. Gitlab - SSL 적용  (1) 2020.03.05