-
Notifications
You must be signed in to change notification settings - Fork 4
/
deploy-all
executable file
·109 lines (95 loc) · 3.17 KB
/
deploy-all
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/usr/bin/env ruby
# frozen_string_literal: true
# This script deploys all known CI pipelines.
# Run as `deploy-all` to deploy pipelines one by one.
require 'English'
require 'tempfile'
# Print a status message
def status(message)
puts "\e[0;1;32m#{message}\e[0m"
end
# Run a command
def run(*args)
puts "Running #{args.join(' ')}..."
pid = Process.spawn(*args)
Process.wait pid
status = $CHILD_STATUS.exitstatus
raise "#{args.join(' ')} returned #{status}" unless $CHILD_STATUS.success?
end
# Deploy using the deploy script standard for Vancouver pipelines
def deploy_vancouver(path, opts = {})
Dir.chdir(path) do
opts[:variants].each do |variant|
status "deploying #{path} (#{variant})"
args = [%w[./deploy ./deploy.sh].find { |f| File.exist? f }].compact
raise "No deploy script found for #{path}" if args.empty?
args += ['-t', 'suse.de', variant]
args << opts[:config] if opts.include? :config
run(*args)
end
end
end
# Set default environment
ENV['CONCOURSE_SECRETS_FILE'] ||= \
File.join(Dir.pwd, '../cloudfoundry/secure/concourse-secrets.yml.gpg')
# Login everywhere
Dir.chdir('../cloudfoundry/ci/pipelines') do
status 'Logging in to concourse servers...'
{
'suse.de' => 'http://concourse.suse.de'
}.each do |target, url|
run 'make', "TARGET=#{target}", "CONCOURSE_URL=#{url}", 'login-suse.de'
end
end
run 'fly', '-t', 'suse.de', 'sync'
# Previous Vancouver targets (now also deployed on suse.de)
deploy_vancouver '../cloudfoundry/ci/pipelines/certstrap', variants: %w[master], config: 'production'
deploy_vancouver '../cloudfoundry/ci/pipelines/cf-usb-plugin', variants: %w[check master]
deploy_vancouver '../fissile-ci', variants: %w[check master develop]
deploy_vancouver '../configgin-ci', variants: %w[check master]
# Nuremberg targets
Dir.chdir('../cloudfoundry/ci/pipelines/cf-usb') do
status 'deploying cf-usb (openSUSE develop)'
run './deploy', '-t', 'suse.de', 'production'
status 'deploying cf-usb (SLE master)'
run './deploy', '-t', 'suse.de', 'sle-production-master', 'sle'
end
Dir.chdir('../bosh-linux-stemcell-builder-ci') do
%w[
release-fissile
release-os-images
release-sles-os-images
].each do |target|
status "Deploying bosh-linux-stemcell-builder-ci target #{target}"
run 'make', 'TARGET=suse.de', target
end
end
Dir.chdir('../cloudfoundry/ci/pipelines') do
# This has a bunch of pipelines
run 'make', 'pipelines'
ensure
run 'make', 'post'
end
Dir.chdir('../cap/cap-helm-charts-ci') do
run './deploy-pipeline', 'suse.de', 'cap-helm-charts-pr'
end
Dir.chdir('../buildpacks-ci') do
# We need to decode the secrets for this pipeline manually
status 'deploying buildpacks pipeline'
Tempfile.open(['concourse-secrets', '.yml']) do |decrypted|
encrypted = ENV['CONCOURSE_SECRETS_FILE']
run('gpg', '--decrypt', '--batch', '--quiet', encrypted, out: decrypted)
%w[
buildpacks
brats
java
].each do |target|
run({ 'TARGET' => 'suse.de', 'CONCOURSE_SECRETS_FILE' => decrypted.path },
'./deploy.sh', target)
end
end
end
Dir.chdir('../scf-eirini-ci') do
status 'deploying scf-eirini-ci pipeline'
run './set-pipeline.sh'
end