首页 技术 正文
技术 2022年11月10日
0 收藏 471 点赞 4,801 浏览 3418 个字

================================================================================
continous integration environment (Jenkins and bitbucket configuration)
================================================================================

+++++++++++ install plugin on the jenkins website +++++++++++++

– jenkins plugin need to install:
ssh plugin, git plugin and bitbucket plugin

– add the public key [ jenkins server ] into bitbucket or github
you need to know which user run the jenkins service
cat ~/.ssh/id_rsa.pub

+++++++++++++++++++ configure bitbucket webhook ++++++++++++++++++++

#1. Click your project’s repository
#2. Click [setting] – [webhook]
#3. Click [Add webhook]

Title: CI Notification
URL: http://jenkins_server_ip:8080/bitbutket-hook/
status: Active
SSL / TLS [unchecked]
Triggers: choose [Repository push]

+++++++++++++++++++++++ helloworld_build_app +++++++++++++++++++++++

#1. Click “New Item” at the top right.

#2. Enter an item name. [helloworld_build_app]

#3. Select Freestyle project option.

#4. Click “OK” button.

#5. Typing your_display_name [helloworld_build_app] on the field of Display Name after you click the Advanced button.

#6. Source Code Management

1) choose git
2)Repository URL: https://XXXX@bitbucket.org/XXXXXX/helloworld.git
3)Credentials: add into your credentails

#7. Build Triggers
Build when a change is pushed to BitBucket [select this option only you install bitbucket plugin]

#8. Build
===================================
Add Build Step => Execute Shell
===================================

#!/bin/bash –login

#exec 1> /tmp/jenkins_helloworld_build_app.log

echo “=============== START TO BUILD ==================”

export RAILS_ENV=test

#export $BUILD_NUMBER
echo “==============================================================”
whoami
echo $BUILD_NUMBER
echo “==============================================================”

source ~/.bashrc # Loads RVM

[[ -s “$HOME/.rvm/scripts/rvm” ]] && source “$HOME/.rvm/scripts/rvm”

cd . # Loads the RVM environment set in the .rvmrc file

rvm current # will display current rvm (debugging purpoyse)

rvm -v
rvm list
rvm gemset list

rvm use 2.3.1@helloworld

rvm gemset list

RAILS_ENV=test bundle install –without development

RAILS_ENV=test bundle exec rails db:drop db:create db:migrate

RAILS_ENV=test bundle exec rails test

echo “=============== END TO BUILD ==================”

================================================================================

+++++++++++++++++++++++ helloworld_deploy_app ++++++++++++++++++++++

#1. Click “New Item” at the top right.

#2. Enter an item name. [helloworld_deploy_app]

#3. Select Freestyle project option.

#4. Click “OK” button.

#5. Typing your_display_name [helloworld_deploy_app] on the field of Display Name after you click the Advanced button.

#6. Source Code Management

1) choose git
2)Repository URL: https://XXXXX@bitbucket.org/XXXXX/helloworld.git
3)Credentials: add into your credentails

#7. Build Triggers
1) Select Build after other projects are built

2) Projects to watch [helloworld_build_app]

3) Trigger only if build is stable

#8. Build
=================
Execute Shell
=================

#!/bin/bash –login

echo “===================== START TO DEPLOY =======================”

source ~/.bashrc # Loads RVM

[[ -s “$HOME/.rvm/scripts/rvm” ]] && source “$HOME/.rvm/scripts/rvm”

cd . # Loads the RVM environment set in the .rvmrc file

rvm current # will display current rvm (debugging purpoyse)

rvm -v
rvm list
rvm gemset list
rvm use 2.3.1@helloworld
rvm gemset list

bundle exec cap staging puma:kill_puma
bundle exec cap staging deploy

echo “====================== END TO DEPLOY =======================”

cd /var/lib/jenkins/workspace/your_project_name

whomai => jenkins

try to deploy your project via [ bundle exec cap staging deploy ]

================================================================================

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,487
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,903
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,736
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,487
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,127
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,289