* initial commit
This commit is contained in:
commit
248681f181
3
.bundle/config
Normal file
3
.bundle/config
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
BUNDLE_PATH: vendor/bundle
|
||||
BUNDLE_DISABLE_SHARED_GEMS: '1'
|
||||
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
.idea
|
||||
vendor
|
||||
|
||||
config.yaml
|
||||
*.pstore
|
||||
6
Gemfile
Normal file
6
Gemfile
Normal file
@ -0,0 +1,6 @@
|
||||
source 'https://rubygems.org'
|
||||
gem 'mustache'
|
||||
gem 'httpclient'
|
||||
gem 'jenkins_api_client'
|
||||
gem 'jira-ruby'
|
||||
gem 'mediawiki_api'
|
||||
71
Gemfile.lock
Normal file
71
Gemfile.lock
Normal file
@ -0,0 +1,71 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
activesupport (5.1.4)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (~> 0.7)
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
concurrent-ruby (1.0.5)
|
||||
domain_name (0.5.20170404)
|
||||
unf (>= 0.0.5, < 1.0.0)
|
||||
faraday (0.14.0)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
faraday-cookie_jar (0.0.6)
|
||||
faraday (>= 0.7.4)
|
||||
http-cookie (~> 1.0.0)
|
||||
faraday_middleware (0.12.2)
|
||||
faraday (>= 0.7.4, < 1.0)
|
||||
http-cookie (1.0.3)
|
||||
domain_name (~> 0.5)
|
||||
httpclient (2.8.3)
|
||||
i18n (0.9.3)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jenkins_api_client (1.5.3)
|
||||
json (>= 1.0)
|
||||
mixlib-shellout (>= 1.1.0)
|
||||
nokogiri (~> 1.6)
|
||||
socksify (>= 1.7.0)
|
||||
terminal-table (>= 1.4.0)
|
||||
thor (>= 0.16.0)
|
||||
jira-ruby (1.5.0)
|
||||
activesupport
|
||||
multipart-post
|
||||
oauth (~> 0.5, >= 0.5.0)
|
||||
json (2.1.0)
|
||||
mediawiki_api (0.7.1)
|
||||
faraday (~> 0.9, >= 0.9.0)
|
||||
faraday-cookie_jar (~> 0.0, >= 0.0.6)
|
||||
faraday_middleware (~> 0.10, >= 0.10.0)
|
||||
mini_portile2 (2.3.0)
|
||||
minitest (5.11.3)
|
||||
mixlib-shellout (2.3.2)
|
||||
multipart-post (2.0.0)
|
||||
mustache (1.0.5)
|
||||
nokogiri (1.8.2)
|
||||
mini_portile2 (~> 2.3.0)
|
||||
oauth (0.5.4)
|
||||
socksify (1.7.1)
|
||||
terminal-table (1.8.0)
|
||||
unicode-display_width (~> 1.1, >= 1.1.1)
|
||||
thor (0.20.0)
|
||||
thread_safe (0.3.6)
|
||||
tzinfo (1.2.5)
|
||||
thread_safe (~> 0.1)
|
||||
unf (0.1.4)
|
||||
unf_ext
|
||||
unf_ext (0.0.7.5)
|
||||
unicode-display_width (1.3.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
httpclient
|
||||
jenkins_api_client
|
||||
jira-ruby
|
||||
mediawiki_api
|
||||
mustache
|
||||
|
||||
BUNDLED WITH
|
||||
1.11.2
|
||||
25
config.yaml.dist
Normal file
25
config.yaml.dist
Normal file
@ -0,0 +1,25 @@
|
||||
---
|
||||
jira:
|
||||
url: "https://cc-jira.rnd.ki.sw.ericsson.se/"
|
||||
user: "CSCFCOMP"
|
||||
pass:
|
||||
labelName: "Automated"
|
||||
jql: 'filter=22843 AND issuetype = "Epic" AND status != "Done" AND (labels NOT IN("%s") OR labels IS EMPTY)'
|
||||
maxResults: 100
|
||||
|
||||
wiki:
|
||||
url: "https://wiki.lmera.ericsson.se/api.php"
|
||||
user: "CSCFCOMP"
|
||||
pass:
|
||||
|
||||
gerrit:
|
||||
url: "https://gerrit.ericsson.se/a/projects/cscf%2fcscf/branches/"
|
||||
user: "cscfcomp"
|
||||
pass:
|
||||
|
||||
jenkins:
|
||||
url: "https://fem029-eiffel021.rnd.ki.sw.ericsson.se:8443/jenkins/"
|
||||
user: "CSCFCOMP"
|
||||
pass:
|
||||
email: "PDLCSCFCOM@pdl.internal.ericsson.com"
|
||||
jobName: "CreateFeedbackLoop"
|
||||
72
cron.rb
Normal file
72
cron.rb
Normal file
@ -0,0 +1,72 @@
|
||||
# load bundler, so we can use locally installed gems
|
||||
require 'rubygems'
|
||||
require 'bundler/setup'
|
||||
|
||||
require 'yaml'
|
||||
require 'pstore'
|
||||
BASEPATH = File.dirname(__FILE__).freeze
|
||||
$config = YAML.load_file(BASEPATH + '/config.yaml').freeze
|
||||
$store = PStore.new("jira_status.pstore")
|
||||
$code = 0
|
||||
|
||||
require_relative 'jira_client'
|
||||
require_relative 'gerrit_client'
|
||||
require_relative 'jenkins_client'
|
||||
require_relative 'wiki_client'
|
||||
|
||||
|
||||
jira_client = JiraClient.new($config['jira'])
|
||||
wiki_client = WikiClient.new($config['wiki'])
|
||||
gerrit_client = GerritClient.new($config['gerrit'])
|
||||
jenkins_client = JenkinsClient.new($config['jenkins'])
|
||||
|
||||
jira_client.query_new_epics.map do |wp, key|
|
||||
$store.transaction do
|
||||
$store[key] = {
|
||||
:gerrit_created => false,
|
||||
:jenkins_created => false,
|
||||
:wiki_created => false
|
||||
} if $store[key] == nil
|
||||
end
|
||||
branch_name = "cscf_int_" + wp + "_compint"
|
||||
|
||||
begin
|
||||
puts key + " # Error creating gerrit branch: " + branch_name
|
||||
$code = 1
|
||||
next
|
||||
end unless $store.transaction do
|
||||
begin
|
||||
$store[key][:gerrit_created] = gerrit_client.create_new_git_branch branch_name
|
||||
end unless $store[key][:gerrit_created]
|
||||
$store[key][:gerrit_created]
|
||||
end
|
||||
|
||||
begin
|
||||
puts key + " # Error creating jenkins job"
|
||||
$code = 1
|
||||
next
|
||||
end unless $store.transaction do
|
||||
begin
|
||||
$store[key][:jenkins_created] = jenkins_client.create_new_jenkins_jobs branch_name, wp
|
||||
end unless $store[key][:jenkins_created]
|
||||
$store[key][:jenkins_created]
|
||||
end
|
||||
|
||||
begin
|
||||
puts key + " # Error creating WIKI page: " + "CSCF_" + wp.upcase
|
||||
$code = 1
|
||||
next
|
||||
end unless $store.transaction do
|
||||
begin
|
||||
$store[key][:wiki_created] = wiki_client.create_new_wiki_page "CSCF " + wp.upcase, wp, branch_name
|
||||
end unless $store[key][:wiki_created]
|
||||
$store[key][:wiki_created]
|
||||
end
|
||||
|
||||
begin
|
||||
puts key + " # could not add label to the issue"
|
||||
$code = 1
|
||||
end unless jira_client.set_epic_completed(key)
|
||||
end
|
||||
|
||||
exit $code
|
||||
26
gerrit_client.rb
Normal file
26
gerrit_client.rb
Normal file
@ -0,0 +1,26 @@
|
||||
require 'httpclient'
|
||||
require 'json'
|
||||
|
||||
|
||||
class GerritClient
|
||||
|
||||
def initialize(config)
|
||||
@url = config['url']
|
||||
@user = config['user']
|
||||
@pass = config['pass']
|
||||
end
|
||||
|
||||
def create_new_git_branch(branch_name)
|
||||
gerrit = HTTPClient.new
|
||||
gerrit.set_auth(@url, @user, @pass)
|
||||
gerrit.force_basic_auth = true
|
||||
|
||||
begin
|
||||
gerrit_resp = gerrit.put(@url + branch_name, {:revision => 'cscf_int'})
|
||||
gerrit_parsed = JSON.parse(gerrit_resp.body)
|
||||
gerrit_parsed['ref'] == 'refs/head/' + branch_name
|
||||
rescue
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
35
jenkins_client.rb
Normal file
35
jenkins_client.rb
Normal file
@ -0,0 +1,35 @@
|
||||
require 'jenkins_api_client'
|
||||
|
||||
|
||||
class JenkinsClient
|
||||
|
||||
def initialize(config)
|
||||
@url = config['url']
|
||||
@user = config['user']
|
||||
@pass = config['pass']
|
||||
@email = config['email']
|
||||
@job_name = config['jobName']
|
||||
end
|
||||
|
||||
def create_new_jenkins_jobs(branch_name, wp_name)
|
||||
jenkins = JenkinsApi::Client.new(
|
||||
:server_url => @url,
|
||||
:username => @user,
|
||||
:password => @pass
|
||||
)
|
||||
|
||||
job_params = {
|
||||
:GIT_BRANCH => branch_name,
|
||||
:WPRELEASE => wp_name.upcase + "compint",
|
||||
:FEEDBACK_LOOPS => "short,nightly,weekly",
|
||||
:EMAIL_DISTRIBUTION_LIST => @email,
|
||||
:TSP_LOOPS => nil,
|
||||
:INCLUDE_WPTESTS_JOB_TSP => true,
|
||||
:CBA_LOOPS => "cba-git",
|
||||
:INCLUDE_WPTESTS_JOB_CBA => true,
|
||||
:ENABLE_ESM => false,
|
||||
:AM_LOCAL_REPO => ""
|
||||
}
|
||||
jenkins.job.build(@job_name, job_params) < 400
|
||||
end
|
||||
end
|
||||
41
jira_client.rb
Normal file
41
jira_client.rb
Normal file
@ -0,0 +1,41 @@
|
||||
require 'jira-ruby'
|
||||
|
||||
|
||||
class JiraClient
|
||||
|
||||
def initialize(config)
|
||||
@label_name = config['labelName']
|
||||
@jira_filter = sprintf(config['jql'], @label_name)
|
||||
@options = {
|
||||
:username => config['user'],
|
||||
:password => config['pass'],
|
||||
:site => config['url'],
|
||||
:context_path => '',
|
||||
:auth_type => :basic,
|
||||
:use_ssl => true
|
||||
}
|
||||
@max_results = config['maxResults']
|
||||
end
|
||||
|
||||
def query_new_epics
|
||||
jira = JIRA::Client.new(@options)
|
||||
result = []
|
||||
jira.Issue.jql(@jira_filter,
|
||||
fields: %w(summary description),
|
||||
max_results: @max_results
|
||||
).each do |epic|
|
||||
next unless epic.summary.downcase.start_with?("integrate")
|
||||
wp_name = epic.summary.match /^integrate\s+(?:wp)?(.*?)\s*$/i
|
||||
result.push ["wp" + wp_name[1].downcase, epic.key]
|
||||
end
|
||||
result
|
||||
end
|
||||
|
||||
def set_epic_completed(key)
|
||||
jira = JIRA::Client.new(@options)
|
||||
issue = jira.Issue.find(key)
|
||||
labels = issue.labels
|
||||
labels.push(@label_name)
|
||||
issue.save({:fields => {:labels => labels}})
|
||||
end
|
||||
end
|
||||
26
wiki_client.rb
Normal file
26
wiki_client.rb
Normal file
@ -0,0 +1,26 @@
|
||||
require 'mustache'
|
||||
require 'mediawiki_api'
|
||||
|
||||
|
||||
class WikiClient < Mustache
|
||||
|
||||
self.template_file = BASEPATH + '/wiki_template.mustache'
|
||||
|
||||
def initialize(config)
|
||||
@url = config['url']
|
||||
@user = config['user']
|
||||
@pass = config['pass']
|
||||
end
|
||||
|
||||
def create_new_wiki_page(page_name, wp_name, branch_name)
|
||||
begin
|
||||
page_data = self.render({:wp_name => wp_name, :branch_name => branch_name})
|
||||
mediawiki = MediawikiApi::Client.new @url
|
||||
mediawiki.log_in @user, @pass
|
||||
response = mediawiki.create_page page_name, page_data
|
||||
response['result'] == 'Success'
|
||||
rescue
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
66
wiki_template.mustache
Normal file
66
wiki_template.mustache
Normal file
@ -0,0 +1,66 @@
|
||||
== {{wp_name}} CBA COMPONENT INTEGRATION ==
|
||||
|
||||
=== Dates ===
|
||||
* Start: 2018- -
|
||||
* Finished: 2018- -
|
||||
|
||||
=== Stream ===
|
||||
* WP Stream: {{branch_name}}
|
||||
|
||||
=== TR - Trouble Reports reported ===
|
||||
{| class="wikitable sortable"
|
||||
|-
|
||||
! TR ID !! Heading !! Status
|
||||
|-
|
||||
| - || - || -
|
||||
|-
|
||||
|}
|
||||
|
||||
=== Jira Tickets reported ===
|
||||
{| class="wikitable sortable"
|
||||
|-
|
||||
! Jira ID !! Heading !! Status
|
||||
|-
|
||||
| || ||
|
||||
|-
|
||||
|}
|
||||
|
||||
=== Component Integration ===
|
||||
==== CBA Components on the branch (GIT branch: {{branch_name}}) ====
|
||||
{| class="wikitable sortable"
|
||||
|-
|
||||
! Malins/Stigs specification !! Used right now on the branch !! Access to version !! Verified to work !! Status !! TR/Jira-case
|
||||
|-
|
||||
| || || || || || -
|
||||
|-
|
||||
|}
|
||||
|
||||
=== Known issues ===
|
||||
{| class="wikitable sortable"
|
||||
|-
|
||||
! Component !! Issue Description !! Person Analyzing !! Status !! Jira-case / TR
|
||||
|-
|
||||
| || || || ||
|
||||
|-
|
||||
|}
|
||||
==== SS7CAF patch ====
|
||||
SS7CAF needs to be patched to avoid manual steps of package modification during upgrade. <br>
|
||||
A workaround had been introduced by David Haraldsson, this way the patch is automatically applied during the package creation. <br>
|
||||
The patch is stored under /proj/ims-cscf-misc/WP/WP440/WP440L_PATCH/ and is also available under the repository /repo/ss7caf-reboot <br>
|
||||
A new python script “$TOOLS/env/cscf_env_DT/lib/python2.7/cscf/package/patches/ss7caf_upgrade_package_patch.py” is run after the upgrade package is created in “create_tlm_and_upgrade_package_in_ci.py” and in “build_and_package.py”. <br>
|
||||
“$TOOLS/env/cscf_env_DT/lib/python2.7/cscf/package/patches/ss7caf_upgrade_package_patch.py” script contains the SS7CAF version in the following line: <br>
|
||||
self.patch_version="'''5.1.5-10'''"
|
||||
'''If a new SS7CAF version is integrated then this line has to be modified, and the new patch has to be stored as well. <br>'''
|
||||
The reason behind this patch is the SS7CAF has to be upgraded before the reboot of the processors otherwise the diameter links will not come up (See: 3.1.6 in SS7CAF Installation Instructions CPI). <br>
|
||||
Jira ticket describing the fault: [https://cc-jira.rnd.ki.sw.ericsson.se/browse/CC-13934 CC-13934]
|
||||
|
||||
=== PRIs ===
|
||||
|
||||
=== CI - Continuous Integration ===
|
||||
* [https://fem029-eiffel021.rnd.ki.sw.ericsson.se:8443/jenkins/view{{wp_name}}compint/ CI {{wp_name}} COMP]
|
||||
|
||||
=== LSV Plan ===
|
||||
* [http://paipeviewer.lmera.ericsson.se/anatomy/viewer.jsp?file=CSCF/CSCF%2015B.ana LSV Plan]
|
||||
|
||||
=== Veckans Leveranser / Weekly Delivery ===
|
||||
* [https://erilink.ericsson.se/eridoc/erl/objectId/09004cff87219835?docno=1/00671-FCP1306259Uen&action=current&format=excel8book Veckans Leveranser]
|
||||
Loading…
x
Reference in New Issue
Block a user