forked from pangea-project/pangea-tooling
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjenkins_jobs_update_xenon.rb
executable file
·113 lines (96 loc) · 3.61 KB
/
jenkins_jobs_update_xenon.rb
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
110
111
112
113
#!/usr/bin/env ruby
# frozen_string_literal: true
#
# Copyright (C) 2018 Harald Sitter <[email protected]>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) version 3, or any
# later version accepted by the membership of KDE e.V. (or its
# successor approved by the membership of KDE e.V.), which shall
# act as a proxy defined in Section 6 of version 3 of the license.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library. If not, see <http://www.gnu.org/licenses/>.
ENV['JENKINS_CONFIG'] = File.join(Dir.home, '.config/pangea-jenkins.json.xenon')
require_relative 'lib/xenonci'
require_relative 'lib/ci/overrides'
require_relative 'lib/projects/factory'
require_relative 'lib/jenkins/project_updater'
Dir.glob(File.expand_path('jenkins-jobs/*.rb', __dir__)).each do |file|
require file
end
Dir.glob(File.expand_path('jenkins-jobs/xenon/*.rb', __dir__)).each do |file|
require file
end
# Updates Jenkins Projects
class ProjectUpdater < Jenkins::ProjectUpdater
def initialize
@job_queue = Queue.new
@flavor = 'xenon'
@projects_dir = "#{__dir__}/xenon-data/projects"
JenkinsJob.flavor_dir = "#{__dir__}/jenkins-jobs/#{@flavor}"
super
end
private
def all_template_files
files = super
files + Dir.glob("#{JenkinsJob.flavor_dir}/templates/**.xml.erb")
end
def load_overrides!
# TODO: there probably should be a conflict check so they don't override
# the same thing.
files = Dir.glob("#{__dir__}/xenon-data/overrides/*.yaml")
p files
# raise 'No overrides found?' if files.empty?
CI::Overrides.default_files += files
end
def populate_queue
load_overrides!
all_builds = []
XenonCI.series.each_key do |distribution|
XenonCI.types.each do |type|
projects_file = "#{@projects_dir}/xenon/#{distribution}/#{type}.yaml"
projects = ProjectsFactory.from_file(projects_file,
branch: "Neon/#{type}")
projects.each do |project|
j = XenonProjectJob.new(project,
distribution: distribution,
type: type,
architectures: XenonCI.architectures_for_type[type])
all_builds << enqueue(j)
end
end
end
# progenitor = enqueue(
# MgmtProgenitorJob.new(downstream_jobs: all_meta_builds,
# blockables: [merger])
# )
# enqueue(MGMTWorkspaceCleanerJob.new(dist: NCI.current_series))
# enqueue(MGMTJenkinsPruneParameterListJob.new)
# enqueue(MGMTJenkinsArchive.new)
enqueue(MGMTRepoCleanup.new)
#docker = enqueue(MGMTDockerJob.new(dependees: []))
# enqueue(MGMTGitSemaphoreJob.new)
enqueue(MGMTJobUpdater.new)
#jeweller = enqueue(MGMTGitJewellerJob.new)
# enqueue(MGMTDigitalOcean.new)
# enqueue(MGMTDigitalOceanDangler.new)
#enqueue(PlasmaReleasemeTars.new)
#enqueue(PlasmaReleasemeChangelog.new)
#enqueue(PlasmaReleasemeTagsTest.new)
enqueue(MGMTTooling.new)
enqueue(MGMTToolingUpdateSubmodules.new)
end
end
if $PROGRAM_NAME == __FILE__
updater = ProjectUpdater.new
updater.update
updater.install_plugins
end