================================================================================
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. 作为一个C#程序员, 你应该上手Kotlin

    Kotlin最近火了, 在Google IO大会 Kotlin宣布Kotlin将会成为Android官方开发语言之后, Kotlin这样一个JVM上的新*(其实从诞生到现在已经有5年历史的)语言. 终 ...

  2. Jupyter(Python)中无法使用Cache原理分析

    前言 最近需要在Jupyter中写一个类库,其中有一个文件实现从数据库中读取空间数据并加载为Feature对象,Feature对象是cartopy封装的geomery列表,能够方便的用于作图等.因为有 ...

  3. TCP/IP(三)数据链路层~2

    一.局域网 1.1.局域网和以太网的区别和联系 局域网:前面已经介绍了,其实就是学校里面.各个大的公司里,自己组件的一个小型网络,这种就属于局域网. 以太网:以太网(Ethernet)指的是由Xero ...

  4. java编程基础复习-------第二章

    一.标识符 java中标识符的命名规则: 以数字.字母.下划线和$符号组成:不能用数字开头:不能是java的关键字. 注意:不要用$命名标识符.习惯上,$只用在机器自动产生的源代码中. 二.关键字 1 ...

  5. Elevator poj3539

    Elevator Time Limit: 4000MS   Memory Limit: 65536K Total Submissions: 1072   Accepted: 287 Case Time ...

  6. GCD XOR uvalive6657

    GCD XORGiven an integer N, nd how many pairs (A; B) are there such that: gcd(A; B) = A xor B where1 ...

  7. pongo英雄会-幸运数题解

    显然我们只要知道1~x范围有多少幸运数(用f(x)表示),lucky(x,y)=f(y)-f(x-1). 解法1. 计算排列数 由于y<=1000000000这个规模,我们不能暴力验证每个数是否 ...

  8. node.js上除了Express还有哪些好用的web开发框架

    老司机都有体会, 开发本身没有多难, 最纠结其实是最初的技术和框架选型, 本没有绝对的好坏之分, 可一旦选择了不适合于自己业务场景的框架, 将来木已成舟后开发和维护成本都很高, 等发现不合适的时候更换 ...

  9. 电脑IP地址被占用如何释放?

    回车后,关机,等待5分钟左右再开机,就释放掉了.

  10. java 虚拟机与并发处理几个问题简要(一)

    一.   处理任务时,应该将代码分成不同的部分,每一部分由一个线程进行,但是会因为任务负载不平衡导致有闲有忙.最好是应分成不同的部分,分配不同的线程,尽量让处理器不停的处理,不要闲下来.如何分配线程数 ...