renuo-cli 3.1.6 → 3.1.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e8f1d92e8c0fa0ec9f455becc6d582050953ff06995b1449f989c3b0e2e5e229
4
- data.tar.gz: '0597a50d4d57f28c638227d424012a424149721582ac36bb862a733e7e9c584f'
3
+ metadata.gz: 5d0c7cb1b6bb3792c2b43d510487bb7e876070c6cdf83e7e4d41d96a556ab782
4
+ data.tar.gz: 851fe36fa4258b8a15a4bfe47186776e20638c453913df29549bb1d90c38398a
5
5
  SHA512:
6
- metadata.gz: f77187004b463350afd60609871843362a2218152c20fa57c146af4d1a6795472e226376b4d933bc25c81a4e87c563459763e83bf825d40f15d6e9f182c1795c
7
- data.tar.gz: 02736c206c176355e8e7ae1775cf75208445a1583011f8764acee31b05b26fffda5fc53a689839bf3369fa9aa894ca85ad8a21b2624bd94676b8d29cb7ea5cfc
6
+ metadata.gz: cd6b422735e525fe3f408ca5f30b65af4cb0f8a88b8b6c2d70b4cbc3db3bb077fc1e27b0af776b48b47d2e7590accf68e681d1c676aeb954bc7aae032a9b7a3a
7
+ data.tar.gz: f0989fe4f8c88dbbaf52f944c1aeb8053ae2d3199456e742941cd3cbdf2ce15d2f1cb5ba4edad6cabf51de438cc87d5b4580f8ce34f27d816a53600a646d99cd
data/README.md CHANGED
@@ -20,7 +20,7 @@ After checking out the repo, run `bin/setup` to install dependencies.
20
20
 
21
21
  Run `rake spec` to run the tests.
22
22
 
23
- Run `ruby -Ilib ./bin/renuo` to run the executable.
23
+ Run `ruby -Ilib ./bin/renuo` to run the executable. (e.g. `ruby -Ilib ./bin/renuo -v`)
24
24
 
25
25
  You can also run `bin/console` for an interactive prompt that will allow you to experiment.
26
26
 
@@ -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[main develop testing].each do |environment|
18
+ %w[main develop].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 "main,develop,testing" '\
41
+ '--branches "main,develop" '\
42
42
  "--slack-channels \"#project-#{project_name}\" "\
43
43
  '--slack-endpoint "https://hooks.slack.com/services/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"')
44
44
  end
@@ -22,5 +22,6 @@ class ConfigureSentry
22
22
  heroku_name = "#{project_name}-#{env}"
23
23
  say "heroku config:set SENTRY_DSN=#{sentry_dsn} --app #{heroku_name}"
24
24
  say "heroku config:set SENTRY_ENVIRONMENT=#{env} --app #{heroku_name}"
25
+ say "heroku labs:enable runtime-dyno-metadata --app #{heroku_name}"
25
26
  end
26
27
  end
@@ -8,7 +8,7 @@ class CreateAwsProject
8
8
  end
9
9
 
10
10
  def run
11
- %w[main develop testing].each do |branch|
11
+ %w[main develop].each do |branch|
12
12
  print_setup_commands branch
13
13
  end
14
14
  end
@@ -41,18 +41,6 @@ class CreateAwsProject
41
41
  def collect_cloudfront_information
42
42
  @setup_cloudfront = agree('Would you like to setup also AWS CloudFront? '\
43
43
  '(Default: yes, if you want to deliver assets/images from S3)')
44
- return unless @setup_cloudfront
45
-
46
- @cloudfront_alias = {}
47
- return unless agree('Would you like to use an alias to call your assets/images on S3? (Default: no)')
48
-
49
- %i[main develop testing].each do |branch|
50
- cloudfront_alias_for branch
51
- end
52
- end
53
-
54
- def cloudfront_alias_for(branch)
55
- @cloudfront_alias[branch] = ask("What CF-Alias do you want to use for #{branch}?") { |q| q.validate = /.+/ }
56
44
  end
57
45
 
58
46
  def ensure_aws_setup?
@@ -72,40 +60,31 @@ class CreateAwsProject
72
60
  (system(installation_command) if agree(agree_text)) until system(installation_check_command)
73
61
  end
74
62
 
75
- def print_setup_commands(branch)
63
+ def print_setup_commands(branch) # rubocop:todo Metrics/AbcSize
76
64
  say "\n# AWS #{branch} \n".colorize :green
77
65
  # wrap_at inserts newlines, after that, the command is no longer copyable
78
66
  $terminal.wrap_at = nil if $terminal
79
67
  puts aws_iam_setup(@aws_profile, aws_user(branch), @aws_app_group)
80
68
  puts aws_s3_setup(@aws_profile, aws_user(branch), @aws_region, @redmine_project)
69
+ say '# Hint: Don\'t forget to copy SecretAccessKey and AccessKeyId'.colorize :yellow
81
70
  puts aws_s3_versioning_setup(@aws_profile, aws_user(branch)) if branch == 'main'
82
- cloudfront_setup(aws_user(branch), branch)
71
+ cloudfront_setup(aws_user(branch))
83
72
  $terminal.wrap_at = :auto if $terminal
84
73
  end
85
74
 
86
- def cloudfront_setup(bucket, branch)
75
+ def cloudfront_setup(bucket)
87
76
  return unless @setup_cloudfront
88
77
 
89
- puts aws_cloudfront_setup(@aws_profile, bucket, branch, @redmine_project)
90
- if @cloudfront_alias[branch.to_sym]
91
- say "\n# Warning: Don't forget to set up `#{cloudfront_alias(branch)}` on the DNS "\
92
- 'if not yet done'.colorize :yellow
93
- else
94
- say "\n# Hint: The domain name for your S3 files, can be found after running the" \
95
- ' commands on https://console.aws.amazon.com/cloudfront/home'.colorize :yellow
96
- end
78
+ puts aws_cloudfront_setup(@aws_profile, bucket, @redmine_project)
79
+ say '# Hint: Find the distribution domain name under Distribution.DomainName'.colorize :yellow
97
80
  end
98
81
 
99
82
  def aws_user(branch)
100
83
  [@project_name, branch, @project_purpose].compact.join('-')
101
84
  end
102
85
 
103
- def cloudfront_alias(branch)
104
- @cloudfront_alias[branch.to_sym]
105
- end
106
-
107
86
  def aws_iam_setup(profile, user, app_group)
108
- <<-IAM_COMMANDS
87
+ <<~IAM_COMMANDS
109
88
  aws --profile #{profile} iam create-user --user-name #{user}
110
89
  aws --profile #{profile} iam add-user-to-group --user-name #{user} --group-name #{app_group}
111
90
  aws --profile #{profile} iam create-access-key --user-name #{user}
@@ -113,23 +92,23 @@ class CreateAwsProject
113
92
  end
114
93
 
115
94
  def aws_s3_setup(profile, bucket, region, redmine_project)
116
- <<-S3_COMMANDS
95
+ <<~S3_COMMANDS
117
96
  aws --profile #{profile} s3 mb s3://#{bucket} --region #{region}
118
97
  aws --profile #{profile} s3api put-bucket-tagging --bucket #{bucket} --tagging "TagSet=[{Key=redmine_project,Value=#{redmine_project}}]"
119
98
  S3_COMMANDS
120
99
  end
121
100
 
122
101
  def aws_s3_versioning_setup(profile, bucket)
123
- <<-S3_VERSIONING_COMMANDS
102
+ <<~S3_VERSIONING_COMMANDS
124
103
  aws --profile #{profile} s3api put-bucket-versioning --bucket #{bucket} --versioning-configuration Status=Enabled
125
104
  S3_VERSIONING_COMMANDS
126
105
  end
127
106
 
128
- def aws_cloudfront_setup(profile, bucket, branch, redmine_project)
107
+ def aws_cloudfront_setup(profile, bucket, redmine_project)
129
108
  tags = [{ "Key": 'redmine_project', "Value": redmine_project }]
130
- cloudfront_config_string = CloudfrontConfigService.new(bucket, cloudfront_alias(branch), tags).to_s
109
+ cloudfront_config_string = CloudfrontConfigService.new(bucket, tags).to_s
131
110
 
132
- <<-CLOUDFRONT_COMMANDS
111
+ <<~CLOUDFRONT_COMMANDS
133
112
  aws --profile #{profile} cloudfront create-distribution-with-tags --distribution-config-with-tags '#{cloudfront_config_string}'
134
113
  CLOUDFRONT_COMMANDS
135
114
  end
@@ -6,43 +6,30 @@ class CreateHerokuApp
6
6
  def run(args)
7
7
  project_name = args[0]
8
8
  abort('>> Project name must be between 2 and 22 characters.') unless project_name&.length&.between?(2, 22)
9
- emails = FetchEmails.new.fetch_emails
10
9
 
11
10
  say "# Commands to setup your Heroku application\n".colorize :green
12
11
  ENVIRONMENTS.each do |env|
13
- print_environment_commands(emails, env, project_name)
12
+ print_environment_commands(env, project_name)
14
13
  end
15
14
  print_pipelines_commands(project_name)
16
15
  end
17
16
 
18
17
  private
19
18
 
20
- def print_environment_commands(emails, env, project_name)
19
+ def print_environment_commands(env, project_name)
21
20
  heroku_name = "#{project_name}-#{env}"
22
- say "heroku apps:create --region eu #{heroku_name}"
21
+ say "heroku apps:create --region eu #{heroku_name} -t staff"
23
22
  say "heroku domains:add #{heroku_name}.renuoapp.ch --app #{heroku_name}"
24
23
  say "heroku domains:add #{project_name}-#{MASTER}.renuoapp.ch --app #{heroku_name}" if env == MAIN
25
24
  say "heroku addons:create heroku-postgresql --app #{heroku_name}"
26
25
  say "heroku addons:create papertrail --app #{heroku_name}"
27
26
  say "heroku labs:enable runtime-dyno-metadata --app #{heroku_name}"
28
27
  say "heroku pg:backups:schedule DATABASE_URL --at '02:00 Europe/Zurich' --app #{heroku_name}"
29
- print_ownership_commands(emails, heroku_name)
30
28
  end
31
29
 
32
30
  def print_pipelines_commands(project_name)
33
31
  say "heroku pipelines:create #{project_name} --app #{project_name}-#{MAIN} -s production -t staff"
34
32
  say "heroku pipelines:add #{project_name} --app #{project_name}-#{DEVELOP} -s staging"
35
- say "heroku pipelines:add #{project_name} --app #{project_name}-#{TESTING} -s staging"
36
- say "\n"
37
- end
38
-
39
- def print_ownership_commands(emails, heroku_name)
40
- say "\n"
41
- emails.each do |email|
42
- say "heroku access:add #{email} --app #{heroku_name}"
43
- end
44
- say "heroku access:add #{ADMIN_EMAIL} --app #{heroku_name}"
45
- say "heroku apps:transfer -a #{heroku_name} #{ADMIN_EMAIL}"
46
33
  say "\n"
47
34
  end
48
35
  end
@@ -1,5 +1,4 @@
1
1
  MAIN = 'main'.freeze
2
2
  MASTER = 'master'.freeze
3
3
  DEVELOP = 'develop'.freeze
4
- TESTING = 'testing'.freeze
5
- ENVIRONMENTS = [MAIN, DEVELOP, TESTING].freeze
4
+ ENVIRONMENTS = [MAIN, DEVELOP].freeze
@@ -15,7 +15,7 @@ class NameDisplay
15
15
 
16
16
  private
17
17
 
18
- HEROKU_APP_NAME = '-a renuo-dashboard-master'.freeze
18
+ HEROKU_APP_NAME = '-a renuo-dashboard-main'.freeze
19
19
  HEROKU_CLI = 'heroku run'.freeze
20
20
  RENUO_CLI = 'rails renuo:welcome'.freeze
21
21
  SLIDES = 'https://docs.google.com/presentation/d/1mPhQjArZnlUWUa2ik5R9IlGmdCKCwc2_H8Qq-AWgV-A/edit'.freeze
@@ -1,7 +1,6 @@
1
1
  class CloudfrontConfigService
2
- def initialize(bucket, bucket_alias, tags = [])
2
+ def initialize(bucket, tags = [])
3
3
  @bucket = bucket
4
- @bucket_alias = bucket_alias
5
4
  @tags = tags
6
5
  end
7
6
 
@@ -16,7 +15,6 @@ class CloudfrontConfigService
16
15
  {
17
16
  "DistributionConfig": {
18
17
  "CallerReference": unique_caller_reference,
19
- "Aliases": bucket_aliases,
20
18
  "Origins": {
21
19
  "Quantity": 1,
22
20
  "Items": [
@@ -116,11 +114,4 @@ class CloudfrontConfigService
116
114
  def unique_caller_reference
117
115
  "#{Time.now.getutc.to_i}-#{@bucket}"
118
116
  end
119
-
120
- def bucket_aliases
121
- {
122
- "Quantity": @bucket_alias ? 1 : 0,
123
- "Items": @bucket_alias ? [@bucket_alias] : []
124
- }
125
- end
126
117
  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
9
- cache restore gems-$SEMAPHORE_GIT_BRANCH-$(checksum .ruby-version)-$(checksum Gemfile.lock),gems-develop-$(checksum .ruby-version)-$(checksum Gemfile.lock),gems-develop-$(checksum .ruby-version)
10
- cache restore yarn-cache-$SEMAPHORE_GIT_BRANCH-$(checksum yarn.lock),yarn-cache-$SEMAPHORE_GIT_BRANCH,yarn-cache-develop
11
- cache restore node-modules-$SEMAPHORE_GIT_BRANCH-$(checksum yarn.lock),node-modules-$SEMAPHORE_GIT_BRANCH,node-modules-develop
8
+ cache restore "nvm-$SEMAPHORE_GIT_BRANCH-$(checksum .nvmrc),nvm-$SEMAPHORE_GIT_BRANCH,nvm-develop"
9
+ cache restore "gems-$SEMAPHORE_GIT_BRANCH-$(checksum .ruby-version)-$(checksum Gemfile.lock),gems-develop-$(checksum .ruby-version)-$(checksum Gemfile.lock),gems-develop-$(checksum .ruby-version)"
10
+ cache restore "yarn-cache-$SEMAPHORE_GIT_BRANCH-$(checksum yarn.lock),yarn-cache-$SEMAPHORE_GIT_BRANCH,yarn-cache-develop"
11
+ cache restore "node-modules-$SEMAPHORE_GIT_BRANCH-$(checksum yarn.lock),node-modules-$SEMAPHORE_GIT_BRANCH,node-modules-develop"
12
12
  ;;
13
13
 
14
14
  python)
15
- cache restore requirements-$SEMAPHORE_GIT_BRANCH-$(checksum requirements.txt),requirements-$SEMAPHORE_GIT_BRANCH,requirements-develop
15
+ cache restore "requirements-$SEMAPHORE_GIT_BRANCH-$(checksum requirements.txt),requirements-$SEMAPHORE_GIT_BRANCH,requirements-develop"
16
16
  ;;
17
17
 
18
18
  assets)
19
- cache restore packs-$SEMAPHORE_GIT_BRANCH,packs-develop
20
- cache restore packstest-$SEMAPHORE_GIT_BRANCH,packstest-develop
21
- cache restore assets-$SEMAPHORE_GIT_BRANCH,assets-develop
22
- cache restore sprocketscache-$SEMAPHORE_GIT_BRANCH,sprocketscache-develop
23
- cache restore webpackercache-$SEMAPHORE_GIT_BRANCH,webpackercache-develop
19
+ cache restore "packs-$SEMAPHORE_GIT_BRANCH,packs-develop"
20
+ cache restore "packstest-$SEMAPHORE_GIT_BRANCH,packstest-develop"
21
+ cache restore "assets-$SEMAPHORE_GIT_BRANCH,assets-develop"
22
+ cache restore "sprocketscache-$SEMAPHORE_GIT_BRANCH,sprocketscache-develop"
23
+ cache restore "webpackercache-$SEMAPHORE_GIT_BRANCH,webpackercache-develop"
24
24
  ;;
25
25
 
26
26
  *)
@@ -63,7 +63,8 @@ blocks:
63
63
  - mkdir -p coverage
64
64
  - artifact push job --expire-in 2w log
65
65
  - artifact push job --expire-in 2w tmp/screenshots
66
- - artifact push job --expire-in 2w coverage
66
+ - zip -r coverage-$SEMAPHORE_GIT_SHA coverage/
67
+ - artifact push job --expire-in 2w coverage-$SEMAPHORE_GIT_SHA.zip
67
68
  - name: tests
68
69
  execution_time_limit:
69
70
  minutes: 10
@@ -98,10 +99,13 @@ blocks:
98
99
  commands:
99
100
  - mkdir -p log
100
101
  - mkdir -p tmp/screenshots
102
+ - mkdir -p tmp/capybara
101
103
  - mkdir -p coverage
102
104
  - artifact push job log --expire-in 2w
103
105
  - artifact push job tmp/screenshots --expire-in 2w
104
- - artifact push job coverage --expire-in 2w
106
+ - artifact push job tmp/capybara --expire-in 2w
107
+ - zip -r coverage-$SEMAPHORE_GIT_SHA coverage/
108
+ - artifact push job --expire-in 2w coverage-$SEMAPHORE_GIT_SHA.zip
105
109
  promotions:
106
110
  - name: develop
107
111
  pipeline_file: develop-deploy.yml
@@ -111,7 +115,3 @@ promotions:
111
115
  pipeline_file: main-deploy.yml
112
116
  auto_promote:
113
117
  when: "result = 'passed' and branch = 'main'"
114
- - name: testing
115
- pipeline_file: testing-deploy.yml
116
- auto_promote:
117
- when: "result = 'passed' and branch = 'testing'"
@@ -1,6 +1,6 @@
1
1
  module Renuo
2
2
  module Cli
3
- VERSION = '3.1.6'.freeze
3
+ VERSION = '3.1.7'.freeze
4
4
  NAME = 'renuo-cli'.freeze
5
5
  end
6
6
  end
data/lib/renuo/cli.rb CHANGED
@@ -123,7 +123,7 @@ module Renuo
123
123
  - whether you want to setup CloudFront to deliver assets via S3
124
124
 
125
125
  The generated commands do the following:
126
- - create an IAM user for each environment (main, develop, testing) and add it to the renuo apps group.
126
+ - create an IAM user for each environment (main, develop) and add it to the renuo apps group.
127
127
  - create S3 buckets for each user who owns it
128
128
  - tag the buckets
129
129
  - enable versioning for main buckets
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: 3.1.6
4
+ version: 3.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Renuo AG
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-29 00:00:00.000000000 Z
11
+ date: 2023-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeresource
@@ -378,7 +378,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
378
378
  - !ruby/object:Gem::Version
379
379
  version: '0'
380
380
  requirements: []
381
- rubygems_version: 3.2.32
381
+ rubygems_version: 3.1.6
382
382
  signing_key:
383
383
  specification_version: 4
384
384
  summary: The Renuo CLI automates some common workflows.