`

如何用Jenkins/Hudson自动构建OpenELEC

 
阅读更多

 

 

http://openelec.tv/forum/20-development-discussion/16247-how-to-build-openelec-using-hudsonjenkins-ci-continuous-integration-server#36754

 

Here are the steps that I took to get Hudson/Jenkins (I moved to Jenkins as it is updated more frequently) up and running in n Ubuntu 11.04 x64 Hyper-V VM. This tutorial assumes you already know how to set up Ubuntu to build openelec...if not, search on here for a guide on what you need. This guide should also work on VMware Virtual Machines, but I'm using Hyper V.


1.)Install Ubuntu Server Choosing Tomcat, SSH, and optionally Samba (if you want to pull files from windows). After you have Ubuntu installed, follow the directions here on how to get Ubuntu set up for hyper-v.

1a.) Configure Ubuntu for building. you can use the following command:

sudo apt-get  install build-essential g++ nasm flex bison gawk gperf autoconf automake m4 cvs libtool byacc texinfo gettext zlib1g-dev libncurses5-dev zip unzip xsltproc



2.)Install Hudson:

sudo sh -c "echo 'deb http://hudson-ci.org/debian binary/' > /etc/apt/sources.list.d/hudson.list"
sudo apt-get update
sudo apt-get install hudson


3.) You may need to change the default port Hudson listens on, which is 80. I chose 9090

sudo perl -pi -e 's/HTTP_PORT=(.*)\n/HTTP_PORT=9090\n/g' /etc/default/hudson


3a.) If you change the port, restart hudson by typing:

service hudson restart


4.) Check if Hudson works. In a browser, open "XXX.XXX.XXX.XXX:YYYY" where XXX... is your IP address, and YYYY is the Port you used. If all goes well, you should see something like the following (minus the jobs):


5.) Now that Hudson is installed, you'll need to add the Git plugin, if not already installed. To do this, go to "Manage Hudson" -> "Manage Plugins" -> Click "Available", and look for the "Git" SCM plugin. Once you install the plugin, you'll need to have Hudson restart, so click the box at the bottom. Once it restarts, you can continue.

6.) Configure the Git username/email: Click "Manage Hudson" and look for the GIT data, enter your username and email address so git can know who you are:


7.) Configure a project

  • a.) Select New project
  • b.) Enter a name for the project (Note, cannot contain spaces...OpenELEC will not build)
  • c.) Make sure you select "Build a free-style software project" and then click "OK"
  • d.) Enter the following information, in the correct boxes

 

  1. Github Project: github.com/OpenELEC/OpenELEC.tv/
  2. Source Code Management: Click Git, enter "github.com/OpenELEC/OpenELEC.tv.git" for Repository, then
  3. click advanced, and make sure you have the following:
  4. branches to build: master
  5. Under "Build" click "add build step" and select "execute Shell"
  6. Note: you'll need to make a shell script and put it somewhere, like your /home/user directory. For a simple build script, you can use something like the following:
  7.   #!/bin/sh
      PROJECT=ION ARCH=x86_64 make release
      
    Or.... you can do something much more complicated, like my original scripts did (log time it took, mail, and ftp the results, then delete all records of the build folder:
    #!/bin/sh
    date1=$(date +%s)
    PROJECT=ION ARCH=x86_64 make release
    date2=$(date +%s)
    date3=$(date)
    if [ -s target/OpenELEC-ION.x86_64*.bz2 ]; then
    echo 'Date/Time build finished:' $date3  > /home/evan/buildstatus.txt
    echo 'Date/Time finished: ' $date3 >> /home/evan/buildlog.txt
    echo 'Time for ION x64 build:' $((($date2-$date1)/(60))) minutes, $((($date2-$date1) % 60)) seconds >> /home/evan/buildlog.txt
    echo 'Time for ION x64 build:' $((($date2-$date1)/(60))) minutes, $((($date2-$date1) % 60)) seconds >> /home/evan/buildstatus.txt
    FILESIZE=$(stat --printf="%s" target/OpenELEC-ION.x86_64*.bz2)
    echo 'Total File Size: ' $FILESIZE bytes >> /home/evan/buildstatus.txt
    ncftpput -u username -p password myftp.com /ION target/OpenELEC-ION.x86_64*.bz2
    FNAME=$(stat --printf="%n" target/OpenELEC-ION.x86_64*.bz2)
    REV=$(echo $FNAME | awk '{print substr($0, length($0) - 12,5)}')
    #mailx  -s "OpenELEC.tv ION x64 Build $REV complete" email@server.com < /home/evan/buildstatus.txt
    rm -f target/OpenELEC-ION.x86_64*.*
    rm -rf build.OpenELEC-ION.x86_64-devel
    
  8. call it something like "buildion64.sh" or whatever, give it +x permissions by chmoding +x, and remember where you saved it. In the screenshot above, you can see I entered it already, you'll have to enter yours just like I did, where it says "sh /home/<user>/blah.sh"



That's pretty much all you need to get it up and running. Once you save your Job, you can create new ones. If you install the "template" plugin, you can use previously created jobs to fast-make new ones. Make sure you setup a .sh script to build each project you want. One major note. This by default will create separate folders for EACH build you make, so if you go and build 6 different versions (like I do) it's going to clone the git project 6 times. That will take up a lot of disk space, so you may want to go in to your advanced project properties (click the button) and set the workspace to be the same, such as mine:

/var/lib/jenkins/jobs/OpenELEC.tv/workspace/




Note #2: When you build for the first time, it won't give you an ETA. Once you successfully build however, it should be able to try and predict how long new builds will take (uses the last build time.) If you'd rather use Jenkins, you can Google how to switch from Hudson to Jenkins, it takes about 2 seconds to do and you don't loose any of your jobs.

Note #3: Per "MikeBuzz", you may need to do the following as well. I did not, but he did on his system if you get errors with git when pulling for the first time:

sudo -s -H -u hudson
git config --global user.name "Hudson"
git config --global user.email "hudson@mydomain.com"
exit



if using jenkins

sudo -s -H -u jenkins
git config --global user.name "Hudson"
git config --global user.email "hudson@mydomain.com"
exit



Thanks Mike!


Please let me know if you have any questions. Mods, can we move this to the "Guides" section please?

HTPC: Zotac ION-A-U with 4GB ram & 32GB SSD
Build box/File Server: W2k8 R2, AMD x3 455, 14TB RAID 5 with 2TB Samsung HD204UI drives.

Too lazy to roll your own builds? take mine: http://www.mediafire.com/openelec
Want to check my build status? check here:EvanRich's Jenkins CI server
分享到:
评论

相关推荐

    hudson自动构建文档

    本文档将深入探讨Hudson的安装、配置、使用方法以及如何搭建远程自动构建和daily_build系统。 1. **Hudson安装** 安装Hudson通常涉及几个步骤:首先,下载最新版本的Hudson war文件,可以从官方网站获取。然后,将...

    改之理java源码复制-kin:Jenkins/Hudson作业配置生成器

    jenkins/hudson 作业配置生成器 概括 通过从模板构建 jenkins/hudson 作业配置来简化多个项目的配置过程。 基本原理 假设您有 10 个类似类型的项目。 是 ant、maven、gradle、grails 或任何其他类型的项目。 它们...

    C-C++项目的自动化构建与部署:使用Jenkins和CMake.md

    如何利用Jenkins和CMake实现C/C++项目的自动化构建与部署。首先介绍了Jenkins和CMake的基础知识和功能,然后阐述了在Jenkins中配置CMake构建的具体步骤,包括安装、插件配置、任务创建及Pipeline定义。接着,讲解了...

    基于Jenkins的PHP自动构建

    ### 基于Jenkins的PHP自动构建 #### Jenkins安装与配置 Jenkins 是一个开源软件项目,是持续集成服务的首选工具之一。它能够监控重复的工作,如构建、测试和部署,支持软件项目的持续集成和持续交付。下面将详细...

    使用Jenkins进行Unity自动构建

    ### 使用Jenkins进行Unity自动构建 #### Jenkins介绍 Jenkins是一个强大的开源持续集成与持续交付(CI/CD)工具,广泛应用于软件开发过程中自动化构建、测试及部署等环节。它支持多种编程语言,并且能够通过丰富的...

    linux-一个基于Jenkins的iOSAndroid自动构建系统

    在IT行业中,构建自动化是提高效率、减少错误和加速软件发布流程的关键环节。"Linux-一个基于Jenkins的iOS/Android自动构建系统"是这样的一个解决方案,它利用Jenkins这一强大的持续集成工具,实现了跨平台的iOS和...

    Jenkins + Gitee 实现代码自动化构建

    Jenkins + Gitee 实现代码自动化构建 Jenkins + Gitee 实现代码自动化构建 Jenkins + Gitee 实现代码自动化构建 Jenkins + Gitee 实现代码自动化构建 Jenkins + Gitee 实现代码自动化构建 Jenkins + Gitee 实现代码...

    Jenkins+Gradle自动构建打包Android工程教程

    ### Jenkins+Gradle自动构建打包Android工程教程 #### 一、前言 随着软件开发规模的不断扩大以及持续集成(CI)理念的普及,自动化构建工具的重要性日益凸显。本教程将详细介绍如何利用Jenkins与Gradle搭建一个自动...

    jenkins搭建和自动构建.docx

    【Jenkins 搭建与自动构建】 在 CentOS 7 系统中,Jenkins 是一个流行的持续集成和持续部署工具,它可以帮助自动化软件开发流程,包括构建、测试和部署。以下是如何在 CentOS 7 上安装和配置 Jenkins,以及如何进行...

    基于Jenkins+Gitlab+Docker实现SpringBoot项目自动部署

    接下来,我们可以使用Jenkins来实现自动化构建和部署。我们可以创建一个Pipeline来实现这个过程。 在Pipeline中,我们可以使用Maven来构建SpringBoot项目,然后使用Gitlab Hook来触发自动化构建和部署。 本文介绍...

    使用Jenkins进行Unity自动构建续

    Jenkins作为一款开源的持续集成工具,在游戏开发、软件构建等领域中广泛应用于自动化测试和构建。尤其是在Unity游戏开发中,结合版本控制系统如SVN,可以实现代码的自动拉取、编译以及部署。以下是从提供的文件内容...

    docker安装jenkins详细步骤

    1.拉取3Jenkins镜像 docker pull jenkins/jenkins 2.查看镜像文件 docker images 3.创建Jenkins挂载目录并授权权限 创建:mkdir -p /usr/local/jenkins/data 授权:chmod -R 777 /usr/local/jenkins/data ...

    Jenkins配置自动化构建

    Jenkins 配置自动化构建详解 Jenkins 是一个流行的持续集成工具,用于自动化构建、测试和部署软件项目。本文将详细介绍如何配置 Jenkins 实现自动化构建,包括安装、创建任务、配置源代码管理、构建触发器、构建...

    jenkins实现安卓自动构建及nginx+qrencode生成二维码.txt

    本方案主要是结合Jenkins+nginx+qrencode实现安卓源码自动构建的方法, 完美解决第三方平台蒲公英免费版限制生成的二维码限制10次下载的限制,而且资源保存在自己的服务器上也是最安全的,分享nginx+jenkins shell...

    project docment_tools VSS / CVS / SVN / ClearCase / Hudson / GIT

    Hudson/Jenkins与版本控制系统结合使用,可以实现代码的自动构建和测试,提升开发效率。 6. Git: Git是目前最流行的分布式版本控制系统,由Linus Torvalds为Linux内核开发。Git具有高效、灵活和强大的分支管理特性...

    Jenkins自动化构建部署说明文档

    ### Jenkins自动化构建...通过以上步骤和注意事项,可以较为全面地掌握如何使用Jenkins进行自动化构建与部署,并解决常见问题。这些步骤不仅适用于新手入门,也适合有一定经验的开发人员深入理解Jenkins的高级用法。

    jenkins自动构建自动部署

    ### Jenkins自动构建与自动部署详解 #### 一、概述 在现代软件开发过程中,持续集成(CI)和持续部署(CD)已经成为不可或缺的部分。通过自动化工具实现这些过程,可以极大地提高开发效率,减少人为错误,并确保软件的...

    Jenkins定时构建自动部署并通知

    ### Jenkins 定时构建自动部署并通知的知识点详解 #### 一、Jenkins定时构建自动部署概述 在软件开发过程中,持续集成(CI)和持续部署(CD)是非常重要的环节,能够有效提升软件项目的开发效率及质量。Jenkins...

    jenkins自动化构建

    ### Jenkins自动化构建详解 #### 一、Jenkins权限配置与管理 Jenkins 是一款非常流行的持续集成工具,它能够帮助团队实现自动化构建、测试及部署等流程,提高开发效率并确保软件质量。为了保证系统的安全性及操作...

    jenkins/jenkins

    jenkins/jenkins的包

Global site tag (gtag.js) - Google Analytics