Skip to content

Instantly share code, notes, and snippets.

@duncan60
Last active March 5, 2019 13:59
Show Gist options
  • Save duncan60/97baeebf569b202b31711603d92d3c85 to your computer and use it in GitHub Desktop.
Save duncan60/97baeebf569b202b31711603d92d3c85 to your computer and use it in GitHub Desktop.
# 1
docker pull jenkins
# 2
sudo mkdir /opt/jenkins
sudo chown -R 1000 /opt/jenkins
# http://www.cnblogs.com/jackluo/p/5783116.html
# 3
sudo docker run -d --name jenkinsCI -p 8080:8080 -p 50000:50000 -v /opt/jenkins:/var/jenkins_home:Z --restart=always jenkins/jenkins:lts
link browser URL to jenkins server
# 4
sudo docker logs containerID
# find AdminPassword
# jenkins link to deploy vm:
1). install jenkins plugin:
* Bitbucket Plugin
* SSH Plugin
* Copy Artifact Plugin
* Parameterized Trigger Plugin
不確定需不需要,可在測試:
* SSH Agent Plugin
* SSH Slaves plugin
* Publish Over SSH
2). install GCloud SDK curl https://sdk.cloud.google.com | bash
3) 進到 jenkins container 中操作
4). 創建 ssh key, update ssh key to gcp 中繼資料站
5). 透過介面創建 jenkins ssh Credentials , Private Key 使用 Enter directly
6). 建立部署vm的節點(部署 vm 需要先設定一個資料sudo mkdir /opt/jenkins, 並將權限調低 sudo chmod 777 /opt/jenkins/, 安裝壓縮工具 apt-get update, apt-get install zip unzip)
7). install java: http://sourcedigit.com/22256-how-to-install-oracle-java-on-ubuntu-17-04/
8). 完成以上步驟可以建立node 節點
8). 使用 pipeline job 設定及free-style job,git push 觸發 free-style job,在觸發 pipeline job
#https://jenkins.io/doc/pipeline/steps/workflow-basic-steps/#stash-stash-some-files-to-be-used-later-in-the-build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment