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://[email protected]/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 [email protected]

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://[email protected]/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 [email protected]
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 ]

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

时间: 2024-08-30 17:24:59

continous integration environment (Jenkins and bitbucket configuration)的相关文章

Android continuous integration with Jenkins and Docker

About Docker 什么Docker,为什么我们要折腾Docker,而不是直接在服务器上安装运行appilication所需的各种环境呢? 这个问题的产生和为什么需要虚拟机的理由差不多,我需要让我的代码运行在一个干净的无干扰的机器上,这样能够保证代码测试运行环境的一致性,降低其他不可知因素对代码的影响.而Docker和VM虚拟机相比又有其特点,比如启动速度快,可以单独将Docker保存为镜像,上传后能够让别人使用.甚至可以直接将自己的code放在Docker中,直接将环境和代码一起交付给客

Jenkins与.NET项目

转自: https://blog.dangl.me/categories Continuous Integration RSS Date Post 2016-10-20 Set Up Private NuGet Feeds with ProGet v4+ 2016-06-23 Publish and Deploy Asp.Net Core Applications from Jenkins to IIS 2016-06-09 Setting Asp.Net Core Environment Va

Jenkins iOS – Git, xcodebuild, TestFlight

Introduction with Jenkins iOS If you are new to continuous integration for mobile platforms then you are in the right place. This article will explain how to setup a fully automated continuous integration environment. To do this we will use the follo

jenkins 配置maven

一.Maven是什么? Maven是一个项目管理和综合工具.Maven提供了开发人员构建一个完整的生命周期框架.开发团队可以自动完成项目的基础工具建设,Maven使用标准的目录结构和默认构建生命周期. 在多个开发团队环境时,Maven可以设置按标准在非常短的时间里完成配置工作.由于大部分项目的设置都很简单,并且可重复使用,Maven让开发人员的工作更轻松,同时创建报表,检查,构建和测试自动化设置. 二.安装maven 安装maven,需要有jdk环境支持才行. 网上的大部分教程,jdk和mave

Jenkins 使用 SonarQube 扫描 Coding

Jenkins 使用 SonarQube 扫描 Coding 系统环境: Jenkins 版本:2.176 SonarQube 版本:7.4.0 一.SonarQube 介绍 1.SonarQube 简介 SonarQube 是一个用于代码质量管理的开源平台,用于管理源代码的质量.同时 SonarQube 还对大量的持续集成工具提供了接口支持,可以很方便地在持续集成中使用 SonarQube.此外, SonarQube 的插件还可以对 Java 以外的其他编程语言提供支持,对国际化以及报告文档化

Jenkins 初见

在网上貌似没有找到Jenkins的中文的太多的文档,有的都是关于Hudson的一些 零零散散的,所以自己边学习边实践总结了以下系列文章,希望有助于大家对于Jenkins的使用. 本系列文章是基于我3年多的SCM+build release经验,总结了最常用的最基本功能,文章基本上来自于Jenkins官方网站的英文帮助的翻译和实际的例子和操作的截图,让大家能够快速直观 地学习Jenkins. Jenkins是Continous Integration Server,是Hadson的继续. 类似的产

[转载] Jenkins入门总结

转载自http://www.cnblogs.com/itech/archive/2011/11/23/2260009.html 在网上貌似没有找到Jenkins的中文的太多的文档,有的都是关于Hudson的一些零零散散的,所以自己边学习边实践总结了以下系列文章,希望有助于大家对于Jenkins的使用. 本系列文章是基于我3年多的SCM+build release经验,总结了最常用的最基本功能,文章基本上来自于Jenkins官方网站的英文帮助的翻译和实际的例子和操作的截图,让大家能够快速直观地学习

Automated Front End Test - Xvfb, Chromedriver, Selenium, Jenkins

1. Install Xvfbm, google-chrome-stable and chromedriver in Jenkins sudo apt-get install -y xvfb google-chrome-stable Down chromedriver from https://sites.google.com/a/chromium.org/chromedriver/ The current version running in my jenkins server is Goog

jenkins 服务器的安装

安装环境 centos7 系列 安装方式 yum 安装 安装jenkins 需要首先配置 jdk 配置yum 源 wget -O /etc/yum.repos.d/jenkins.repo http://jenkins-ci.org/redhat/jenkins.repo 导入公钥 rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key 安装 yum install jenkins -y 查看安装后生成的文件 /usr/l