pipedawg 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pipedawg/helm_copy_job.rb +11 -3
- data/lib/pipedawg/kaniko_job.rb +15 -8
- data/lib/pipedawg/util.rb +43 -0
- data/lib/pipedawg/version.rb +1 -1
- data/lib/pipedawg.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 064c29963799087a56d2cde36f785bc9762cd50870dc9eeede4f9efbfc577f0f
|
4
|
+
data.tar.gz: fd51dfa82c3d16c215f284dfd7c84c5600906738fef8d6f6b0d69b22e967af33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7241f30f45d72d1d43e03ef7b007c24756b1a16c483f605c179a02eb02c89b900926fd20c93502fbc94585cc9f1fa94ba41fefa27cabf497568b05ff252a75e
|
7
|
+
data.tar.gz: 7c72d19557c1f449dd56315465d1f22d66277005dfb39c59a67d83ef5389800511fcbbfc7fae3409f235d66834256d5f9566d63d8610f37b1a718c0d4f99285a
|
@@ -7,7 +7,7 @@ module Pipedawg
|
|
7
7
|
|
8
8
|
def initialize(name = 'build', opts = {}, helm_opts = {})
|
9
9
|
@helm_opts = {
|
10
|
-
chart: name,
|
10
|
+
chart: name, debug: true,
|
11
11
|
destinations: [{ user: nil, password: nil, url: nil }],
|
12
12
|
helm: 'helm',
|
13
13
|
image: { entrypoint: [''], name: 'alpine/helm' },
|
@@ -17,13 +17,21 @@ module Pipedawg
|
|
17
17
|
update
|
18
18
|
end
|
19
19
|
|
20
|
-
def update
|
20
|
+
def update # rubocop:disable Metrics/AbcSize
|
21
21
|
opts[:image] = helm_opts[:image] if helm_opts[:image]
|
22
|
-
opts[:script] =
|
22
|
+
opts[:script] = debug + pull + (helm_opts[:destinations].map { |d| push(d) }).flatten(1)
|
23
23
|
end
|
24
24
|
|
25
25
|
private
|
26
26
|
|
27
|
+
def debug
|
28
|
+
if helm_opts[:debug]
|
29
|
+
Pipedawg::Util.echo_proxy_vars
|
30
|
+
else
|
31
|
+
[]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
27
35
|
def pull
|
28
36
|
case helm_opts[:url]
|
29
37
|
when nil
|
data/lib/pipedawg/kaniko_job.rb
CHANGED
@@ -11,13 +11,12 @@ module Pipedawg
|
|
11
11
|
config: {
|
12
12
|
'$CI_REGISTRY': { username: '$CI_REGISTRY_USER', password: '$CI_REGISTRY_PASSWORD' }
|
13
13
|
},
|
14
|
-
config_file: '/kaniko/.docker/config.json', context: '${CI_PROJECT_DIR}',
|
15
|
-
destinations: [], dockerfile: 'Dockerfile', executor: '/kaniko/executor',
|
16
|
-
|
17
|
-
image: { entrypoint: [''], name: 'gcr.io/kaniko-project/executor:debug' },
|
18
|
-
|
19
|
-
|
20
|
-
trusted_ca_cert_target_file: '/kaniko/ssl/certs/ca-certificates.crt'
|
14
|
+
config_file: '/kaniko/.docker/config.json', context: '${CI_PROJECT_DIR}', debug: true,
|
15
|
+
destinations: [], dockerfile: 'Dockerfile', executor: '/kaniko/executor', external_files: {},
|
16
|
+
flags: [], ignore_paths: [], insecure_registries: [],
|
17
|
+
image: { entrypoint: [''], name: 'gcr.io/kaniko-project/executor:debug' }, options: {},
|
18
|
+
registry_certificates: {}, registry_mirrors: [], skip_tls_verify_registry: [],
|
19
|
+
trusted_ca_cert_source_files: [], trusted_ca_cert_target_file: '/kaniko/ssl/certs/ca-certificates.crt'
|
21
20
|
}.merge(kaniko_opts)
|
22
21
|
super name, opts
|
23
22
|
update
|
@@ -26,11 +25,19 @@ module Pipedawg
|
|
26
25
|
def update # rubocop:disable Metrics/AbcSize
|
27
26
|
require 'json'
|
28
27
|
opts[:image] = kaniko_opts[:image] if kaniko_opts[:image]
|
29
|
-
opts[:script] = config + cert_copies + file_copies + Array(kaniko_cmd)
|
28
|
+
opts[:script] = debug + config + cert_copies + file_copies + Array(kaniko_cmd)
|
30
29
|
end
|
31
30
|
|
32
31
|
private
|
33
32
|
|
33
|
+
def debug
|
34
|
+
if kaniko_opts[:debug]
|
35
|
+
Pipedawg::Util.echo_proxy_vars
|
36
|
+
else
|
37
|
+
[]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
34
41
|
def config
|
35
42
|
["echo #{kaniko_opts[:config].to_json.inspect} > \"#{kaniko_opts[:config_file]}\""]
|
36
43
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Pipedawg
|
4
|
+
# util class
|
5
|
+
class Util
|
6
|
+
def self.expand_env_vars(item) # rubocop:disable Metrics/MethodLength
|
7
|
+
case item
|
8
|
+
when Array
|
9
|
+
item.map { |i| expand_env_vars(i) }
|
10
|
+
when Hash
|
11
|
+
item.each { |k, v| item[k] = expand_env_vars(v) }
|
12
|
+
item
|
13
|
+
when String
|
14
|
+
item.gsub(/\${([^} ]+)}/) do |e|
|
15
|
+
ENV[e.gsub('${', '').gsub('}', '')]
|
16
|
+
end
|
17
|
+
else
|
18
|
+
item
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.puts_proxy_vars
|
23
|
+
puts 'Proxy settings:'
|
24
|
+
puts "http_proxy: #{ENV['http_proxy']}"
|
25
|
+
puts "https_proxy: #{ENV['https_proxy']}"
|
26
|
+
puts "no_proxy: #{ENV['no_proxy']}"
|
27
|
+
puts "HTTP_PROXY: #{ENV['HTTP_PROXY']}"
|
28
|
+
puts "HTTPS_PROXY: #{ENV['HTTPS_PROXY']}"
|
29
|
+
puts "NO_PROXY: #{ENV['NO_PROXY']}"
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.echo_proxy_vars
|
33
|
+
script = ['echo Proxy settings:']
|
34
|
+
script << 'echo http_proxy: "${http_proxy}"'
|
35
|
+
script << 'echo https_proxy: "${https_proxy}"'
|
36
|
+
script << 'echo no_proxy: "${no_proxy}"'
|
37
|
+
script << 'echo HTTP_PROXY: "${HTTP_PROXY}"'
|
38
|
+
script << 'echo HTTPS_PROXY: "${HTTPS_PROXY}"'
|
39
|
+
script << 'echo NO_PROXY: "${NO_PROXY}"'
|
40
|
+
script
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/pipedawg/version.rb
CHANGED
data/lib/pipedawg.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pipedawg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- harbottle
|
@@ -24,6 +24,7 @@ files:
|
|
24
24
|
- lib/pipedawg/job.rb
|
25
25
|
- lib/pipedawg/kaniko_job.rb
|
26
26
|
- lib/pipedawg/pipeline.rb
|
27
|
+
- lib/pipedawg/util.rb
|
27
28
|
- lib/pipedawg/version.rb
|
28
29
|
homepage: https://github.com/liger1978/pipedawg
|
29
30
|
licenses:
|