release.sh 654 Bytes
Newer Older
1
2
3
4
5
6
#!/bin/bash

# Generate a build ID based on the current time and the PID of this script
build="$(date '+%s')-$$"

# Install/update gems for omnibus-ruby
7
bundle install --binstubs
8
9
10
11
12
13

# Do the build and capture its output in a .log file
make do_release 2>&1 | tee -a ${build}.log

# Check the exit status of `make`, not `tee`
if [[ ${PIPESTATUS[0]} -eq 0 ]]; then
14
  subject="omnibus-gitlab-runner build ${build} SUCCESS"
15
else
16
  subject="omnibus-gitlab-runner build ${build} FAIL"
17
18
19
20
21
fi

# We assume that email to the current system user will somehow reach the right
# human eyes
tail -n 20 ${build}.log | sed 's/.*\r//' | mail -s "${subject}" $(cat ~/.forward)