-
Notifications
You must be signed in to change notification settings - Fork 8
/
Rakefile
64 lines (54 loc) · 1.56 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
task :default => [:test]
desc "Run just tests no measurements"
task :test do
sh "ginkgo -r -skipMeasurements ."
end
desc "Run tests including measure tests"
task :test_and_measure do
sh "ginkgo -r ."
end
desc "Builds packages"
task :build do
version = ENV["VERSION"] || "0.0.0"
docker_socket = ENV["DOCKER_SOCKET"] || "/var/run/docker.sock"
sha = `git rev-parse --short HEAD`.chomp
build = ENV["BUILD"] || "foss"
packages = (ENV["PACKAGES"] || "").split(",")
packages = ["el7_64", "el8_64"] if packages.empty?
source = "/go/src/github.com/choria-io/aaasvc"
packages.each do |pkg|
if pkg =~ /^(.+?)_(.+)$/
builder = "choria/packager:%s-go1.16" % $1
elsif ["puppet", "docker"].include?(pkg)
builder = "choria/packager:el7-go1.16-puppet"
else
builder = "choria/packager:el7-go1.16"
end
sh 'docker run --rm -v %s:/var/run/docker.sock -v `pwd`:%s:Z -e SOURCE_DIR=%s -e ARTIFACTS=%s -e SHA1="%s" -e BUILD="%s" -e VERSION="%s" -e PACKAGE=%s %s' % [
docker_socket,
source,
source,
source,
sha,
build,
version,
pkg,
builder
]
end
end
desc "Builds binaries"
task :build_binaries do
version = ENV["VERSION"] || "0.0.0"
sha = `git rev-parse --short HEAD`.chomp
build = ENV["BUILD"] || "foss"
source = "/go/src/github.com/choria-io/aaasvc"
sh 'docker run --rm -v `pwd`:%s:Z -e SOURCE_DIR=%s -e ARTIFACTS=%s -e SHA1="%s" -e BUILD="%s" -e VERSION="%s" -e BINARY_ONLY=1 choria/packager:el7-go1.16' % [
source,
source,
source,
sha,
build,
version
]
end