================================================================================
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. BlockingQueue<> 队列的作用

    BlockingQueue<> 队列的作用 BlockingQueue 实现主要用于生产者-使用者队列 BlockingQueue 实现主要用于生产者-使用者队列,BlockingQueu ...

  2. multimap 和priority_queue详解

    上一期是关于STL和并查集结合的例题,也附了STL中部分容器的使用摘要,由于是从网上东拼西凑的,感觉有的关键点还是没解释清楚,现在从其中摘出两个容器,用例题对它们的用法进行进一步解释. 以下是例题的介 ...

  3. java 面向对象 1

    目录 一.面向过程的思想和面向对象的思想 二.简单理解面向对象 三.面向对象的设计思想 四.对象和类的概念 五.如何抽象出一个类? 六.类(对象)之间的关系 七.Java与面向对象 八.为什么使用面向 ...

  4. C#操作SqlServer MySql Oracle通用帮助类Db_Helper_DG(默认支持数据库读写分离、查询结果实体映射ORM)

    [前言] 作为一款成熟的面向对象高级编程语言,C#在ADO.Net的支持上已然是做的很成熟,我们可以方便地调用ADO.Net操作各类关系型数据库,在使用了多年的Sql_Helper_DG后,由于项目需 ...

  5. 巧用Mono.Cecil反射加载类型和方法信息

    最近在做服务的细粒度治理,统一管理所有服务的方法.参数.返回值信息.方便后续的各个模块之间的对接和协作. 目前系统中所有的服务,管理到接口契约粒度,即服务接口声明和服务接口实现.要做服务的细粒度治理: ...

  6. Java并发之线程中断

    前面的几篇文章主要介绍了线程的一些最基本的概念,包括线程的间的冲突及其解决办法,以及线程间的协作机制.本篇主要来学习下Java中对线程中断机制的实现.在我们的程序中经常会有一些不达到目的不会退出的线程 ...

  7. 【Linux笔记(002) 】-- centos7 文档操作基本命令

    一.cd -- ChangeDirectory a) 切换到 /DemoLM/ 文件夹 b) 回到用户 Home 根目录:是哪个账户登录的就会进入哪个用户的根目录 二.pwd -- PrintWork ...

  8. 用 Python 撸一个区块链

    本文翻译自 Daniel van Flymen 的文章 Learn Blockchains by Building One 略有删改.原文地址:https://hackernoon.com/learn ...

  9. .NET十年回顾

    一.   引子 从我还是编程菜鸟时起,.NET就从来没让我失望过.总是惊喜不断. 当年我第一个项目是做个进销存.用的Winform.当时我是机电工程师.编程只是业余心血来潮而已. .NET的低门槛.V ...

  10. Angular学习笔记(一)

    本文为原创文章,转载请标明出处 目录 架构 模块 组件 模板 元数据 数据绑定 指令 服务 依赖注入 模板与数据绑定 1. 架构 模块 Angular 应用是模块化的,并且 Angular 有自己的模 ...