fire-jenkins-builder 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c4b8133de7c1b2accf52a98c6a00943c411c644d
4
- data.tar.gz: 2e57a5f2bcd607d559fd8aa6230f13d90ff1d13c
3
+ metadata.gz: 55e1cb69b320fcee23c46712810b44dd27824257
4
+ data.tar.gz: 2dd1e4f4bf43d5e096cb08968b17cf87954ed982
5
5
  SHA512:
6
- metadata.gz: 6945e512fe6f5604b7c6e3f26d087dc4c37ccd7c3aedc30e2a2da00deb7962c2fff9cf29109700d77e1eba30259276adfdf504616d8eaf6cf76763d778fde8bf
7
- data.tar.gz: d7de91487dcbcafce5c4f95fd7907d600a906059eea26319fc3b3b292ad05cf55f4b0fb80276b76a03042af04e79061ab0209cea24e8f6c1f3ef7b1602727bd3
6
+ metadata.gz: bcbb90dd04a2cf94790211591d8b4b7143512d34d9e0796f81444989aa59e997eaf3034eaecdb89fcf0122ac4818fb30f5d225b4332fdf3476c3ed3015034db5
7
+ data.tar.gz: a1082d440914e6829df92e550302003010f5d93199903c8c51f81fe5a13b2fe6f92fac877fbd8daa10d636b2cbf5252cea9a19a04b7a5ac8639a42b8a8887e08
data/.fire-jenkins.yml CHANGED
@@ -23,9 +23,17 @@ job_name_prefix: ZGiOS_
23
23
  # jenkins 上的分组,对应 view
24
24
  job_view: 掌柜iOS
25
25
 
26
+ # branch 可以从 CI 变量中拿到,不需要设置
27
+ # branch: feature/jenkins-executer
28
+
29
+ # 下面配置可选
30
+ # 如果没有设置,则采用模版值
31
+ # remote_url: git@git.2dfire-inc.com:ios/restapp.git
32
+ # credentials_id: xxx
33
+
26
34
  # jenkins 用户名密码
27
35
  username: qingmu
28
- password: 1
36
+ password: xxxx
29
37
 
30
38
  # 各业务线采用不同的模版,配置这里
31
39
  # 模版工程名称(需要唯一)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fire-jenkins-builder (0.1.2)
4
+ fire-jenkins-builder (0.1.3)
5
5
  jenkins_api_client
6
6
  nokogiri
7
7
 
@@ -18,13 +18,13 @@ GEM
18
18
  json (2.1.0)
19
19
  mini_portile2 (2.3.0)
20
20
  mixlib-shellout (2.4.0)
21
- nokogiri (1.8.4)
21
+ nokogiri (1.8.5)
22
22
  mini_portile2 (~> 2.3.0)
23
23
  rake (10.5.0)
24
24
  socksify (1.7.1)
25
25
  terminal-table (1.8.0)
26
26
  unicode-display_width (~> 1.1, >= 1.1.1)
27
- thor (0.20.0)
27
+ thor (0.20.3)
28
28
  unicode-display_width (1.4.0)
29
29
 
30
30
  PLATFORMS
data/README.md CHANGED
@@ -54,6 +54,14 @@ job_name_prefix: ZGiOS_
54
54
  # jenkins 上的分组,对应 view
55
55
  job_view: 掌柜iOS
56
56
 
57
+ # branch 可以从 CI 变量中拿到,不需要设置
58
+ # branch: feature/jenkins-executer
59
+
60
+ # 下面配置可选
61
+ # 如果没有设置,则采用模版值
62
+ # remote_url: git@git.2dfire-inc.com:ios/restapp.git
63
+ # credentials_id: xxx
64
+
57
65
  # jenkins 用户名密码
58
66
  username: qingmu
59
67
  password: xxx
@@ -78,7 +86,7 @@ stages:
78
86
  ...
79
87
  jenkins_build:
80
88
  before_script:
81
- - gem install fire-jenkins-builder -v 0.1.1 --no-ri --no-rdoc --conservative
89
+ - gem install fire-jenkins-builder -v 0.1.3 --no-ri --no-rdoc --conservative
82
90
  stage: build
83
91
  only:
84
92
  variables:
data/bin/jb CHANGED
@@ -15,28 +15,29 @@ OptionParser.new do |opts|
15
15
  opts.banner = "jb is a tool to build jenkins job on gitlab CI."
16
16
 
17
17
  opts.on('-p PATH', '--path PATH', 'config file path.') do |value|
18
- options[:path] = value
18
+ options['path'] = value
19
19
  end
20
-
21
- opts.on('-b BRANCH', '--branch BRANCH', 'jenkins branch sprcifier.') do |value|
22
- options[:branch] = value
20
+
21
+ opts.on('-r REMOTE_URL', '--remote-url REMOTE_URL', 'remote url specifier.') do |value|
22
+ options['remote_url'] = value
23
+ end
24
+
25
+ opts.on('-b BRANCH', '--branch BRANCH', 'jenkins branch specifier.') do |value|
26
+ options['branch'] = value
23
27
  end
24
28
 
25
29
  opts.on('-l LOG_LEVEL', '--log_level LOGGER_LEVEL', 'log level of jb.') do |value|
26
- options[:log_level] = value
30
+ options['log_level'] = value
27
31
  end
28
32
  end.parse!
29
33
 
30
- config_path = options[:path]
34
+ config_path = options['path']
31
35
 
32
- raise "必须指定配置文件路径,模版见 git homepage" if config_path.nil? || !File.exist?(config_path)
36
+ raise "必须指定配置文件路径,模版见 README " if config_path.nil? || !File.exist?(config_path)
33
37
 
34
38
  config = YAML.load_file(config_path)
35
39
 
36
- config.merge!({
37
- 'branch' => options[:branch],
38
- 'log_level' => options[:log_level]
39
- })
40
+ config.merge!(options)
40
41
 
41
42
  builder = Fire::Jenkins::Builder::Base.new(config)
42
43
  builder.build
@@ -1,7 +1,7 @@
1
1
  module Fire
2
2
  module Jenkins
3
3
  module Builder
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
6
6
  end
7
7
  end
@@ -11,7 +11,7 @@ module Fire
11
11
  attr_reader :config
12
12
  attr_reader :client
13
13
 
14
- REQUIRED_KEYS = %w[server_url server_port username password template_job_name job_view branch].freeze
14
+ REQUIRED_KEYS = %w[server_url server_port username password template_job_name job_view branch remote_url].freeze
15
15
 
16
16
  def initialize(config)
17
17
  @client = JenkinsApi::Client.new(
@@ -74,6 +74,18 @@ module Fire
74
74
  branch_spec_node = doc.search("//hudson.plugins.git.BranchSpec")
75
75
  branch_node = branch_spec_node.children.find { |c| c.name == 'name' }
76
76
  branch_node.content = config['branch']
77
+
78
+ if config['remote_url']
79
+ user_remote_config_node = doc.search("//hudson.plugins.git.UserRemoteConfig")
80
+ url_node = user_remote_config_node.children.find { |c| c.name == 'url' }
81
+ url_node.content = config['remote_url']
82
+ end
83
+
84
+ if config['credentials_id']
85
+ credentials_id_node = user_remote_config_node.children.find { |c| c.name == 'credentialsId' }
86
+ credentials_id_node.content = config['credentials_id']
87
+ end
88
+
77
89
  doc.to_xml
78
90
  end
79
91
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fire-jenkins-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - tripleCC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-15 00:00:00.000000000 Z
11
+ date: 2018-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri