seira 0.8.2 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0cedfa6841e5eaab7d04673e58182a6eeed7309999ebca2571fba54a2da8379e
4
- data.tar.gz: ac45a36439ed8e56e856f6ecf917d848606b14b85752e034bacd86def1a90241
3
+ metadata.gz: 5308da7fa9f186ee201c09b028df22b1b55adf32908bff5b01af79cbebb5ebb9
4
+ data.tar.gz: 0b51dbcc1ea03797265ec75cae09eeef3a530a4d0822236087fc134c57944d8b
5
5
  SHA512:
6
- metadata.gz: '0946ca82098b4c329f04d91a6b8aefd831baa887ba638712e8779ded8494aac3883c9a09e79c49aa916102a758fab822e89ef42a0ed53a36cf0cb7b1f70bc10b'
7
- data.tar.gz: 9fd9290e4778264498de98cdf37a55fe8bb67cd431c76410c6cc25fe0ea5fef120415a9dad4101fecb6828c1816daab254142b183c47cc41fc135b24a7ef1891
6
+ metadata.gz: 32920e089d26ca317373a577827393fc5ec276b80546cae3cb306606b9f531c51cb9aec818caebe7dfbcbf0d2ede6e71059d5cfaeb127a22d2eef06377c8c493
7
+ data.tar.gz: cba266956e025a7fea94a634f049215304788f3e09ba6880b810fb391653d508fe166249e9a45b97a4567c096386e1d48eb74fc80ef19b3b397418d8bf0f37cd
@@ -0,0 +1,21 @@
1
+ name: Trunk Check
2
+ on: [pull_request]
3
+ concurrency:
4
+ group: ${{ github.head_ref || github.run_id }}
5
+ cancel-in-progress: true
6
+
7
+ permissions: read-all
8
+
9
+ jobs:
10
+ trunk_check:
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ checks: write # For trunk to post annotations
14
+ contents: read # For repo checkout
15
+
16
+ steps:
17
+ - name: Checkout
18
+ uses: actions/checkout@v3
19
+
20
+ - name: Trunk Check
21
+ uses: trunk-io/trunk-action@v1.1.7
data/.trunk/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ *out
2
+ *logs
3
+ *actions
4
+ *notifications
5
+ *tools
6
+ plugins
7
+ user_trunk.yaml
8
+ user.yaml
@@ -0,0 +1,10 @@
1
+ # Autoformatter friendly markdownlint config (all formatting rules disabled)
2
+ default: true
3
+ blank_lines: false
4
+ bullet: false
5
+ html: false
6
+ indentation: false
7
+ line_length: false
8
+ spaces: false
9
+ url: false
10
+ whitespace: false
@@ -0,0 +1,7 @@
1
+ enable=all
2
+ source-path=SCRIPTDIR
3
+ disable=SC2154
4
+
5
+ # If you're having issues with shellcheck following source, disable the errors via:
6
+ # disable=SC1090
7
+ # disable=SC1091
@@ -0,0 +1,10 @@
1
+ rules:
2
+ quoted-strings:
3
+ required: only-when-needed
4
+ extra-allowed: ["{|}"]
5
+ empty-values:
6
+ forbid-in-block-mappings: true
7
+ forbid-in-flow-mappings: true
8
+ key-duplicates: {}
9
+ octal-values:
10
+ forbid-implicit-octal: true
data/.trunk/trunk.yaml ADDED
@@ -0,0 +1,34 @@
1
+ version: 0.1
2
+ cli:
3
+ version: 1.14.1
4
+ plugins:
5
+ sources:
6
+ - id: trunk
7
+ ref: v1.2.1
8
+ uri: https://github.com/trunk-io/plugins
9
+ runtimes:
10
+ enabled:
11
+ - go@1.19.5
12
+ - node@18.12.1
13
+ - python@3.10.8
14
+ - ruby@3.1.4
15
+ lint:
16
+ enabled:
17
+ - actionlint@1.6.25
18
+ - checkov@2.4.6
19
+ - git-diff-check
20
+ - markdownlint@0.35.0
21
+ - prettier@3.0.2
22
+ - shellcheck@0.9.0
23
+ - shfmt@3.6.0
24
+ - trivy@0.44.1
25
+ - trufflehog@3.48.0
26
+ - yamllint@1.32.0
27
+ disabled:
28
+ - rubocop@1.39.0
29
+ actions:
30
+ enabled:
31
+ - trunk-announce
32
+ - trunk-check-pre-push
33
+ - trunk-fmt-pre-commit
34
+ - trunk-upgrade-available
data/lib/seira/pods.rb CHANGED
@@ -70,7 +70,6 @@ module Seira
70
70
  pod_name = pod_name
71
71
  dedicated = false
72
72
  command = 'sh'
73
-
74
73
  args.each do |arg|
75
74
  if arg.start_with? '--tier='
76
75
  tier = arg.split('=')[1]
@@ -181,7 +180,7 @@ module Seira
181
180
 
182
181
  def connect_to_pod(name, command = 'sh')
183
182
  puts "Connecting to #{name}..."
184
- system("kubectl exec -ti #{name} --namespace=#{app} -- #{command}")
183
+ system("kubectl exec -ti #{name} --namespace=#{app} -- #{context[:settings].terminal_prefix(app, context[:cluster])} #{command}")
185
184
  end
186
185
  end
187
186
  end
@@ -94,6 +94,17 @@ module Seira
94
94
  requirements.map { |r| Seira::Teleport::RoleRequirement.new(r) }
95
95
  end
96
96
 
97
+ def terminal_prefix(application, cluster)
98
+ settings['seira']['applications'].each do |app|
99
+ if app['name'] == application
100
+ return app.fetch('terminal_prefix', '') if app['terminal_prefix_envs'].nil?
101
+ return app.fetch('terminal_prefix', '') if app['terminal_prefix_envs'].include? cluster
102
+
103
+ return ''
104
+ end
105
+ end
106
+ end
107
+
97
108
  private
98
109
 
99
110
  def parse_settings
data/lib/seira/version.rb CHANGED
@@ -1,3 +1,4 @@
1
1
  module Seira
2
- VERSION = "0.8.2".freeze
2
+ VERSION = "0.9.0".freeze
3
3
  end
4
+
data/lib/seira.rb CHANGED
@@ -127,7 +127,14 @@ module Seira
127
127
  status = Seira::Teleport::Status.new
128
128
 
129
129
  unless required_roles.empty? || required_roles.any? { |r| status.has_role?(r) }
130
- Seira::Teleport::Request.new(required_roles, reviewer: ENV['TELEPORT_REVIEWER'], context: passed_context).invoke
130
+ reviewer = ENV['TELEPORT_REVIEWER']
131
+ args.each do |arg|
132
+ if arg.start_with? '--reviewer='
133
+ reviewer = arg.split('=')[1]
134
+ end
135
+ end
136
+
137
+ Seira::Teleport::Request.new(required_roles, reviewer: reviewer, context: passed_context).invoke
131
138
  end
132
139
  end
133
140
 
@@ -180,7 +187,9 @@ module Seira
180
187
 
181
188
  # The first arg must always be the cluster. This ensures commands are not run by
182
189
  # accident on the wrong kubernetes cluster or gcloud project.
183
- exit(1) unless Seira::Cluster.new(action: nil, args: nil, context: nil, settings: settings).switch(target_cluster: cluster, verbose: false)
190
+ exit(1) unless Seira::Cluster.new(action: nil, args: nil, context: nil, settings: settings).switch(
191
+ target_cluster: cluster, verbose: false
192
+ )
184
193
  exit(0) if simple_cluster_change?
185
194
  end
186
195
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seira
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Ringwelski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-21 00:00:00.000000000 Z
11
+ date: 2024-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline
@@ -102,13 +102,17 @@ executables:
102
102
  extensions: []
103
103
  extra_rdoc_files: []
104
104
  files:
105
- - ".default-rubocop.yml"
106
105
  - ".github/workflows/ruby.yml"
106
+ - ".github/workflows/trunk.yml"
107
107
  - ".gitignore"
108
108
  - ".hound.yml"
109
109
  - ".rspec"
110
- - ".rubocop.yml"
111
110
  - ".ruby-version"
111
+ - ".trunk/.gitignore"
112
+ - ".trunk/configs/.markdownlint.yaml"
113
+ - ".trunk/configs/.shellcheckrc"
114
+ - ".trunk/configs/.yamllint.yaml"
115
+ - ".trunk/trunk.yaml"
112
116
  - Gemfile
113
117
  - LICENSE
114
118
  - README.md