================================================================================
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)的更多相关文章

  1. Salesforce学习之路-developer篇(二)利用Jenkins和Bitbucket实现Salesforce的CI/CD功能

    上文提到,基于CRM的二次开发是必不可少的,但是在实际项目中CI/CD是不可忽略的一个重要部分,与传统的Java,Python项目不同,如果对Salesforce进行持续集成和持续部署呢? 结合找到的 ...

  2. Jenkins与.NET项目

    转自: https://blog.dangl.me/categories Continuous Integration RSS Date Post 2016-10-20 Set Up Private ...

  3. Continuous Integration with Selenium

    I have seen a lot of queries from people who basically want to know how to blend Selenium, Maven, an ...

  4. Jenkins 部署

    1  修改jenkins的根目录,默认地在C:\Documents and Settings\AAA\.jenkins . .jenkins ├─jobs│  └─JavaHelloWorld│    ...

  5. 《Continuous Integration》读书笔记

    Trigger a Build whenever a change occurs. it can help us reduce assumptions on a projecvt by rebuild ...

  6. Jenkins iOS – Git, xcodebuild, TestFlight

    Introduction with Jenkins iOS If you are new to continuous integration for mobile platforms then you ...

  7. Jenkins(转)

    1  修改jenkins的根目录,默认地在C:\Documents and Settings\AAA\.jenkins . .jenkins ├─jobs│  └─JavaHelloWorld│    ...

  8. Jenkins 使用 SonarQube 扫描 Coding

    Jenkins 使用 SonarQube 扫描 Coding   系统环境: Jenkins 版本:2.176 SonarQube 版本:7.4.0 一.SonarQube 介绍 1.SonarQub ...

  9. Jenkins+GitLab+SonnarQube搭建CI/CD全流程

    1. CI/CD 1.1 CI - 持续集成 持续集成( Continuous integration , 简称 CI )指的是,频繁地(一天多次)将代码集成到主干.持续集成的目的就是让产品可以快速迭 ...

随机推荐

  1. 自定义Django的中间件

    分析Django的生命周期,我们知道所有的http请求都要经过Django的中间件. 假如现在有一个需求,所有到达服务端的url请求都在系统中记录一条日志,该怎么做呢? Django的中间件的简介 D ...

  2. angular 学习笔记

    每天进步一点点,学习笔记 笔记来自  angular权威指南 如果想要屏蔽浏览器对表单的默认验证行为,可以在表单元素上添加 novalidate 标记. 而按钮标签则完全忽略 hr e f 属性,并不 ...

  3. SoapUI简介和入门实例解析

    SoapUI简介 SoapUI是一个开源测试工具,通过soap/http来检查.调用.实现Web Service的功能/负载/符合性测试.该工具既可作为一个单独的测试软件使用,也可利用插件集成到Ecl ...

  4. Linux 安装Anaconda 4.4.0

    安装步骤参考了官网的说明:https://docs.anaconda.com/anaconda/install/linux.html 具体步骤如下:  1.在官网下载地址 https://www.an ...

  5. axis和cxf集成Springmvc的使用

    一.使用axis用wsdl生成Webservice: 工具:有axis插件的eclipse,wsdl文件: 操作步骤: 新建工程-->选择wsdl文件-->右键选择Webservice-- ...

  6. MySQL之常用函数

    MySQL有如下常用函数需要掌握: 1.数学类函数 函数名称 作用 ABS(x)   返回x的绝对值                      SQRT(x)   返回x的非负二次方根 MOD(x,Y ...

  7. JavaScript设计模式接口

    JavaScript中实现接口的方法有三种: 第一种,使用注释的方法实现接口 特点:(1)最简单,但是功能最弱(2)利用 interface和 implement"文字"(3)把他 ...

  8. css3弹性盒模型flex快速入门与上手1

    一.什么是flex? flex是css3中引入的一种布局方式,可以非常灵活高效控制元素的排列与对齐方式,大多人称之为弹性布局. 二.怎么使用flex? 任何一个容器都可以指定为flex布局 #box ...

  9. Python数据可视化利器Matplotlib,绘图入门篇,Pyplot介绍

    Pyplot matplotlib.pyplot是一个命令型函数集合,它可以让我们像使用MATLAB一样使用matplotlib.pyplot中的每一个函数都会对画布图像作出相应的改变,如创建画布.在 ...

  10. Javascript/Jquery操作数组,增删改查以及动态创建HTML元素

    <html> <head> <title> New Document </title> <script src="~/Scripts/j ...