continous integration environment (Jenkins and bitbucket configuration)
================================================================================
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 ]
================================================================================
continous integration environment (Jenkins and bitbucket configuration)的更多相关文章
- Salesforce学习之路-developer篇(二)利用Jenkins和Bitbucket实现Salesforce的CI/CD功能
上文提到,基于CRM的二次开发是必不可少的,但是在实际项目中CI/CD是不可忽略的一个重要部分,与传统的Java,Python项目不同,如果对Salesforce进行持续集成和持续部署呢? 结合找到的 ...
- Jenkins与.NET项目
转自: https://blog.dangl.me/categories Continuous Integration RSS Date Post 2016-10-20 Set Up Private ...
- Continuous Integration with Selenium
I have seen a lot of queries from people who basically want to know how to blend Selenium, Maven, an ...
- Jenkins 部署
1 修改jenkins的根目录,默认地在C:\Documents and Settings\AAA\.jenkins . .jenkins ├─jobs│ └─JavaHelloWorld│ ...
- 《Continuous Integration》读书笔记
Trigger a Build whenever a change occurs. it can help us reduce assumptions on a projecvt by rebuild ...
- Jenkins iOS – Git, xcodebuild, TestFlight
Introduction with Jenkins iOS If you are new to continuous integration for mobile platforms then you ...
- Jenkins(转)
1 修改jenkins的根目录,默认地在C:\Documents and Settings\AAA\.jenkins . .jenkins ├─jobs│ └─JavaHelloWorld│ ...
- Jenkins 使用 SonarQube 扫描 Coding
Jenkins 使用 SonarQube 扫描 Coding 系统环境: Jenkins 版本:2.176 SonarQube 版本:7.4.0 一.SonarQube 介绍 1.SonarQub ...
- Jenkins+GitLab+SonnarQube搭建CI/CD全流程
1. CI/CD 1.1 CI - 持续集成 持续集成( Continuous integration , 简称 CI )指的是,频繁地(一天多次)将代码集成到主干.持续集成的目的就是让产品可以快速迭 ...
随机推荐
- iOS蓝牙心得
1.获取蓝牙mac地址 因为安卓不能得到uuid,所以,在要同步的时候要将uuid转换成mac地址,下面是转换方法 [peripheral discoverServices:@[[CBUUID UUI ...
- uva 10391
这个题,单纯做出来有很多种方法,但是时间限制3000ms,因此被TL了不知道多少次,关键还是找对最优解决方法,代码附上: #include<bits/stdc++.h> using nam ...
- Problem 2062 Suneast & Yayamao 二进制(多重背包的理解基础)
Problem 2062 Suneast & Yayamao Accept: 143 Submit: 313T ...
- 【bzoj1103】【POI2007】【大都市】(树状数组+差分)
在经济全球化浪潮的影响下,习惯于漫步在清晨的乡间小路的邮递员Blue Mary也开始骑着摩托车传递邮件了.不过,她经常回忆起以前在乡间漫步的情景.昔日,乡下有依次编号为1..n的n个小村庄,某些村庄之 ...
- PHP和JS判断变量是否定义
PHP中: 通过isset(变量名)来判断,定义返回true/未定义返回false JS中: 通过typeof来判断.
- Asp.net MVC4高级编程学习笔记-视图学习第一课20171009
首先解释下:本文只是对Asp.net MVC4高级编程这本书学习记录的学习笔记,书本内容感觉挺简单的,但学习容易忘记,因此在边看的同时边作下了笔记,可能其它朋友看的话没有情境和逻辑顺序还请谅解! 一. ...
- php正则匹配utf-8编码的中文汉字
在javascript中,要判断字符串是中文是很简单的.比如: var str = "php编程"; if (/^[\u4e00-\u9fa5]+$/.test(str)) { a ...
- 关于JQuery全选/反选第二次失效的问题
最近在项目中,遇到一个问题,测试全选/反选功能时,第一次对母框进行选中/非选中时,能同步子框的全选/反选状态,之后再点击母框,子框就没反应了.原代码大致结构关键如下: function selectA ...
- 三分钟浅谈TT猫的前端优化
首先看一张访问TT猫首页的截图: 测试环境为谷歌浏览器,暂且不讨论其它浏览器,截图下方我们可以观察到以下参数: DOMContentLoaded:1.42s | Load:2.31s 以上参数是在CT ...
- ch4-计算属性(表达式计算 computed methods watchers)
1 计算属性 1.1 模板内的表达式是非常便利的,但是它们实际上只用于简单的运算. 在模板中放入太多的逻辑会让模板过重且难以维护. <div id="test1"> { ...