renuo-cli 2.0.0 → 3.0.0
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 +4 -4
- data/.gitignore +0 -1
- data/lib/renuo/cli/app/configure_semaphore.rb +2 -2
- data/lib/renuo/cli/app/create_aws_project.rb +3 -3
- data/lib/renuo/cli/app/create_heroku_app.rb +4 -7
- data/lib/renuo/cli/app/environments.rb +2 -1
- data/lib/renuo/cli/app/release_project.rb +21 -10
- data/lib/renuo/cli/app/templates/semaphore/bin/cache_restore.erb +10 -10
- data/lib/renuo/cli/app/templates/semaphore/semaphore-deploy.yml.erb +2 -1
- data/lib/renuo/cli/app/templates/semaphore/semaphore.yml.erb +22 -6
- data/lib/renuo/cli/version.rb +1 -1
- data/lib/renuo/cli.rb +4 -5
- data/renuo-cli.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea4e597c6888d4eb5472df3d1fdc496afe3ff1ab16ce2ce9f20602da6c2ccc40
|
4
|
+
data.tar.gz: 3fef697d445ab64c2d62c4adf62d5c4718e56c2243b64237bc3f9cf8e1255b06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f57de9f499fd37447d94675a063e3e2f6eb76d94b7d47c182048036faa92d91b89877beb579683717990f872caba2c4adfddcfc0adc23b79e5e5ff9351584c9
|
7
|
+
data.tar.gz: 28f034598160faef73f8ae55c26f7c3dae0a772e0500498881e56a3ce4d83e32cefecbdb63a18c3205e27f860c42ad79ae248650f071e38b1db98c41d14d9c03
|
data/.gitignore
CHANGED
@@ -15,7 +15,7 @@ class ConfigureSemaphore
|
|
15
15
|
FileUtils.mkdir_p(%w[.semaphore .semaphore/bin])
|
16
16
|
|
17
17
|
write_or_warn('.semaphore/semaphore.yml', render('templates/semaphore/semaphore.yml.erb'))
|
18
|
-
%w[
|
18
|
+
%w[main develop testing].each do |environment|
|
19
19
|
@environment = environment
|
20
20
|
write_or_warn(".semaphore/#{environment}-deploy.yml", render('templates/semaphore/semaphore-deploy.yml.erb'))
|
21
21
|
end
|
@@ -38,7 +38,7 @@ class ConfigureSemaphore
|
|
38
38
|
def create_semaphore_notification
|
39
39
|
system("sem create notifications #{project_name} "\
|
40
40
|
"--projects #{project_name} "\
|
41
|
-
'--branches "
|
41
|
+
'--branches "main,develop,testing" '\
|
42
42
|
"--slack-channels \"#project-#{project_name}\" "\
|
43
43
|
'--slack-endpoint "https://hooks.slack.com/services/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"')
|
44
44
|
end
|
@@ -8,7 +8,7 @@ class CreateAwsProject
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def run
|
11
|
-
%w[
|
11
|
+
%w[main develop testing].each do |branch|
|
12
12
|
print_setup_commands branch
|
13
13
|
end
|
14
14
|
end
|
@@ -46,7 +46,7 @@ class CreateAwsProject
|
|
46
46
|
@cloudfront_alias = {}
|
47
47
|
return unless agree('Would you like to use an alias to call your assets/images on S3? (Default: no)')
|
48
48
|
|
49
|
-
%i[
|
49
|
+
%i[main develop testing].each do |branch|
|
50
50
|
cloudfront_alias_for branch
|
51
51
|
end
|
52
52
|
end
|
@@ -78,7 +78,7 @@ class CreateAwsProject
|
|
78
78
|
$terminal.wrap_at = nil if $terminal
|
79
79
|
puts aws_iam_setup(@aws_profile, aws_user(branch), @aws_app_group)
|
80
80
|
puts aws_s3_setup(@aws_profile, aws_user(branch), @aws_region, @redmine_project)
|
81
|
-
puts aws_s3_versioning_setup(@aws_profile, aws_user(branch)) if branch == '
|
81
|
+
puts aws_s3_versioning_setup(@aws_profile, aws_user(branch)) if branch == 'main'
|
82
82
|
cloudfront_setup(aws_user(branch), branch)
|
83
83
|
$terminal.wrap_at = :auto if $terminal
|
84
84
|
end
|
@@ -1,15 +1,11 @@
|
|
1
|
-
require 'commander'
|
2
|
-
require_relative './environments'
|
3
|
-
require_relative './fetch_emails'
|
4
|
-
|
5
1
|
class CreateHerokuApp
|
6
2
|
ADMIN_EMAIL = 'admin@renuo.ch'.freeze
|
7
3
|
|
8
4
|
def initialize; end
|
9
5
|
|
10
|
-
def run(args)
|
6
|
+
def run(*args)
|
11
7
|
project_name = args[0]
|
12
|
-
abort('>>
|
8
|
+
abort('>> Project name must be between 2 and 22 characters.') unless project_name&.length&.between?(2, 22)
|
13
9
|
emails = FetchEmails.new.fetch_emails
|
14
10
|
|
15
11
|
say "# Commands to setup your Heroku application\n".colorize :green
|
@@ -25,6 +21,7 @@ class CreateHerokuApp
|
|
25
21
|
heroku_name = "#{project_name}-#{env}"
|
26
22
|
say "heroku apps:create --region eu #{heroku_name}"
|
27
23
|
say "heroku domains:add #{heroku_name}.renuoapp.ch --app #{heroku_name}"
|
24
|
+
say "heroku domains:add #{project_name}-#{MASTER}.renuoapp.ch --app #{heroku_name}" if env == MAIN
|
28
25
|
say "heroku addons:create heroku-postgresql --app #{heroku_name}"
|
29
26
|
say "heroku addons:create papertrail --app #{heroku_name}"
|
30
27
|
say "heroku labs:enable runtime-dyno-metadata --app #{heroku_name}"
|
@@ -33,7 +30,7 @@ class CreateHerokuApp
|
|
33
30
|
end
|
34
31
|
|
35
32
|
def print_pipelines_commands(project_name)
|
36
|
-
say "heroku pipelines:create #{project_name} --app #{project_name}-#{
|
33
|
+
say "heroku pipelines:create #{project_name} --app #{project_name}-#{MAIN} -s production"
|
37
34
|
say "heroku pipelines:add #{project_name} --app #{project_name}-#{DEVELOP} -s staging"
|
38
35
|
say "heroku pipelines:add #{project_name} --app #{project_name}-#{TESTING} -s staging"
|
39
36
|
say "\n"
|
@@ -8,8 +8,8 @@ class ReleaseProject
|
|
8
8
|
validate_project_name
|
9
9
|
validate_update_type
|
10
10
|
validate_custom_version_format
|
11
|
-
compare_develop_master
|
12
11
|
checkout_project
|
12
|
+
compare_develop_main
|
13
13
|
@version ||= calculate_version
|
14
14
|
release
|
15
15
|
ensure
|
@@ -49,22 +49,29 @@ class ReleaseProject
|
|
49
49
|
abort('>> Invalid Version Number. Use format X.Y.Z for your version.')
|
50
50
|
end
|
51
51
|
|
52
|
-
def
|
52
|
+
def compare_develop_main
|
53
53
|
puts 'Please double-check what is going to be deployed.'
|
54
54
|
open_comparison_page
|
55
55
|
abort unless agree('Are you fine with those changes?')
|
56
56
|
end
|
57
57
|
|
58
58
|
def open_comparison_page
|
59
|
-
|
59
|
+
system_command = case RbConfig::CONFIG['host_os']
|
60
|
+
when /mswin|mingw|cygwin/
|
61
|
+
'start'
|
62
|
+
when /darwin/
|
63
|
+
'open'
|
64
|
+
when /linux|bsd/
|
65
|
+
'xdg-open'
|
66
|
+
end
|
67
|
+
system "#{system_command} https://github.com/#{@project_name}/compare/#{main_branch}...develop"
|
60
68
|
end
|
61
69
|
|
62
70
|
def checkout_project
|
63
|
-
unless system("#{MOVE_TO_TMP_FOLDER} && gh repo clone #{@project_name}
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
end
|
71
|
+
abort('>> Project not found on Github.') unless system("#{MOVE_TO_TMP_FOLDER} && gh repo clone #{@project_name}")
|
72
|
+
|
73
|
+
system(cmd_in_folder("git checkout #{main_branch} && git pull origin #{main_branch} &&" \
|
74
|
+
'git checkout develop && git pull origin develop && git flow init -d'))
|
68
75
|
end
|
69
76
|
|
70
77
|
def calculate_version
|
@@ -78,7 +85,7 @@ class ReleaseProject
|
|
78
85
|
if finish_release_branch
|
79
86
|
puts ">> Project successfully released with version #{@version}."
|
80
87
|
else
|
81
|
-
abort(
|
88
|
+
abort(">> Unable to finish release and push to #{main_branch}. Cancelling release.")
|
82
89
|
end
|
83
90
|
end
|
84
91
|
|
@@ -135,7 +142,7 @@ class ReleaseProject
|
|
135
142
|
def finish_release_branch
|
136
143
|
system(cmd_in_folder("GIT_MERGE_AUTOEDIT=no git flow release finish -m #{@version} #{@version} && " \
|
137
144
|
'git checkout develop && git push origin develop && ' \
|
138
|
-
|
145
|
+
"git checkout #{main_branch} && git push origin #{main_branch} --tags"))
|
139
146
|
end
|
140
147
|
|
141
148
|
def ask_for_final_confirmation
|
@@ -167,4 +174,8 @@ class ReleaseProject
|
|
167
174
|
def cleanup
|
168
175
|
system("rm -rf #{TMP_FOLDER_NAME}")
|
169
176
|
end
|
177
|
+
|
178
|
+
def main_branch
|
179
|
+
@main_branch ||= system(cmd_in_folder('git checkout main && git show-ref refs/heads/main')) ? 'main' : 'master'
|
180
|
+
end
|
170
181
|
end
|
@@ -5,22 +5,22 @@ do
|
|
5
5
|
case $cache_group in
|
6
6
|
|
7
7
|
rails)
|
8
|
-
cache restore nvm-$SEMAPHORE_GIT_BRANCH-$(checksum .nvmrc),nvm-$SEMAPHORE_GIT_BRANCH,nvm-develop,nvm-
|
9
|
-
cache restore gems-$SEMAPHORE_GIT_BRANCH-$(checksum Gemfile.lock),gems-$SEMAPHORE_GIT_BRANCH,gems-develop,gems-
|
10
|
-
cache restore yarn-cache-$SEMAPHORE_GIT_BRANCH-$(checksum yarn.lock),yarn-cache-$SEMAPHORE_GIT_BRANCH,yarn-cache-develop,yarn-cache-
|
11
|
-
cache restore node-modules-$SEMAPHORE_GIT_BRANCH-$(checksum yarn.lock),node-modules-$SEMAPHORE_GIT_BRANCH,node-modules-develop,node-modules-
|
8
|
+
cache restore nvm-$SEMAPHORE_GIT_BRANCH-$(checksum .nvmrc),nvm-$SEMAPHORE_GIT_BRANCH,nvm-develop,nvm-main
|
9
|
+
cache restore gems-$SEMAPHORE_GIT_BRANCH-$(checksum Gemfile.lock),gems-$SEMAPHORE_GIT_BRANCH,gems-develop,gems-main
|
10
|
+
cache restore yarn-cache-$SEMAPHORE_GIT_BRANCH-$(checksum yarn.lock),yarn-cache-$SEMAPHORE_GIT_BRANCH,yarn-cache-develop,yarn-cache-main
|
11
|
+
cache restore node-modules-$SEMAPHORE_GIT_BRANCH-$(checksum yarn.lock),node-modules-$SEMAPHORE_GIT_BRANCH,node-modules-develop,node-modules-main
|
12
12
|
;;
|
13
13
|
|
14
14
|
python)
|
15
|
-
cache restore requirements-$SEMAPHORE_GIT_BRANCH-$(checksum requirements.txt),requirements-$SEMAPHORE_GIT_BRANCH,requirements-develop,requirements-
|
15
|
+
cache restore requirements-$SEMAPHORE_GIT_BRANCH-$(checksum requirements.txt),requirements-$SEMAPHORE_GIT_BRANCH,requirements-develop,requirements-main
|
16
16
|
;;
|
17
17
|
|
18
18
|
assets)
|
19
|
-
cache restore packs-$SEMAPHORE_GIT_BRANCH,packs-develop,packs-
|
20
|
-
cache restore packstest-$SEMAPHORE_GIT_BRANCH,packstest-develop,packstest-
|
21
|
-
cache restore assets-$SEMAPHORE_GIT_BRANCH,assets-develop,assets-
|
22
|
-
cache restore sprocketscache-$SEMAPHORE_GIT_BRANCH,sprocketscache-develop,sprocketscache-
|
23
|
-
cache restore webpackercache-$SEMAPHORE_GIT_BRANCH,webpackercache-develop,webpackercache-
|
19
|
+
cache restore packs-$SEMAPHORE_GIT_BRANCH,packs-develop,packs-main
|
20
|
+
cache restore packstest-$SEMAPHORE_GIT_BRANCH,packstest-develop,packstest-main
|
21
|
+
cache restore assets-$SEMAPHORE_GIT_BRANCH,assets-develop,assets-main
|
22
|
+
cache restore sprocketscache-$SEMAPHORE_GIT_BRANCH,sprocketscache-develop,sprocketscache-main
|
23
|
+
cache restore webpackercache-$SEMAPHORE_GIT_BRANCH,webpackercache-develop,webpackercache-main
|
24
24
|
;;
|
25
25
|
|
26
26
|
*)
|
@@ -22,5 +22,6 @@ blocks:
|
|
22
22
|
- ssh-add ~/.ssh/id_rsa_semaphore_heroku
|
23
23
|
- git config --global url.ssh://git@heroku.com/.insteadOf https://git.heroku.com/
|
24
24
|
- git remote add heroku $HEROKU_REMOTE
|
25
|
-
- git push heroku -f $SEMAPHORE_GIT_BRANCH:
|
25
|
+
- git push heroku -f $SEMAPHORE_GIT_BRANCH:main
|
26
26
|
- heroku run -x rails db:migrate
|
27
|
+
- heroku dyno:restart
|
@@ -9,7 +9,7 @@ auto_cancel:
|
|
9
9
|
when: "true"
|
10
10
|
fail_fast:
|
11
11
|
cancel:
|
12
|
-
when: "branch != '
|
12
|
+
when: "branch != 'main'"
|
13
13
|
|
14
14
|
blocks:
|
15
15
|
- name: cache
|
@@ -23,6 +23,7 @@ blocks:
|
|
23
23
|
- name: cache
|
24
24
|
commands:
|
25
25
|
- checkout --use-cache
|
26
|
+
- gem update --system --no-document
|
26
27
|
- source .semaphore/bin/cache_restore rails
|
27
28
|
- bundle config set deployment 'true'
|
28
29
|
- bundle config set path 'vendor/bundle'
|
@@ -43,14 +44,26 @@ blocks:
|
|
43
44
|
prologue:
|
44
45
|
commands:
|
45
46
|
- checkout --use-cache
|
47
|
+
- gem update --system --no-document
|
46
48
|
- source .semaphore/bin/cache_restore rails
|
47
|
-
- bundle
|
49
|
+
- bundle config set deployment 'true'
|
50
|
+
- bundle config set path 'vendor/bundle'
|
51
|
+
- bundle install -j 4
|
48
52
|
- nvm install
|
49
53
|
- bin/yarn install --cache-folder ~/.cache/yarn
|
50
54
|
jobs:
|
51
55
|
- name: linting
|
52
56
|
commands:
|
53
57
|
- bin/fastcheck
|
58
|
+
epilogue:
|
59
|
+
on_fail:
|
60
|
+
commands:
|
61
|
+
- mkdir -p log
|
62
|
+
- mkdir -p tmp/screenshots
|
63
|
+
- mkdir -p coverage
|
64
|
+
- artifact push job --expire-in 2w log
|
65
|
+
- artifact push job --expire-in 2w tmp/screenshots
|
66
|
+
- artifact push job --expire-in 2w coverage
|
54
67
|
- name: tests
|
55
68
|
execution_time_limit:
|
56
69
|
minutes: 10
|
@@ -66,8 +79,11 @@ blocks:
|
|
66
79
|
prologue:
|
67
80
|
commands:
|
68
81
|
- checkout --use-cache
|
82
|
+
- gem update --system --no-document
|
69
83
|
- source .semaphore/bin/cache_restore rails
|
70
|
-
- bundle
|
84
|
+
- bundle config set deployment 'true'
|
85
|
+
- bundle config set path 'vendor/bundle'
|
86
|
+
- bundle install -j 4
|
71
87
|
- nvm install
|
72
88
|
- bin/yarn install --cache-folder ~/.cache/yarn
|
73
89
|
- sem-service start postgres
|
@@ -81,10 +97,10 @@ promotions:
|
|
81
97
|
pipeline_file: develop-deploy.yml
|
82
98
|
auto_promote:
|
83
99
|
when: "result = 'passed' and branch = 'develop'"
|
84
|
-
- name:
|
85
|
-
pipeline_file:
|
100
|
+
- name: main
|
101
|
+
pipeline_file: main-deploy.yml
|
86
102
|
auto_promote:
|
87
|
-
when: "result = 'passed' and branch = '
|
103
|
+
when: "result = 'passed' and branch = 'main'"
|
88
104
|
- name: testing
|
89
105
|
pipeline_file: testing-deploy.yml
|
90
106
|
auto_promote:
|
data/lib/renuo/cli/version.rb
CHANGED
data/lib/renuo/cli.rb
CHANGED
@@ -38,7 +38,6 @@ module Renuo
|
|
38
38
|
abort 'Nice! I updated myself. 🤩 Now you can run the command again.'
|
39
39
|
end
|
40
40
|
abort('Good. Just do it yourself then...😒')
|
41
|
-
exit
|
42
41
|
end
|
43
42
|
|
44
43
|
command 'display-name'.to_sym do |c|
|
@@ -121,10 +120,10 @@ module Renuo
|
|
121
120
|
- whether you want to setup CloudFront to deliver assets via S3
|
122
121
|
|
123
122
|
The generated commands do the following:
|
124
|
-
- create an IAM user for each environment (
|
123
|
+
- create an IAM user for each environment (main, develop, testing) and add it to the renuo apps group.
|
125
124
|
- create S3 buckets for each user who owns it
|
126
125
|
- tag the buckets
|
127
|
-
- enable versioning for
|
126
|
+
- enable versioning for main buckets
|
128
127
|
(- set up a CloudFront distribution for each environment with the default config or plus alias if configured)
|
129
128
|
DESCRIPTION
|
130
129
|
c.example 'Setup a project (you will be asked for details)', 'renuo create-aws-project'
|
@@ -148,8 +147,8 @@ module Renuo
|
|
148
147
|
|
149
148
|
command 'release' do |c|
|
150
149
|
c.syntax = 'renuo release'
|
151
|
-
c.summary = 'Release a projects state of develop (on github) to
|
152
|
-
c.description = 'Creates a new release version of a project on
|
150
|
+
c.summary = 'Release a projects state of develop (on github) to main in one command.'
|
151
|
+
c.description = 'Creates a new release version of a project on main as either a Major, Minor, '\
|
153
152
|
'Patch or Custom release based on the current state of develop on Github'
|
154
153
|
c.example 'renuo release my-project minor', 'release a minor release of my-project'
|
155
154
|
c.example 'renuo release my-project custom 2.5.0', 'release my-project as release 2.5.0'
|
data/renuo-cli.gemspec
CHANGED
@@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
|
29
29
|
spec.add_development_dependency 'aruba', '~> 0.14.5'
|
30
30
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
31
|
+
spec.add_development_dependency 'byebug'
|
31
32
|
spec.add_development_dependency 'cucumber', '~> 3.1'
|
32
33
|
spec.add_development_dependency 'dotenv', '~> 2.7.2'
|
33
34
|
spec.add_development_dependency 'mdl', '~> 0.4.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: renuo-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Renuo AG
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeresource
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '2.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: byebug
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: cucumber
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|