helm_upgrade_logs 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 03d66d3fdf47a4aae5deb85be2a8cc92e1200cb3f60131fecdcbe3fb33cb43d9
4
+ data.tar.gz: c31926d9fbcac2ee28fc937c2fe208fe072bb731499e4b64a01f5802200c05b3
5
+ SHA512:
6
+ metadata.gz: '007387a207d2fc14adaf5880df0d8f5032a261749c10144bf01484446215d0ae870b15d8d419f441c938047a2ffbe2bcc8a47dba8814fe87f9e3e20ea0d14e4a'
7
+ data.tar.gz: 34b7484eb88b14dd33ee250afc2dc5eddf1f4c5fa8c2c1762f93acd1e3a7857354e57dcb92d1c94961f6e4b3a089063f0146570729b251aa921458bcf1a42659
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ Gemfile.lock
data/.gitlab-ci.yml ADDED
@@ -0,0 +1,9 @@
1
+ image: ruby:3.0.0
2
+
3
+ before_script:
4
+ - gem install bundler -v 2.2.11
5
+ - bundle install
6
+
7
+ example_job:
8
+ script:
9
+ - bundle exec rake
@@ -0,0 +1,32 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared />
5
+ </component>
6
+ <component name="NewModuleRootManager">
7
+ <content url="file://$MODULE_DIR$">
8
+ <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
9
+ <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
10
+ <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
11
+ </content>
12
+ <orderEntry type="jdk" jdkName="RVM: ruby-3.0.0" jdkType="RUBY_SDK" />
13
+ <orderEntry type="sourceFolder" forTests="false" />
14
+ <orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, RVM: ruby-3.0.0) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.5.0, RVM: ruby-3.0.0) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="parallel (v1.21.0, RVM: ruby-3.0.0) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="parser (v3.1.0.0, RVM: ruby-3.0.0) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, RVM: ruby-3.0.0) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, RVM: ruby-3.0.0) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.2.0, RVM: ruby-3.0.0) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.5, RVM: ruby-3.0.0) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.10.0, RVM: ruby-3.0.0) [gem]" level="application" />
23
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.10.1, RVM: ruby-3.0.0) [gem]" level="application" />
24
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.10.1, RVM: ruby-3.0.0) [gem]" level="application" />
25
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.10.2, RVM: ruby-3.0.0) [gem]" level="application" />
26
+ <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.10.3, RVM: ruby-3.0.0) [gem]" level="application" />
27
+ <orderEntry type="library" scope="PROVIDED" name="rubocop (v1.24.1, RVM: ruby-3.0.0) [gem]" level="application" />
28
+ <orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.15.1, RVM: ruby-3.0.0) [gem]" level="application" />
29
+ <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.11.0, RVM: ruby-3.0.0) [gem]" level="application" />
30
+ <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.1.0, RVM: ruby-3.0.0) [gem]" level="application" />
31
+ </component>
32
+ </module>
data/.idea/misc.xml ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="JavaScriptSettings">
4
+ <option name="languageLevel" value="ES6" />
5
+ </component>
6
+ <component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-2.6.3" project-jdk-type="RUBY_SDK" />
7
+ </project>
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/helm_upgrade_logs.iml" filepath="$PROJECT_DIR$/.idea/helm_upgrade_logs.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,78 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ChangeListManager">
4
+ <list default="true" id="da917fa3-f5ef-4365-9d07-5ed3fa5f86fb" name="Default Changelist" comment="">
5
+ <change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
6
+ <change beforePath="$PROJECT_DIR$/.idea/helm_upgrade_logs.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/helm_upgrade_logs.iml" afterDir="false" />
7
+ <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
8
+ <change beforePath="$PROJECT_DIR$/helm_upgrade_logs.gemspec" beforeDir="false" afterPath="$PROJECT_DIR$/helm_upgrade_logs.gemspec" afterDir="false" />
9
+ <change beforePath="$PROJECT_DIR$/spec/helm_upgrade_logs_spec.rb" beforeDir="false" afterPath="$PROJECT_DIR$/spec/helm_upgrade_logs_spec.rb" afterDir="false" />
10
+ </list>
11
+ <option name="SHOW_DIALOG" value="false" />
12
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
13
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
14
+ <option name="LAST_RESOLUTION" value="IGNORE" />
15
+ </component>
16
+ <component name="Git.Settings">
17
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
18
+ </component>
19
+ <component name="ProjectId" id="27mcv3bOSxXTerfL7qGu8qJxnE6" />
20
+ <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
21
+ <component name="ProjectViewState">
22
+ <option name="hideEmptyMiddlePackages" value="true" />
23
+ <option name="showExcludedFiles" value="true" />
24
+ <option name="showLibraryContents" value="true" />
25
+ </component>
26
+ <component name="PropertiesComponent">
27
+ <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
28
+ <property name="WebServerToolWindowFactoryState" value="false" />
29
+ </component>
30
+ <component name="ServiceViewManager">
31
+ <option name="viewStates">
32
+ <list>
33
+ <serviceView>
34
+ <treeState>
35
+ <expand />
36
+ <select />
37
+ </treeState>
38
+ </serviceView>
39
+ </list>
40
+ </option>
41
+ </component>
42
+ <component name="SpringUtil" SPRING_PRE_LOADER_OPTION="true" RAKE_SPRING_PRE_LOADER_OPTION="true" RAILS_SPRING_PRE_LOADER_OPTION="true" />
43
+ <component name="SvnConfiguration">
44
+ <configuration />
45
+ </component>
46
+ <component name="TaskManager">
47
+ <task active="true" id="Default" summary="Default task">
48
+ <changelist id="da917fa3-f5ef-4365-9d07-5ed3fa5f86fb" name="Default Changelist" comment="" />
49
+ <created>1649928928769</created>
50
+ <option name="number" value="Default" />
51
+ <option name="presentableId" value="Default" />
52
+ <updated>1649928928769</updated>
53
+ <workItem from="1649928930827" duration="666000" />
54
+ </task>
55
+ <servers />
56
+ </component>
57
+ <component name="TypeScriptGeneratedFilesManager">
58
+ <option name="version" value="1" />
59
+ </component>
60
+ <component name="WindowStateProjectService">
61
+ <state width="1398" height="318" key="GridCell.Tab.0.bottom" timestamp="1649928978709">
62
+ <screen x="0" y="0" width="1440" height="900" />
63
+ </state>
64
+ <state width="1398" height="318" key="GridCell.Tab.0.bottom/0.0.1440.900@0.0.1440.900" timestamp="1649928978709" />
65
+ <state width="1398" height="318" key="GridCell.Tab.0.center" timestamp="1649928978707">
66
+ <screen x="0" y="0" width="1440" height="900" />
67
+ </state>
68
+ <state width="1398" height="318" key="GridCell.Tab.0.center/0.0.1440.900@0.0.1440.900" timestamp="1649928978707" />
69
+ <state width="1398" height="318" key="GridCell.Tab.0.left" timestamp="1649928978706">
70
+ <screen x="0" y="0" width="1440" height="900" />
71
+ </state>
72
+ <state width="1398" height="318" key="GridCell.Tab.0.left/0.0.1440.900@0.0.1440.900" timestamp="1649928978706" />
73
+ <state width="1398" height="318" key="GridCell.Tab.0.right" timestamp="1649928978708">
74
+ <screen x="0" y="0" width="1440" height="900" />
75
+ </state>
76
+ <state width="1398" height="318" key="GridCell.Tab.0.right/0.0.1440.900@0.0.1440.900" timestamp="1649928978708" />
77
+ </component>
78
+ </project>
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2022-04-14
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at TODO: Write your email address. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in helm_upgrade_logs.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
11
+
12
+ gem "rubocop", "~> 1.7"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 TODO: Write your name
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # HelmUpgradeLogs
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/helm_upgrade_logs`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'helm_upgrade_logs'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install helm_upgrade_logs
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/helm_upgrade_logs. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/helm_upgrade_logs/blob/master/CODE_OF_CONDUCT.md).
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the HelmUpgradeLogs project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/helm_upgrade_logs/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "helm_upgrade_logs"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,229 @@
1
+ #!/bin/bash
2
+
3
+ set -euo pipefail
4
+
5
+ if [[ -n "${DOTFILES_DEBUG:-}" ]]; then
6
+ set -x
7
+ fi
8
+
9
+ function ensure_path_entry() {
10
+ local entries=("$@")
11
+
12
+ for entry in "${entries[@]}"; do
13
+ if [[ ":${PATH}:" != *":${entry}:"* ]]; then
14
+ export PATH="${entry}:${PATH}"
15
+ fi
16
+ done
17
+ }
18
+
19
+ function log_color() {
20
+ local color_code="$1"
21
+ shift
22
+
23
+ printf "\033[${color_code}m%s\033[0m\n" "$*" >&2
24
+ }
25
+
26
+ function log_red() {
27
+ log_color "0;31" "$@"
28
+ }
29
+
30
+ function log_blue() {
31
+ log_color "0;34" "$@"
32
+ }
33
+
34
+ function log_green() {
35
+ log_color "1;32" "$@"
36
+ }
37
+
38
+ function log_yellow() {
39
+ log_color "1;33" "$@"
40
+ }
41
+
42
+ function log_task() {
43
+ log_blue "🔃" "$@"
44
+ }
45
+
46
+ function log_manual_action() {
47
+ log_red "⚠️" "$@"
48
+ }
49
+
50
+ function log_c() {
51
+ log_yellow "👉" "$@"
52
+ }
53
+
54
+ function c() {
55
+ log_c "$@"
56
+ "$@"
57
+ }
58
+
59
+ function c_exec() {
60
+ log_c "$@"
61
+ exec "$@"
62
+ }
63
+
64
+ function log_error() {
65
+ log_red "❌" "$@"
66
+ }
67
+
68
+ function log_info() {
69
+ log_red "ℹ️" "$@"
70
+ }
71
+
72
+ function error() {
73
+ log_error "$@"
74
+ exit 1
75
+ }
76
+
77
+ function sudo() {
78
+ if ! command sudo --non-interactive true 2>/dev/null; then
79
+ log_manual_action "Root privileges are required, please enter your password below"
80
+ command sudo --validate
81
+ fi
82
+ command sudo "$@"
83
+ }
84
+
85
+ function is_apt_package_installed() {
86
+ local package="$1"
87
+
88
+ dpkg -l "${package}" &>/dev/null
89
+ }
90
+
91
+ function not_during_test() {
92
+ if [[ "${DOTFILES_TEST:-}" == "true" ]]; then
93
+ log_info "Skipping '${*}' because we are in test mode"
94
+ else
95
+ "${@}"
96
+ fi
97
+ }
98
+
99
+ # https://stackoverflow.com/a/53640320/12156188
100
+ function service_exists() {
101
+ local n=$1
102
+ if [[ $(systemctl list-units --all -t service --full --no-legend "$n.service" | sed 's/^\s*//g' | cut -f1 -d' ') == $n.service ]]; then
103
+ return 0
104
+ else
105
+ return 1
106
+ fi
107
+ }
108
+
109
+ ################################################################
110
+ ## ABOVE is script_libray
111
+ ## BELOW is helm install debug
112
+ ################################################################
113
+
114
+ mkdir helm_upgrade_log_tmp
115
+ watching_pods_logs_file=$(mktemp helm_upgrade_log_tmp/helm-upgrade-logs.watching-pods-logs.XXXXXX)
116
+ watching_pods_events_file=$(mktemp helm_upgrade_log_tmp/helm-upgrade-logs.watching-pods-events.XXXXXX)
117
+
118
+ function cleanup() {
119
+ rm -f "${watching_pods_logs_file}" "${watching_pods_events_file}" || true
120
+ jobs -pr | xargs -r kill
121
+ }
122
+
123
+ trap cleanup EXIT
124
+
125
+ function prefix_output() {
126
+ local prefix="$1"
127
+ local color_code="$2"
128
+ shift 2
129
+
130
+ local sed_replace
131
+ sed_replace=$(printf "\033[${color_code}m%s: &\033[0m" "${prefix}")
132
+
133
+ # shellcheck disable=SC2312
134
+ "$@" &> >(sed "s,^.*$,${sed_replace}," >&2)
135
+ }
136
+
137
+ function watch_pods() {
138
+ local release="$1"
139
+
140
+ sleep 3 # Prevent flodding the logs with the initial output
141
+ prefix_output "pods" "1;32" c kubectl get pods \
142
+ --watch \
143
+ --selector "app.kubernetes.io/managed-by=Helm,app.kubernetes.io/instance=${release}"
144
+ }
145
+
146
+ function watch_pod_logs() {
147
+ local pod="$1"
148
+
149
+ if grep -q "^${pod}$" "${watching_pods_logs_file}"; then
150
+ return
151
+ fi
152
+
153
+ echo "${pod}" >>"${watching_pods_logs_file}"
154
+
155
+ prefix_output "pod ${pod} logs" "0;34" c kubectl logs \
156
+ --all-containers \
157
+ --prefix \
158
+ --follow \
159
+ "${pod}" || true
160
+
161
+ # remove from watch list (it may be added again)
162
+ sed -i "/^${pod}$/d" "${watching_pods_logs_file}"
163
+ }
164
+
165
+ function watch_pod_events() {
166
+ local pod="$1"
167
+
168
+ if grep -q "^${pod}$" "${watching_pods_events_file}"; then
169
+ return
170
+ fi
171
+
172
+ echo "${pod}" >>"${watching_pods_events_file}"
173
+
174
+ prefix_output "pod ${pod} events" "0;35" c kubectl get events \
175
+ --watch-only \
176
+ --field-selector involvedObject.name="${pod}" || true
177
+
178
+ # remove from watch list (it may be added again)
179
+ sed -i "/^${pod}$/d" "${watching_pods_events_file}"
180
+ }
181
+
182
+ function watch_pods_logs_and_events() {
183
+ local release="$1"
184
+
185
+ sleep 5 # Prevent flodding the logs with the initial output
186
+ while true; do
187
+ local args=(
188
+ --selector "app.kubernetes.io/managed-by=Helm,app.kubernetes.io/instance=${release}"
189
+ --output jsonpath='{.items[*].metadata.name}'
190
+ )
191
+
192
+ for pod in $(
193
+ kubectl get pods "${args[@]}"
194
+ ); do
195
+ watch_pod_events "${pod}" &
196
+ done
197
+
198
+ for pod in $(
199
+ kubectl get pods \
200
+ --field-selector=status.phase=Running \
201
+ "${args[@]}"
202
+ ); do
203
+ watch_pod_logs "${pod}" &
204
+ done
205
+
206
+ sleep 1
207
+ done
208
+ }
209
+
210
+ function get_first_non_option() {
211
+ for arg in "$@"; do
212
+ if [[ "${arg}" != "-"* ]]; then
213
+ echo "${arg}"
214
+ return
215
+ fi
216
+ done
217
+ }
218
+
219
+ release="$(get_first_non_option "$@")"
220
+
221
+ c helm upgrade "$@" --wait &
222
+ pid="$!"
223
+
224
+ watch_pods "${release}" &
225
+
226
+ watch_pods_logs_and_events "${release}" &
227
+
228
+ wait "${pid}"
229
+ rm -rf helm_upgrade_log_tmp
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/helm_upgrade_logs/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "helm_upgrade_logs"
7
+ spec.version = HelmUpgradeLogs::VERSION
8
+ spec.authors = ["Samuel Garratt"]
9
+ spec.email = ["samuel.garratt@sentify.co"]
10
+
11
+ spec.summary = "Basic wrapper around helm and kubectl to allow easy debugging of a helm release."
12
+ spec.description = "Basic wrapper around helm and kubectl to allow easy debugging of a helm release. All arguments after a usual helm upgrade are used as normal"
13
+ spec.homepage = "https://gitlab.com/samuel-garratt/helm_upgrade_logs"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = "https://gitlab.com/samuel-garratt/helm_upgrade_logs"
19
+ spec.metadata["changelog_uri"] = "https://gitlab.com/samuel-garratt/helm_upgrade_logs/CHANGELOG.md"
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:spec)/}) }
25
+ end
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+
30
+ # Uncomment to register a new dependency of your gem
31
+ # spec.add_dependency "example-gem", "~> 1.0"
32
+
33
+ # For more information and examples about making a new gem, checkout our
34
+ # guide at: https://bundler.io/guides/creating_gem.html
35
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HelmUpgradeLogs
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "helm_upgrade_logs/version"
4
+
5
+ module HelmUpgradeLogs
6
+ class Error < StandardError; end
7
+ # Your code goes here...
8
+ end
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: helm_upgrade_logs
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Samuel Garratt
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-04-14 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Basic wrapper around helm and kubectl to allow easy debugging of a helm
14
+ release. All arguments after a usual helm upgrade are used as normal
15
+ email:
16
+ - samuel.garratt@sentify.co
17
+ executables:
18
+ - helm_upgrade_logs
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - ".gitignore"
23
+ - ".gitlab-ci.yml"
24
+ - ".idea/helm_upgrade_logs.iml"
25
+ - ".idea/misc.xml"
26
+ - ".idea/modules.xml"
27
+ - ".idea/vcs.xml"
28
+ - ".idea/workspace.xml"
29
+ - ".rspec"
30
+ - ".rubocop.yml"
31
+ - CHANGELOG.md
32
+ - CODE_OF_CONDUCT.md
33
+ - Gemfile
34
+ - LICENSE.txt
35
+ - README.md
36
+ - Rakefile
37
+ - bin/console
38
+ - bin/setup
39
+ - exe/helm_upgrade_logs
40
+ - helm_upgrade_logs.gemspec
41
+ - lib/helm_upgrade_logs.rb
42
+ - lib/helm_upgrade_logs/version.rb
43
+ homepage: https://gitlab.com/samuel-garratt/helm_upgrade_logs
44
+ licenses:
45
+ - MIT
46
+ metadata:
47
+ homepage_uri: https://gitlab.com/samuel-garratt/helm_upgrade_logs
48
+ source_code_uri: https://gitlab.com/samuel-garratt/helm_upgrade_logs
49
+ changelog_uri: https://gitlab.com/samuel-garratt/helm_upgrade_logs/CHANGELOG.md
50
+ post_install_message:
51
+ rdoc_options: []
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: 2.4.0
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ requirements: []
65
+ rubygems_version: 3.2.3
66
+ signing_key:
67
+ specification_version: 4
68
+ summary: Basic wrapper around helm and kubectl to allow easy debugging of a helm release.
69
+ test_files: []