Commit e8cc30d2c7ca98b6cbb366d9f683f9edaa0ccaca

Authored by Jacob Vosmaer
2 parents 153143b5 9abf53ef

Merge branch 'release_script' into 'master'

Release Script
Showing 3 changed files with 63 additions and 7 deletions   Show diff stats
.gitignore
... ... @@ -10,3 +10,4 @@ vendor/cookbooks
10 10 .ruby-gemset
11 11 .rvmrc
12 12 .rbenv-version
  13 +build.txt
... ...
doc/release.md
... ... @@ -29,23 +29,33 @@ git push origin 6-6-stable 6.6.0.omnibus
29 29  
30 30 ## On the build machines
31 31  
32   -- Check out the release branch of omnibus-gitlab.
  32 +- Install release dependencies
33 33  
34 34 ```shell
35   -git fetch
36   -git checkout 6-6-stable
  35 +# Ubuntu
  36 +sudo apt-get install python-pip
  37 +
  38 +# CentOS
  39 +sudo yum install python-pip
  40 +
  41 +# Both
  42 +sudo pip install awscli
  43 +aws configure # enter AWS key and secret
37 44 ```
38 45  
39   -- Check the version with `git describe`.
  46 +- Check out the release branch of omnibus-gitlab.
40 47  
41 48 ```shell
42   -git describe # Should start with 6.6.0.omnibus
  49 +git fetch
  50 +git checkout 6-6-stable
43 51 ```
44 52  
45   -- Build a package with timestamps disabled.
  53 +- Run the release script
46 54  
47 55 ```shell
48   -OMNIBUS_APPEND_TIMESTAMP=0 bin/omnibus build project gitlab
  56 +./release.sh
49 57 ```
50 58  
  59 +This will `clean --purge` the build environment, build a package and upload it to S3.
  60 +
51 61 [the gitlab-rails version in omnibus-gitlab]: ../config/software/gitlab-rails.rb#L20
... ...
release.sh 0 → 100755
... ... @@ -0,0 +1,45 @@
  1 +#!/bin/bash
  2 +PROJECT=gitlab
  3 +RELEASE_BUCKET=downloads-packages
  4 +RELEASE_BUCKET_REGION=eu-west-1
  5 +
  6 +function error_exit
  7 +{
  8 + echo "$0: fatal error: $1" 1>&2
  9 + exit 1
  10 +}
  11 +
  12 +if !(git diff --quiet HEAD); then
  13 + error_exit 'uncommited changes'
  14 +fi
  15 +
  16 +if !(git describe --exact-match); then
  17 + error_exit 'HEAD is not tagged'
  18 +fi
  19 +
  20 +if !(bin/omnibus clean --purge ${PROJECT}); then
  21 + error_exit 'clean failed'
  22 +fi
  23 +
  24 +if !(touch build.txt); then
  25 + error_exit 'failed to mark build start time'
  26 +fi
  27 +
  28 +if !(OMNIBUS_APPEND_TIMESTAMP=0 bin/omnibus build project ${PROJECT}); then
  29 + error_exit 'build failed'
  30 +fi
  31 +
  32 +release_package=$(find pkg/ -newer build.txt -type f -not -name '*.json')
  33 +if [[ -z ${release_package} ]]; then
  34 + error_exit 'could not find the release package'
  35 +fi
  36 +
  37 +echo
  38 +echo 'Package MD5:'
  39 +md5sum ${release_package}
  40 +
  41 +echo
  42 +echo 'Starting upload'
  43 +if !(aws s3 cp ${release_package} s3://${RELEASE_BUCKET} --acl public-read --region ${RELEASE_BUCKET_REGION}); then
  44 + error_exit 'release upload failed'
  45 +fi
... ...