Maintenance: Add CI check for possibly orphaned bundled gems.
This runs only on develop and is allowed to fail.
This commit is contained in:
parent
5b6ce4935f
commit
572d91f65e
6 changed files with 81 additions and 22 deletions
|
@ -8,6 +8,20 @@
|
||||||
- source /etc/profile.d/rvm.sh # ensure RVM is loaded
|
- source /etc/profile.d/rvm.sh # ensure RVM is loaded
|
||||||
- source /opt/rh/rh-nodejs*/enable # ensure Node.js is available
|
- source /opt/rh/rh-nodejs*/enable # ensure Node.js is available
|
||||||
|
|
||||||
|
.template_pre_rails: &template_pre_rails
|
||||||
|
stage: pre
|
||||||
|
extends:
|
||||||
|
- .tags_docker
|
||||||
|
- .rules_singletest
|
||||||
|
- .services_postgresql
|
||||||
|
before_script:
|
||||||
|
- source /etc/profile.d/rvm.sh # ensure RVM is loaded
|
||||||
|
- source /opt/rh/rh-nodejs*/enable # ensure Node.js is available
|
||||||
|
- bundle install -j $(nproc) --path vendor
|
||||||
|
- bundle exec ruby .gitlab/configure_environment.rb
|
||||||
|
- source .gitlab/environment.env
|
||||||
|
- bundle exec rake zammad:db:init
|
||||||
|
|
||||||
rubocop:
|
rubocop:
|
||||||
<<: *template_pre
|
<<: *template_pre
|
||||||
script:
|
script:
|
||||||
|
@ -30,27 +44,16 @@ gettext lint:
|
||||||
- for FILE in i18n/*.pot i18n/*.po; do echo "Checking $FILE"; msgfmt -o /dev/null -c $FILE; done
|
- for FILE in i18n/*.pot i18n/*.po; do echo "Checking $FILE"; msgfmt -o /dev/null -c $FILE; done
|
||||||
|
|
||||||
gettext catalog consistency:
|
gettext catalog consistency:
|
||||||
<<: *template_pre
|
<<: *template_pre_rails
|
||||||
extends:
|
extends:
|
||||||
- .tags_docker
|
- .tags_docker
|
||||||
- .services_postgresql
|
- .services_postgresql
|
||||||
script:
|
script:
|
||||||
- bundle install -j $(nproc) --path vendor
|
|
||||||
- bundle exec ruby .gitlab/configure_environment.rb
|
|
||||||
- source .gitlab/environment.env
|
|
||||||
- bundle exec rake zammad:db:init
|
|
||||||
- bundle exec rails generate translation_catalog --check
|
- bundle exec rails generate translation_catalog --check
|
||||||
|
|
||||||
zeitwerk:check:
|
zeitwerk:check:
|
||||||
<<: *template_pre
|
<<: *template_pre_rails
|
||||||
extends:
|
|
||||||
- .tags_docker
|
|
||||||
- .services_postgresql
|
|
||||||
script:
|
script:
|
||||||
- bundle install -j $(nproc) --path vendor
|
|
||||||
- bundle exec ruby .gitlab/configure_environment.rb
|
|
||||||
- source .gitlab/environment.env
|
|
||||||
- bundle exec rake zammad:db:init
|
|
||||||
- bundle exec rails zeitwerk:check
|
- bundle exec rails zeitwerk:check
|
||||||
|
|
||||||
brakeman:
|
brakeman:
|
||||||
|
@ -84,6 +87,18 @@ bundle-audit:
|
||||||
- bundle-audit update
|
- bundle-audit update
|
||||||
- bundle-audit --ignore CVE-2015-9284
|
- bundle-audit --ignore CVE-2015-9284
|
||||||
|
|
||||||
|
bundle-orphaned:
|
||||||
|
<<: *template_pre_rails
|
||||||
|
allow_failure: true
|
||||||
|
rules:
|
||||||
|
- if: $CI_MERGE_REQUEST_ID
|
||||||
|
when: never
|
||||||
|
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
||||||
|
when: always
|
||||||
|
- when: manual
|
||||||
|
script:
|
||||||
|
- bundle exec rake zammad:ci:bundle:orphaned 5
|
||||||
|
|
||||||
github:
|
github:
|
||||||
<<: *template_pre
|
<<: *template_pre
|
||||||
tags:
|
tags:
|
||||||
|
|
2
Gemfile
2
Gemfile
|
@ -158,8 +158,6 @@ group :development, :test do
|
||||||
|
|
||||||
# app boottime improvement
|
# app boottime improvement
|
||||||
gem 'spring'
|
gem 'spring'
|
||||||
gem 'spring-commands-rspec'
|
|
||||||
gem 'spring-commands-testunit'
|
|
||||||
|
|
||||||
# debugging
|
# debugging
|
||||||
gem 'byebug'
|
gem 'byebug'
|
||||||
|
|
|
@ -563,10 +563,6 @@ GEM
|
||||||
websocket-driver
|
websocket-driver
|
||||||
slop (3.6.0)
|
slop (3.6.0)
|
||||||
spring (4.0.0)
|
spring (4.0.0)
|
||||||
spring-commands-rspec (1.0.4)
|
|
||||||
spring (>= 0.9.1)
|
|
||||||
spring-commands-testunit (1.0.1)
|
|
||||||
spring (>= 0.9.1)
|
|
||||||
sprockets (3.7.2)
|
sprockets (3.7.2)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
rack (> 1, < 3)
|
rack (> 1, < 3)
|
||||||
|
@ -734,8 +730,6 @@ DEPENDENCIES
|
||||||
slack-notifier
|
slack-notifier
|
||||||
slack-ruby-client
|
slack-ruby-client
|
||||||
spring
|
spring
|
||||||
spring-commands-rspec
|
|
||||||
spring-commands-testunit
|
|
||||||
sprockets (~> 3.7.2)
|
sprockets (~> 3.7.2)
|
||||||
tcr
|
tcr
|
||||||
telegramAPI
|
telegramAPI
|
||||||
|
|
4
lib/tasks/zammad/ci/bundle/orphaned.rake
Normal file
4
lib/tasks/zammad/ci/bundle/orphaned.rake
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
||||||
|
|
||||||
|
require_dependency 'tasks/zammad/ci/bundle/orphaned.rb'
|
||||||
|
Tasks::Zammad::Ci::Bundle::Orphaned.register_rake_task
|
48
lib/tasks/zammad/ci/bundle/orphaned.rb
Normal file
48
lib/tasks/zammad/ci/bundle/orphaned.rb
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
||||||
|
|
||||||
|
require_dependency 'tasks/zammad/command.rb'
|
||||||
|
|
||||||
|
module Tasks
|
||||||
|
module Zammad
|
||||||
|
module Ci
|
||||||
|
module Bundle
|
||||||
|
class Orphaned < Tasks::Zammad::Command
|
||||||
|
|
||||||
|
def self.usage
|
||||||
|
"#{super} age_in_years"
|
||||||
|
end
|
||||||
|
|
||||||
|
ARGUMENT_COUNT = 1
|
||||||
|
|
||||||
|
def self.task_handler
|
||||||
|
age = validate_age
|
||||||
|
orphaned_gems = find_orphaned_gems(age)
|
||||||
|
|
||||||
|
if orphaned_gems.count.zero?
|
||||||
|
puts "No bundled gems released more than #{age} year(s) ago found."
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
puts "The following bundled gems were released more than #{age} year(s) ago:"
|
||||||
|
orphaned_gems.each do |s|
|
||||||
|
puts " #{s.name}:#{s.version} #{s.date.strftime('%F')}"
|
||||||
|
end
|
||||||
|
abort
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.validate_age
|
||||||
|
age = ARGV[1]
|
||||||
|
if age.to_i.to_s != age
|
||||||
|
abort "Please provide a valid number for 'age_in_years'.\n#{usage}"
|
||||||
|
end
|
||||||
|
age.to_i
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.find_orphaned_gems(age)
|
||||||
|
Bundler.definition.specs.select { |s| s.date < age.years.ago }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -40,7 +40,7 @@ module Tasks
|
||||||
# self-modification in 'zammad:package:install').
|
# self-modification in 'zammad:package:install').
|
||||||
# Enforce the correct number of expected arguments.
|
# Enforce the correct number of expected arguments.
|
||||||
def self.validate_comandline
|
def self.validate_comandline
|
||||||
if ARGV.first.eql?(task_name) || ARGV.count != (const_get(:ARGUMENT_COUNT) + 1)
|
if ARGV.first.to_sym != task_name || ARGV.count != (const_get(:ARGUMENT_COUNT) + 1)
|
||||||
abort "Error: wrong number of arguments given.\n#{usage}"
|
abort "Error: wrong number of arguments given.\n#{usage}"
|
||||||
end
|
end
|
||||||
# Rake will try to run additional arguments as tasks, so make sure nothing happens for these.
|
# Rake will try to run additional arguments as tasks, so make sure nothing happens for these.
|
||||||
|
|
Loading…
Reference in a new issue