Giter Site home page Giter Site logo

andrew-polk / buildupdate Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sillsdev/buildupdate

0.0 2.0 0.0 94 KB

Creates bash script to update the current build environment based on TeamCity artifact dependencies.

License: MIT License

Ruby 100.00%

buildupdate's Introduction

BuildUpdate

Summary

This Ruby scripts manages a bash script that updates the build environment on a developer's machine to match the environment used on TeamCity. The generated bash script will download the artifact dependencies needed for the project.

Installation


Windows Install Requirements

  • Install bash via msysgit (which includes Git Bash) or Cygwin
  • Install the latest Ruby -- Tested 2.3.1 & 1.9.3
    • Check "Add Ruby executables to your PATH"
    • Check "Associate .rb and .rbw files with this Ruby installation"
  • gem install bundler
    • With Ruby 2.3.1, you may get this error Unable to download data from https://rubygems.org/ - SSL_connect returned=1...
    • do the following workaround from a cmd window (not git bash)
# 1. Add insecure source
> gem sources -a http://rubygems.org/
https://rubygems.org is recommended for security over http://rubygems.org/

Do you want to add this insecure source? [yn]  y
http://rubygems.org/ added to sources

# 2. Remove secure source
> gem sources -r https://rubygems.org/
https://rubygems.org/ removed from sources

# 3. Update source cache
> gem sources -u
source cache successfully updated
  • git clone https://github.com/chrisvire/BuildUpdate
  • cd BuildUpdate
  • bundle install

Ubuntu 16.04 & 14.04 Install Requirements

The default version of Ruby for Ubuntu 16.04 is 2.3.1. The default version of Ruby for Ubuntu 14.04 is 1.9.3.

  1. sudo apt-get install ruby ruby-dev zlib1g-dev
  2. sudo gem install bundler
  3. git clone https://github.com/chrisvire/BuildUpdate
  4. cd BuildUpdate
  5. bundle install

Ubuntu 12.04 Install Requirements

The default version of Ruby in Ubuntu 12.04 is Ruby 1.8. This script requires Ruby 1.9.1 so a specific ruby version package must be specified.

  1. sudo apt-get install ruby1.9.1 ruby1.9.1-dev zlib1g-dev
  2. sudo gem install bundler
  3. git clone https://github.com/chrisvire/BuildUpdate
  4. cd BuildUpdate
  5. bundle install

Authentication

Team City requires authentication to access project configuration. The script will prompt for the username and password. You can specify these in the following environment variables:

BUILDUPDATE_USER
BUILDUPDATE_PASSWORD

Setup

BuildUpdate will need to generate a bash script for each platform (e.g. Windows or Linux) for the project. There is normally a continuous build setup for each platform. For example, browse to http://build.palaso.org and select "libpalaso" project and "palaso-precise64-master Continuous" build and the url will be http://build.palaso.org/viewType.html?buildTypeId=bt322. You will see buildTypeId=XXXXX in the query string. BuildUpdate refers to this as build_type with a value of bt322.

Create the shell script

To create the initial shell script, determine the build_type and run the following command (of cource, windows users should used backslashes):

cd to/src/repo
../path/to/BuildUpdate/buildupdate.rb -f getDependencies-linux.sh -t YOUR_BUILD_TYPE

Create the shell script in a sub-directory

If the shell script will be in a sub-directory of the project repo, you need to specify the root directory for where to run the update commands relative to the sub-directory.
For example, if you you decide to put these shell scripts in the build sub-directory, then run the following command:

$ cd to/src/repo/build
$ ../../path/to/BuildUpdate/buildupdate.rb -r .. -f getDependencies-linux.sh -t YOUR_BUILD_TYPE
  1. Create a buildupdate.sh script in your build directory with configuration (see below).
  2. Run the buildupdate.rb script to update buildupdate.sh with all of the calls to update the current build environment.
  3. Commit the buildupdate.sh script to source control.

Updates


Update scripts when dependencies change

These generated bash scripts should be committed into the source code respository. If the dependencies in Team City change, then the bash scripts need to be updated. Run the following command:

$ cd to/src/repo
$ ../../path/to/BuildUpdate/buildupdate.rb -f path/to/getDependencies-linux.sh

The Ruby scripts will look at configuration at the top of the bash script to determine the build_type and the root_dir.

Working in a different branch

If you are working in a long-running branch, you might have different dependencies that then master build_type. Setup a new build_type and commit a bash script to the branch (and be careful not to push it back to master).

Information


File format

The configuration is in comments at the beginning of the file. The variables used are:

  • server: specifies the the hostname of the TeamCity Server
  • project: the name of the TeamCity project
  • build: the name of the TeamCity build configuration
  • build_type: the TeamCity buildType id
  • root_dir: specify the directory relative to the location of the script where the commands of the script should be run

Specifying a build

To specify a build you can either do:

$ ../../path/to/BuildUpdate/buildupdate -f getDependencies-linux.sh -t YOUR_BUILD_TYPE

Or:

$ ../../path/to/BuildUpdate/buildupdate -f getDependencies-linux.sh -p "PROJECT_NAME" -b "BUILD_NAME"

Since the PROJECT_NAME and BUILD_NAME are just labels which can be changed through the Team City user interface, you should use the build_type instead (it doesn't change).

Getting list of projects from the command line

You can run the ruby script without parameters to get a list of projects.

$ ../../path/to/BuildUpdate/buildupdate
You need to specify project!
Possible Names:
  <Root project>
  Adapt It
  Bloom
  BloomLibrary.org
  BloomPlayer

Then you can use -p PROJECT_NAME to get a list of build_type : build_name pairs.

$ ../../path/to/BuildUpdate/buildupdate -p Bloom
Missing Build!
Possible 'Build Type : Build Name' pairs:
 BloomReleaseInternal37 : Bloom 3.7 Release Internal
 Bloom_Bloom37linux64Auto : Bloom-3.7-Linux64-Continuous
 bt222 : Bloom-Default-Continuous
 bt403 : Bloom-Default-Linux64-Continuous
 bt430 : Bloom-Master-JS-Tests
 bt396 : bloom-win32-static-dependencies
 BPContinuous : BloomPlayer-Master-Continuous
 bt434 : GtkUtils
 Bloom_Squirrel : Squirrel
 Bloom_YouTrackSharp : YouTrackSharp

Developers


Please reports issues through repo issues. If you like to contribute, please fork the repo and send pull requests. I will document debugging tips on the repo wiki.

buildupdate's People

Contributors

chrisvire avatar ermshiperete avatar stephenmcconnel avatar hatton avatar papeh avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.