k8s-deploy 0.0.5 → 0.0.7

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: 35cae78ec4e070514c4869eb8bc07719fb787b63ccaae938d0dba4bde27c7494
4
- data.tar.gz: 212bb941a2748df27fe127291fee0df739f243e97e026430186d4da2e9707c5d
3
+ metadata.gz: a345347ab6907332733a49948a00b6154d93aad77f083de70ecbacf645c78ecb
4
+ data.tar.gz: 76995aa8e46715a6e30fa6ea7ca97ce83d34a79e1cd5fe5e8c4cd7c7d46ac7f4
5
5
  SHA512:
6
- metadata.gz: 2addd5279671b9d793c1309c637abedb60aa6bad93723ffc88645452fe6600d861936c63e6ac07e266644d0bda42bc4a051008182c26cce962252fe9caffb89c
7
- data.tar.gz: 9b10ef8e12c368faeb792819b8dc9a76b4bf0c9d67b1163285da6411e36519cadf01184e18c9ea4ec68f9feee85b21ef86e91d78abd84ccbfc44c619e80a265e
6
+ metadata.gz: 83a472836394c05f6eea657fbd039ae8cc60945881ef70798564c3f56090b88474929982ed3a4b6fe6163925999e2a4a3be9e75b7a8818fc8aa7aa9365db210a
7
+ data.tar.gz: 988eb884cd4a4c9f603efff3b51a8664bb8383d5c3d9e8dad5dacd286f4d0ece3c37264b1ac8a68a528622145b6f86f7c965a9669a18aee1fc0bf877034a6d8c
data/.editorconfig ADDED
@@ -0,0 +1,12 @@
1
+ # Defines the coding style for different editors and IDEs.
2
+ # http://editorconfig.org
3
+
4
+ root = true
5
+
6
+ [*]
7
+ charset = utf-8
8
+ end_of_line = lf
9
+ insert_final_newline = true
10
+ indent_style = space
11
+ indent_size = 2
12
+ trim_trailing_whitespace = true
data/.overcommit.yml ADDED
@@ -0,0 +1,29 @@
1
+ PreCommit:
2
+ ALL:
3
+ on_warn: fail
4
+ BundleCheck:
5
+ enabled: true
6
+ FileSize:
7
+ enabled: true
8
+ size_limit_bytes: 1_000_000
9
+ ForbiddenBranches:
10
+ enabled: true
11
+ LineEndings:
12
+ enabled: true
13
+ RuboCop:
14
+ enabled: true
15
+ TrailingWhitespace:
16
+ enabled: true
17
+ YamlSyntax:
18
+ enabled: true
19
+
20
+ CommitMsg:
21
+ ALL:
22
+ on_warn: fail
23
+ # Disable some default Overcommit checks to avoid collisions with commitlint.
24
+ TextWidth:
25
+ enabled: false
26
+ CapitalizedSubject:
27
+ enabled: false
28
+ SingleLineSubject:
29
+ enabled: false
data/.rubocop.yml ADDED
@@ -0,0 +1,16 @@
1
+ # We want Exclude directives from different
2
+ # config files to get merged, not overwritten
3
+ inherit_mode:
4
+ merge:
5
+ - Exclude
6
+
7
+ inherit_from:
8
+ # Load configurations
9
+ - .rubocop_todo.yml
10
+
11
+ AllCops:
12
+ NewCops: enable
13
+ TargetRubyVersion: 2.0
14
+
15
+ Layout/LineLength:
16
+ Max: 120
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,29 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 1000000`
3
+ # on 2023-05-04 16:31:35 UTC using RuboCop version 1.50.2.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 3
10
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
11
+ Metrics/AbcSize:
12
+ Exclude:
13
+ - 'lib/k8s-deploy/tasks/deploy.rb'
14
+ - 'lib/k8s-deploy/tasks/status.rb'
15
+
16
+ # Offense count: 4
17
+ # Configuration parameters: CountComments, Max, CountAsOne, AllowedMethods, AllowedPatterns.
18
+ # AllowedMethods: refine
19
+ Metrics/BlockLength:
20
+ Exclude:
21
+ - '**/*.gemspec'
22
+ - 'lib/k8s-deploy/tasks/k8s_deploy.rake'
23
+
24
+ # Offense count: 3
25
+ # Configuration parameters: CountComments, Max, CountAsOne, AllowedMethods, AllowedPatterns.
26
+ Metrics/MethodLength:
27
+ Exclude:
28
+ - 'lib/k8s-deploy/tasks/deploy.rb'
29
+ - 'lib/k8s-deploy/tasks/status.rb'
data/CHANGELOG.md ADDED
@@ -0,0 +1,19 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.0.7] - 2023-05-04
4
+
5
+ ### Added
6
+
7
+ - Chore: Add CHANGELOG.md ([#7](https://github.com/syngenta/k8s-deploy/pull/7)).
8
+
9
+ ## [0.0.6] - 2023-05-04
10
+
11
+ ### Added
12
+
13
+ - Chore: Add Rakefile with common maintaining tasks ([#5](https://github.com/syngenta/k8s-deploy/pull/5)).
14
+ - Chore: Multiple minor updates (rubocop, .devcontainer, etc.) ([#3](https://github.com/syngenta/k8s-deploy/pull/3)).
15
+
16
+ ### Changed
17
+
18
+ - **Breaking**: Remove support for Ruby 1.9. Ruby 2.0 is the new minimum supported version ([#3](https://github.com/syngenta/k8s-deploy/pull/3)).
19
+ - Repository migrated to [syngenta/k8s-deploy](https://github.com/syngenta/k8s-deploy) ([#4](https://github.com/syngenta/k8s-deploy/pull/4)).
@@ -0,0 +1,133 @@
1
+
2
+ # Contributor Covenant Code of Conduct
3
+
4
+ ## Our Pledge
5
+
6
+ We as members, contributors, and leaders pledge to make participation in our
7
+ community a harassment-free experience for everyone, regardless of age, body
8
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
9
+ identity and expression, level of experience, education, socio-economic status,
10
+ nationality, personal appearance, race, caste, color, religion, or sexual
11
+ identity and orientation.
12
+
13
+ We pledge to act and interact in ways that contribute to an open, welcoming,
14
+ diverse, inclusive, and healthy community.
15
+
16
+ ## Our Standards
17
+
18
+ Examples of behavior that contributes to a positive environment for our
19
+ community include:
20
+
21
+ * Demonstrating empathy and kindness toward other people
22
+ * Being respectful of differing opinions, viewpoints, and experiences
23
+ * Giving and gracefully accepting constructive feedback
24
+ * Accepting responsibility and apologizing to those affected by our mistakes,
25
+ and learning from the experience
26
+ * Focusing on what is best not just for us as individuals, but for the overall
27
+ community
28
+
29
+ Examples of unacceptable behavior include:
30
+
31
+ * The use of sexualized language or imagery, and sexual attention or advances of
32
+ any kind
33
+ * Trolling, insulting or derogatory comments, and personal or political attacks
34
+ * Public or private harassment
35
+ * Publishing others' private information, such as a physical or email address,
36
+ without their explicit permission
37
+ * Other conduct which could reasonably be considered inappropriate in a
38
+ professional setting
39
+
40
+ ## Enforcement Responsibilities
41
+
42
+ Community leaders are responsible for clarifying and enforcing our standards of
43
+ acceptable behavior and will take appropriate and fair corrective action in
44
+ response to any behavior that they deem inappropriate, threatening, offensive,
45
+ or harmful.
46
+
47
+ Community leaders have the right and responsibility to remove, edit, or reject
48
+ comments, commits, code, wiki edits, issues, and other contributions that are
49
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
50
+ decisions when appropriate.
51
+
52
+ ## Scope
53
+
54
+ This Code of Conduct applies within all community spaces, and also applies when
55
+ an individual is officially representing the community in public spaces.
56
+ Examples of representing our community include using an official e-mail address,
57
+ posting via an official social media account, or acting as an appointed
58
+ representative at an online or offline event.
59
+
60
+ ## Enforcement
61
+
62
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
63
+ reported to the community leaders responsible for enforcement at
64
+ ospo@syngenta.com.
65
+ All complaints will be reviewed and investigated promptly and fairly.
66
+
67
+ All community leaders are obligated to respect the privacy and security of the
68
+ reporter of any incident.
69
+
70
+ ## Enforcement Guidelines
71
+
72
+ Community leaders will follow these Community Impact Guidelines in determining
73
+ the consequences for any action they deem in violation of this Code of Conduct:
74
+
75
+ ### 1. Correction
76
+
77
+ **Community Impact**: Use of inappropriate language or other behavior deemed
78
+ unprofessional or unwelcome in the community.
79
+
80
+ **Consequence**: A private, written warning from community leaders, providing
81
+ clarity around the nature of the violation and an explanation of why the
82
+ behavior was inappropriate. A public apology may be requested.
83
+
84
+ ### 2. Warning
85
+
86
+ **Community Impact**: A violation through a single incident or series of
87
+ actions.
88
+
89
+ **Consequence**: A warning with consequences for continued behavior. No
90
+ interaction with the people involved, including unsolicited interaction with
91
+ those enforcing the Code of Conduct, for a specified period of time. This
92
+ includes avoiding interactions in community spaces as well as external channels
93
+ like social media. Violating these terms may lead to a temporary or permanent
94
+ ban.
95
+
96
+ ### 3. Temporary Ban
97
+
98
+ **Community Impact**: A serious violation of community standards, including
99
+ sustained inappropriate behavior.
100
+
101
+ **Consequence**: A temporary ban from any sort of interaction or public
102
+ communication with the community for a specified period of time. No public or
103
+ private interaction with the people involved, including unsolicited interaction
104
+ with those enforcing the Code of Conduct, is allowed during this period.
105
+ Violating these terms may lead to a permanent ban.
106
+
107
+ ### 4. Permanent Ban
108
+
109
+ **Community Impact**: Demonstrating a pattern of violation of community
110
+ standards, including sustained inappropriate behavior, harassment of an
111
+ individual, or aggression toward or disparagement of classes of individuals.
112
+
113
+ **Consequence**: A permanent ban from any sort of public interaction within the
114
+ community.
115
+
116
+ ## Attribution
117
+
118
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119
+ version 2.1, available at
120
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
121
+
122
+ Community Impact Guidelines were inspired by
123
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
124
+
125
+ For answers to common questions about this code of conduct, see the FAQ at
126
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
127
+ [https://www.contributor-covenant.org/translations][translations].
128
+
129
+ [homepage]: https://www.contributor-covenant.org
130
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
131
+ [Mozilla CoC]: https://github.com/mozilla/diversity
132
+ [FAQ]: https://www.contributor-covenant.org/faq
133
+ [translations]: https://www.contributor-covenant.org/translations
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,63 @@
1
+ # Contributing
2
+
3
+ - [Introduction](#introduction)
4
+ - [Reporting issues](#reporting-issues)
5
+ - [Contributing to code](#contributing-to-code)
6
+ - [Workflow for local development](#workflow-for-local-development)
7
+ - [Workflow for GitHub Codespaces in-browser development](#workflow-for-github-codespaces-in-browser-development)
8
+ - [About using VSCode](#about-using-vscode)
9
+
10
+ ## Introduction
11
+
12
+ Contribution is welcome!
13
+
14
+ This project adheres to the [Code of Conduct](CODE_OF_CONDUCT.md). We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
15
+
16
+ ## Reporting issues
17
+
18
+ Please, report any issues or bugs you find in the project's [Issues](https://github.com/syngenta/k8s-deploy/issues) section on GitHub.
19
+
20
+ ## Contributing to code
21
+
22
+ ### Workflow for local development
23
+
24
+ 1. [Fork the repo](https://docs.github.com/en/get-started/quickstart/fork-a-repo#forking-a-repository).
25
+ 2. [Clone the forked repo](https://docs.github.com/en/get-started/quickstart/fork-a-repo#cloning-your-forked-repository) to your local machine.
26
+ 3. Create a new branch for your changes:
27
+ `git checkout -b "feat/my-new-feature"`.
28
+ 4. Make your changes. We recommend using [VSCode + Docker](#about-using-vscode) locally.
29
+ 5. Commit your changes:
30
+ `git commit -m "feat: my new feature"`.
31
+ 6. Push your changes to your forked repo:
32
+ `git push origin feat/my-new-feature`.
33
+ 7. [Create a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork) from your forked repo to the main repo.
34
+
35
+ ### Workflow for GitHub Codespaces in-browser development
36
+
37
+ 1. [Fork the repo](https://docs.github.com/en/get-started/quickstart/fork-a-repo#forking-a-repository).
38
+ 2. Open Codespaces by clicking the green button **Code** on the top right corner of the repo and then **Open with Codespaces**.
39
+ GitHub Codespaces will create and open a full-featured dev environment in the browser. You don't need to install anything locally.
40
+ 3. Create a new branch for your changes:
41
+ `git checkout -b "feat/my-new-feature"`
42
+ 4. Make your changes.
43
+ 5. Commit your changes:
44
+ `git commit -m "feat: my new feature"`
45
+ 6. Push your changes to your forked repo:
46
+ `git push origin feat/my-new-feature`
47
+ 7. [Create a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork) from your forked repo to the main repo.
48
+
49
+ ### About using VSCode
50
+
51
+ The recommended way for local development is to use VSCode + Docker Desktop.
52
+
53
+ - [VSCode](https://code.visualstudio.com/)
54
+ - [Docker Desktop](https://www.docker.com/)
55
+
56
+ VSCode supports `.devcontainer` configuration that will automatically build a full-featured dev environment for you. All plugins and hooks are already configured for you.
57
+
58
+ ```shell
59
+ git clone git@github.com:syngenta/k8s-deploy.git
60
+ cd k8s-deploy
61
+
62
+ code .
63
+ ```
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Gem's dependencies are in k8s-deploy.gemspec.
6
+ gemspec
7
+
8
+ group :development do
9
+ gem 'overcommit', '0.60.0'
10
+ gem 'rubocop', '1.50.2'
11
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright © 2016 Oleksii Leonov.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,19 +1,28 @@
1
- K8s deploy
2
- =============
1
+ # k8s-deploy — automate deployments to Google Kubernetes Engine
3
2
 
4
- Introduction
5
- ------------
3
+ - [Introduction](#introduction)
4
+ - [Installation](#installation)
5
+ - [Configuration](#configuration)
6
+ - [Tasks](#tasks)
7
+ - [Contributing](#contributing)
8
+ - [License](#license)
6
9
 
7
- :bomb: **Important — this gem is not production ready.**
10
+ ## Introduction
8
11
 
9
- This gem provides bunch of useful **Rake** tasks to automate deploy to Kubernetes cluster in Google Container Engine.
12
+ This gem provides a bunch of useful **Rake** tasks to automate deployment to the Kubernetes cluster in Google Kubernetes Engine (GKE):
10
13
 
11
- Installation
12
- ------------
14
+ - Show configuration for the environment.
15
+ - Show the status of running Deployment & Pods.
16
+ - Check GCloud/K8s configuration and GIT (branch, uncommitted changes, etc.).
17
+ - Build a new Docker image, push it to the registry, and patch Deployment.
18
+ - Rollback Deployment to the previous state.
19
+ - Scale Deployment to the desired number of replicas.
20
+
21
+ ## Installation
13
22
 
14
23
  ### Bundler
15
24
 
16
- Add gem to your Gemfile:
25
+ Add the gem to your Gemfile:
17
26
 
18
27
  ```ruby
19
28
  gem 'k8s-deploy'
@@ -23,18 +32,17 @@ gem 'k8s-deploy'
23
32
 
24
33
  Invoke the following command from your terminal:
25
34
 
26
- ```bash
35
+ ```shell
27
36
  gem install k8s-deploy
28
37
  ```
29
38
 
30
- Configuration
31
- -------------
39
+ ## Configuration
32
40
 
33
- 1. You need to put `k8s-deploy.yml` file into your project root.
34
- 2. Add `require 'k8s-deploy/tasks'` to your Rakefile.
41
+ 1. Put the `k8s-deploy.yml` configuration file into your project root.
42
+ 2. Add `require 'k8s-deploy/tasks'` line to your Rakefile.
35
43
  3. Check available tasks with `rake -T` command.
36
44
 
37
- ##### Example of k8s-deploy.yml
45
+ ### Example of k8s-deploy.yml
38
46
 
39
47
  ```yml
40
48
  production: # environment name
@@ -51,15 +59,15 @@ production: # environment name
51
59
 
52
60
  You could add as many environments as you need (production, staging, test, etc.) to `k8s-deploy.yml`.
53
61
 
54
- ##### Example of Rakefile
62
+ ### Example of Rakefile file
55
63
 
56
64
  ```ruby
57
65
  require 'k8s-deploy/tasks'
58
66
  ```
59
67
 
60
- ##### Example of `rake -T` output
68
+ ### Example of `rake -T` output
61
69
 
62
- ```bash
70
+ ```shell
63
71
  rake k8s:production:check # Check production ready for deploy
64
72
  rake k8s:production:check:gcloud # Check production GCloud
65
73
  rake k8s:production:check:git # Check production GIT
@@ -76,48 +84,60 @@ rake k8s:production:status:docker_image # Show production K8s Deployme
76
84
  rake k8s:production:status:pods # Show production K8s Pods status
77
85
  ```
78
86
 
79
- Tasks
80
- -------------
87
+ ## Tasks
81
88
 
82
89
  All tasks have next structure:
83
90
 
84
- ```bash
91
+ ```shell
85
92
  rake k8s:<environment>:<main-task>:<sub-task>
86
93
  ```
87
94
 
88
95
  ### Main tasks
89
96
 
90
- Show configuration for environment:
91
- ```bash
97
+ Show configuration for the environment:
98
+
99
+ ```shell
92
100
  rake k8s:<environment>:configuration
93
101
  ```
94
102
 
95
- Show status of running Deployment & Pods:
96
- ```bash
103
+ Show the status of running Deployment & Pods:
104
+
105
+ ```shell
97
106
  rake k8s:<environment>:status
98
107
  ```
99
108
 
100
109
  Check GCloud/K8s configuration and GIT (branch, uncommitted changes, etc.):
101
- ```bash
110
+
111
+ ```shell
102
112
  rake k8s:<environment>:check
103
113
  ```
104
114
 
105
- Build new Docker image, push to registry, patch Deployment:
106
- ```bash
115
+ Build a new Docker image, push it to the registry, and patch Deployment:
116
+
117
+ ```shell
107
118
  rake k8s:<environment>:deploy
108
119
  ```
109
120
 
110
- Rollback Deployment to previous state.
111
- ```bash
121
+ Rollback Deployment to the previous state.
122
+
123
+ ```shell
112
124
  rake k8s:<environment>:rollback
113
125
  ```
114
126
 
115
- Scale Deployment to desired number of replicas.
116
- ```bash
127
+ Scale Deployment to the desired number of replicas.
128
+
129
+ ```shell
117
130
  rake k8s:<environment>:scale[1]
118
131
  ```
119
132
 
120
- License
121
- -------
133
+ ## Contributing
134
+
135
+ Bug reports and pull requests are welcome on GitHub at [https://github.com/syngenta/k8s-deploy](https://github.com/syngenta/k8s-deploy).
136
+
137
+ Please, check our [Contribution guide](CONTRIBUTING.md) for more details.
138
+
139
+ This project adheres to the [Code of Conduct](CODE_OF_CONDUCT.md). We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
140
+
141
+ ## License
122
142
 
123
- The project uses the MIT License. See LICENSE.md for details.
143
+ The project uses the MIT License. See [LICENSE](LICENSE) for details.
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rubocop/rake_task'
5
+
6
+ RuboCop::RakeTask.new
7
+
8
+ task default: %i[rubocop]
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  def print_git_check_branch(configuration)
2
4
  conf_branch = configuration['git_branch']
3
5
  local_branch = `git rev-parse --abbrev-ref HEAD`.strip
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  CONFIGURATION_OPTIONS = {
2
4
  'git_branch' => 'GIT branch',
3
5
  'dockerfile' => 'Path to Dockerfile',
@@ -13,10 +15,10 @@ CONFIGURATION_OPTIONS = {
13
15
  def validate_configuration(configuration)
14
16
  missed_parameters = CONFIGURATION_OPTIONS.keys - configuration.keys
15
17
 
16
- unless missed_parameters.empty?
17
- params_string = missed_parameters.join(', ')
18
- raise "Missed parameters in configuration: #{params_string}."
19
- end
18
+ return if missed_parameters.empty?
19
+
20
+ params_string = missed_parameters.join(', ')
21
+ raise "Missed parameters in configuration: #{params_string}."
20
22
  end
21
23
 
22
24
  def print_configuration(configuration)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  DELIMITER_WIDTH = 80
2
4
 
3
5
  CONSOLE_COLORS = {
@@ -10,6 +12,7 @@ CONSOLE_COLORS = {
10
12
  # colorizing output
11
13
  def color_output(color)
12
14
  raise 'Wrong color name' unless CONSOLE_COLORS.key?(color)
15
+
13
16
  CONSOLE_COLORS[color] + yield.to_s + CONSOLE_COLORS[:no_color]
14
17
  end
15
18
 
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  def build_timestamp
2
4
  CURRENT_TIME.strftime('%Y%m%d%H%M%S')
3
5
  end
4
6
 
5
7
  def build_tag_name(git_hash)
6
- build_timestamp + '-' + git_hash
8
+ "#{build_timestamp}-#{git_hash}"
7
9
  end
8
10
 
9
11
  def get_git_hash(configuration)
@@ -91,16 +93,15 @@ def print_deploy_deployment_patch(configuration)
91
93
 
92
94
  print color_output(:yellow) { 'Confirm deploy (y/N): ' }
93
95
 
94
- case STDIN.gets.strip
96
+ puts
97
+ case $stdin.gets.strip
95
98
  when 'Y', 'y', 'Yes', 'yes'
96
- puts
97
99
  puts color_output(:green) { 'Starting deploy...' }
98
100
  system command
99
101
  puts
100
102
  puts 'Now you can check deploy status with ' \
101
103
  "#{color_output(:yellow) { 'status' }} command."
102
104
  else
103
- puts
104
105
  puts color_output(:red) { 'Deploy terminated.' }
105
106
  exit 1
106
107
  end
@@ -1,15 +1,17 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yaml'
2
4
  require 'json'
3
5
  require 'time'
4
6
 
5
- require_relative 'console_formatters.rb'
6
- require_relative 'configuration.rb'
7
- require_relative 'status.rb'
8
- require_relative 'check.rb'
9
- require_relative 'deploy.rb'
7
+ require_relative 'console_formatters'
8
+ require_relative 'configuration'
9
+ require_relative 'status'
10
+ require_relative 'check'
11
+ require_relative 'deploy'
10
12
 
11
13
  # Configuration file path
12
- CONFIGURATION_FILE = 'k8s-deploy.yml'.freeze
14
+ CONFIGURATION_FILE = 'k8s-deploy.yml'
13
15
 
14
16
  # Get start time
15
17
  CURRENT_TIME = Time.now.utc
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  def print_deployment_status(configuration)
2
4
  deployment_name = configuration['kubernetes_deployment_name']
3
5
 
@@ -57,7 +59,7 @@ def print_docker_image_status(configuration)
57
59
 
58
60
  puts
59
61
  begin
60
- time_utc = Time.strptime(timestamp + ' UTC', '%Y%m%d%H%M%S %Z')
62
+ time_utc = Time.strptime("#{timestamp} UTC", '%Y%m%d%H%M%S %Z')
61
63
  puts "Timestamp:\t#{color_output(:green) { timestamp }}"
62
64
  puts "Time (UTC):\t#{time_utc}"
63
65
  puts "Time (local):\t#{time_utc.getlocal}"
@@ -1,10 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rake'
2
4
 
3
5
  module K8sDeploy
6
+ # Rake tasks
4
7
  class Tasks
5
8
  include Rake::DSL if defined? Rake::DSL
6
9
  def install_tasks
7
- load 'k8s-deploy/tasks/k8s-deploy.rake'
10
+ load 'k8s-deploy/tasks/k8s_deploy.rake'
8
11
  end
9
12
  end
10
13
  end
@@ -1,7 +1,8 @@
1
- ##
1
+ # frozen_string_literal: true
2
+
2
3
  # Defines version.
3
4
  class K8sDeploy
4
5
  ##
5
6
  # @return [String] the library version
6
- VERSION = '0.0.5'.freeze
7
+ VERSION = '0.0.7'
7
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: k8s-deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleksii Leonov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-06 00:00:00.000000000 Z
11
+ date: 2023-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -24,28 +24,46 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.8.2
27
- description: automate deploy to Kubernetes.
28
- email: mail@aleksejleonov.com
27
+ description: Automate deployments to Google Kubernetes Engine (GKE)
28
+ email:
29
+ - mail@oleksiileonov.com
30
+ - oleksii.leonov@syngenta.com
31
+ - ospo@syngenta.com
29
32
  executables: []
30
33
  extensions: []
31
- extra_rdoc_files: []
34
+ extra_rdoc_files:
35
+ - LICENSE
36
+ - README.md
32
37
  files:
33
- - ".gitignore"
34
- - LICENSE.md
38
+ - ".editorconfig"
39
+ - ".overcommit.yml"
40
+ - ".rubocop.yml"
41
+ - ".rubocop_todo.yml"
42
+ - CHANGELOG.md
43
+ - CODE_OF_CONDUCT.md
44
+ - CONTRIBUTING.md
45
+ - Gemfile
46
+ - LICENSE
35
47
  - README.md
36
- - k8s-deploy.gemspec
48
+ - Rakefile
37
49
  - lib/k8s-deploy/tasks.rb
38
50
  - lib/k8s-deploy/tasks/check.rb
39
51
  - lib/k8s-deploy/tasks/configuration.rb
40
52
  - lib/k8s-deploy/tasks/console_formatters.rb
41
53
  - lib/k8s-deploy/tasks/deploy.rb
42
- - lib/k8s-deploy/tasks/k8s-deploy.rake
54
+ - lib/k8s-deploy/tasks/k8s_deploy.rake
43
55
  - lib/k8s-deploy/tasks/status.rb
44
56
  - lib/k8s-deploy/version.rb
45
- homepage: https://github.com/cropio/k8s-deploy
57
+ homepage: https://github.com/syngenta/k8s-deploy
46
58
  licenses:
47
59
  - MIT
48
- metadata: {}
60
+ metadata:
61
+ homepage_uri: https://github.com/syngenta/k8s-deploy
62
+ changelog_uri: https://github.com/syngenta/k8s-deploy/blob/main/CHANGELOG.md
63
+ source_code_uri: https://github.com/syngenta/k8s-deploy
64
+ documentation_uri: https://github.com/syngenta/k8s-deploy
65
+ bug_tracker_uri: https://github.com/syngenta/k8s-deploy/issues
66
+ rubygems_mfa_required: 'true'
49
67
  post_install_message:
50
68
  rdoc_options: []
51
69
  require_paths:
@@ -54,15 +72,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
54
72
  requirements:
55
73
  - - ">="
56
74
  - !ruby/object:Gem::Version
57
- version: 1.9.1
75
+ version: 2.0.0
58
76
  required_rubygems_version: !ruby/object:Gem::Requirement
59
77
  requirements:
60
78
  - - ">="
61
79
  - !ruby/object:Gem::Version
62
80
  version: '0'
63
81
  requirements: []
64
- rubygems_version: 3.0.3.1
82
+ rubygems_version: 3.4.10
65
83
  signing_key:
66
84
  specification_version: 4
67
- summary: automate deploy to Kubernetes.
85
+ summary: k8s-deploy — automate deployments to Google Kubernetes Engine
68
86
  test_files: []
data/.gitignore DELETED
@@ -1,13 +0,0 @@
1
- # MacOS files
2
- .DS_Store
3
- .AppleDouble
4
- .LSOverride
5
- ._*
6
- .Spotlight-V100
7
- .Trashes
8
-
9
- # Project
10
- Gemfile.lock
11
- .bundle
12
- doc
13
- .yardoc
data/LICENSE.md DELETED
@@ -1,21 +0,0 @@
1
- The MIT License
2
- ===============
3
-
4
- Copyright © 2016 Oleksii Leonov.
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy of
7
- this software and associated documentation files (the 'Software'), to deal in
8
- the Software without restriction, including without limitation the rights to
9
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10
- the Software, and to permit persons to whom the Software is furnished to do so,
11
- subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in all
14
- copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/k8s-deploy.gemspec DELETED
@@ -1,19 +0,0 @@
1
- require File.expand_path('../lib/k8s-deploy/version', __FILE__)
2
-
3
- Gem::Specification.new do |s|
4
- s.name = 'k8s-deploy'
5
- s.version = K8sDeploy::VERSION.dup
6
- s.date = Time.now.strftime('%Y-%m-%d')
7
- s.platform = Gem::Platform::RUBY
8
- s.author = 'Oleksii Leonov'
9
- s.email = 'mail@aleksejleonov.com'
10
- s.homepage = 'https://github.com/cropio/k8s-deploy'
11
- s.summary = 'automate deploy to Kubernetes.'
12
- s.description = 'automate deploy to Kubernetes.'
13
- s.license = 'MIT'
14
-
15
- s.required_ruby_version = '>= 1.9.1'
16
- s.add_dependency 'rake', '>= 0.8.2'
17
-
18
- s.files = `git ls-files`.split("\n")
19
- end