一 本地git 服務安裝配置
1. 在192.168.8.108 centos 7.3.1611 安裝git 軟件
yum -y install git useradd git echo ‘qweasd’ | passwd –stdin git mkdir /git/reps -p && cd /git/reps git init --bare jenkins_pipeline.git chown -R git.git jenkins_pipeline.git usermod -s /usr/bin/git-shell git
2. 客戶端192.168.8.106 機器進行clone 測試
git clone [email protected]:/git/reps/jenkins_pipeline.git # 可以新建一個文件進行測試 cd Jenkins_pipeline.git && echo ‘test file’ > aa.log git add . git commit -m ‘註釋說明’ git push -u origin master # 一定要加上 -u origin master
二. 配置pycharm 編輯器進行編輯
首先右鍵file => 選擇setting => 找到version control => git
點擊file => CloseProject 關閉這個項目,接着配置新項目
Clone 完代碼就能進行編寫 pipeline Jenkinsfile了。
三. Jenkins 配置pipeline 代碼
1. 在jenkins 中配置 git 認證
2. 配置jenkins pipeline 項目進行配置
這樣就可以在pycharm 中編寫pipeline 文件了。