forked from choria-io/go-choria
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
63 lines (54 loc) · 1.76 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
task :default => [:test]
ENV['MCOLLECTIVE_CERTNAME'] = 'rip.mcollective'
desc "Run just tests no measurements"
task :test do
sh "ginkgo -r ."
end
desc "Builds packages"
task :build do
version = ENV["VERSION"] || "0.0.0"
sha = `git rev-parse --short HEAD`.chomp
build = ENV["BUILD"] || "foss"
packages = (ENV["PACKAGES"] || "").split(",")
packages = ["el7_64", "el8_64", "bullseye_64"] if packages.empty?
go_version = ENV["GOVERSION"] || "1.21"
source = "/go/src/github.com/choria-io/go-choria"
packages.each do |pkg|
if pkg =~ /^windows/
builder = "registry.choria.io/choria/packager:bullseye-go%s" % [go_version]
elsif pkg =~ /darwin.+tarball/
builder = "registry.choria.io/choria/packager:el8-go%s" % go_version
elsif pkg =~ /linux.+tarball/
builder = "registry.choria.io/choria/packager:el8-go%s" % go_version
elsif pkg =~ /^(.+?)_(.+)$/
builder = "registry.choria.io/choria/packager:%s-go%s" % [$1, go_version]
else
builder = "registry.choria.io/choria/packager:el7-go%s" % go_version
end
sh 'docker run --rm -v `pwd`:%s -e SOURCE_DIR=%s -e ARTIFACTS=%s -e SHA1="%s" -e BUILD="%s" -e VERSION="%s" -e PACKAGE=%s %s' % [
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/go-choria"
sh 'docker run --rm -v `pwd`:%s -e SOURCE_DIR=%s -e ARTIFACTS=%s -e SHA1="%s" -e BUILD="%s" -e VERSION="%s" -e BINARY_ONLY=1 registry.choria.io/choria/packager:el7-go1.21' % [
source,
source,
source,
sha,
build,
version
]
end