diff --git a/Makefile b/Makefile index e06f94bcfd3..efd70def816 100644 --- a/Makefile +++ b/Makefile @@ -90,9 +90,6 @@ update_country_dialing_codes: check_asset_strings: find ./app/javascript -name "*.js*" | xargs ./scripts/check-assets -generate_deploy_checklist: - ruby lib/release_management/generate_deploy_checklist.rb - local_gems_bundle: BUNDLE_GEMFILE=Gemfile-dev bundle install diff --git a/bin/fetch_github_metrics b/bin/fetch_github_metrics deleted file mode 100755 index c41d0e505cf..00000000000 --- a/bin/fetch_github_metrics +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env ruby - -require_relative '../lib/github_metrics' - -GithubMetrics::PrAgeReporter.new.call diff --git a/bin/generate_saml_pki b/bin/generate_saml_pki deleted file mode 100755 index 260f127cc50..00000000000 --- a/bin/generate_saml_pki +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -openssl req -x509 -sha256 -days 365 -newkey rsa:2048 -keyout keys/saml.key.enc.example -out certs/saml.crt.example -config config/openssl.conf diff --git a/bin/remove-overcommit b/bin/remove-overcommit deleted file mode 100755 index 3c0145965f2..00000000000 --- a/bin/remove-overcommit +++ /dev/null @@ -1,16 +0,0 @@ -## -# Previously, the login.gov application used overcommit to manage git hooks. -# We have dropped support of overcommit. This script removes the hooks from -# repos that may still have them. -# - -rm .git/hooks/commit-msg -rm .git/hooks/overcommit-hook -rm .git/hooks/post-checkout -rm .git/hooks/post-commit -rm .git/hooks/post-merge -rm .git/hooks/post-rewrite -rm .git/hooks/pre-commit -rm .git/hooks/pre-push -rm .git/hooks/pre-rebase -rm .git/hooks/prepare-commit-msg diff --git a/config/openssl.conf b/config/openssl.conf deleted file mode 100644 index 1ceb96613c1..00000000000 --- a/config/openssl.conf +++ /dev/null @@ -1,13 +0,0 @@ -[ req ] -default_bits = 2048 -distinguished_name = req_distinguished_name -prompt = no - -[ req_distinguished_name ] -commonName = idp-sandbox.login.gov -organizationName = GSA -organizationalUnitName = 18f -localityName = Washington -stateOrProvinceName = DC -countryName = US -emailAddress = 18f@gsa.gov diff --git a/lib/github_metrics.rb b/lib/github_metrics.rb deleted file mode 100644 index 4e7fbe67356..00000000000 --- a/lib/github_metrics.rb +++ /dev/null @@ -1,3 +0,0 @@ -require_relative 'github_metrics/pr_age_reporter' -require_relative 'github_metrics/pull_request' -require_relative 'github_metrics/sprint' diff --git a/lib/github_metrics/pr_age_reporter.rb b/lib/github_metrics/pr_age_reporter.rb deleted file mode 100644 index ac3778e21c1..00000000000 --- a/lib/github_metrics/pr_age_reporter.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'octokit' -require 'date' - -module GithubMetrics - class PrAgeReporter - attr_reader :tot - - # rubocop:disable Rails/Output - def call - numerator = 0 - sprint_pull_requests.each do |pr| - ready_for_review_time = pr.ready_for_review_time - numerator += ready_for_review_time - puts "'#{pr.title}' under review for #{seconds_to_hours(ready_for_review_time)} hours" - end - puts "Average: #{seconds_to_hours(numerator / sprint_pull_requests.count.to_f)} hours" - end - # rubocop:enable Rails/Output - - private - - def sprint_pull_requests - @sprint_pull_requests ||= PullRequest.fetch_pull_requests_for_sprint(Sprint.new) - end - - def seconds_to_hours(seconds) - (seconds / 3600).round - end - end -end diff --git a/lib/github_metrics/pull_request.rb b/lib/github_metrics/pull_request.rb deleted file mode 100644 index c40c4c7a7bc..00000000000 --- a/lib/github_metrics/pull_request.rb +++ /dev/null @@ -1,58 +0,0 @@ -# rubocop:disable Rails/TimeZone -module GithubMetrics - class PullRequest - extend Forwardable - - class << self - def fetch_recent_pull_requests - github_client.pull_requests( - '18f/identity-idp', - per_page: 100, - state: :all, - accept: 'application/vnd.github.shadow-cat-preview+json', - ).map do |pr_response| - new(pr_response) - end - end - - def fetch_pull_requests_for_sprint(sprint) - fetch_recent_pull_requests.select do |pull_request| - sprint.includes_pull_request?(pull_request) - end - end - - def github_client - @github_client ||= Octokit::Client.new - end - end - - def initialize(pull_request_response) - @pull_request_response = pull_request_response - end - - def_delegators :pull_request_response, :title, :created_at, :closed_at, - :merged_at, :number, :draft - - def ready_for_review_at - events = self.class.github_client.issue_events( - '18f/identity-idp', number, accept: 'application/vnd.github.mockingbird-preview' - ) - events.select do |item| - item.event == 'ready_for_review' - end.first&.created_at || created_at - end - - def done_at_or_current_date - merged_at || closed_at || Time.now - end - - def ready_for_review_time - done_at_or_current_date - ready_for_review_at - end - - private - - attr_reader :pull_request_response - end -end -# rubocop:enable Rails/TimeZone diff --git a/lib/github_metrics/sprint.rb b/lib/github_metrics/sprint.rb deleted file mode 100644 index 18263b67635..00000000000 --- a/lib/github_metrics/sprint.rb +++ /dev/null @@ -1,37 +0,0 @@ -# rubocop:disable Rails/TimeZone -module GithubMetrics - class Sprint - attr_reader :sprint_start - - def initialize(sprint_start: nil) - @sprint_start = sprint_start - @sprint_start ||= current_sprint_start - end - - def sprint_end - sprint_start + 14 * 24 * 3600 - end - - def includes_pull_request?(pull_request) - return false if pull_request.draft - created_at = pull_request.created_at - return true if created_at < sprint_end && created_at > sprint_start - done_at_or_current_date = pull_request.done_at_or_current_date - return true if done_at_or_current_date < sprint_end && done_at_or_current_date > sprint_start - false - end - - private - - def current_sprint_start - @sprint_start ||= begin - # 12:00 ET on 7/2/2019 was the start of sprint 88 - reference_sprint_start = Time.new(2019, 7, 2, 12, 0, 0, -14_400) - days_since_reference = (Time.now - reference_sprint_start) / (24 * 3600) - sprints_since_reference = (days_since_reference / 14).floor - reference_sprint_start + 14 * sprints_since_reference * 24 * 3600 - end - end - end -end -# rubocop:enable Rails/TimeZone diff --git a/lib/release_management/deploy_checklist.md.erb b/lib/release_management/deploy_checklist.md.erb deleted file mode 100644 index e43fed9945b..00000000000 --- a/lib/release_management/deploy_checklist.md.erb +++ /dev/null @@ -1,42 +0,0 @@ -# Release candidate <%= rc_number %> - -**Candidate**: [<%= rc_branch_name %>](https://github.com/18F/identity-idp/commits/<%= rc_branch_name %>) - -[Diff from RC <%= previous_rc_number %>](https://github.com/18F/identity-idp/compare/<%= previous_rc_branch_name %>...<%= rc_branch_name %>) - -# Deploy Checklist - -## Branching (<%= branch_date %>) - -- [ ] Add this checklist to the wiki and update the main wiki page to link to it under the previous RC -- [ ] Create an RC branch named `<%= rc_branch_name %>` and push it to GitHub -- [ ] Verify that application.yml is up to date on int, staging, and prod - -## Deploy staging (<%= staging_deploy_date %>) - -- [ ] Open a pull request to merge `<%= rc_branch_name %>` into `stages/staging` -- [ ] Backup release manager: Double check the PR and approve it -- [ ] Merge the deploy pull request -- [ ] Announce that you are beginning the deploy in `#login-devops` -- [ ] Run any new migrations on a migration instance -- [ ] Run the `asg-recycle` script against staging -- [ ] Use the `ls-servers` script to check the status for the new servers. Wait until they have been up for ~15 minutes -- [ ] Check that the new code is deployed by looking for the new sha at [https://idp.staging.login.gov/api/deploy.json](https://idp.staging.login.gov/api/deploy.json) -- [ ] Run the smoke tests against staging -- [ ] Check New Relic for an elevated error rate -- [ ] Use the `tag-release` script in the IdP repo to tag the release -- [ ] Use the new tag to create a release in GitHub - -## Deploy production (<%= production_deploy_date %>) - -- [ ] Open a pull request to merge `<%= rc_branch_name %>` into `stages/prod` -- [ ] Backup release manager: Double check the PR and approve it -- [ ] Merge the deploy pull request -- [ ] Announce that you are beginning the deploy in `#login-devops` -- [ ] Run any new migrations on a migration instance -- [ ] Run the `asg-recycle` script against prod -- [ ] Use the `ls-servers` script to check the status for the new servers. Wait until they have been up for ~15 minutes -- [ ] Check that the new code is deployed by looking for the new sha at [https://secure.login.gov/api/deploy.json](https://secure.login.gov/api/deploy.json) -- [ ] Run the smoke tests against prod -- [ ] Check New Relic for an elevated error rate -- [ ] If all appears well, run the `scale-in-old-instances` script against prod diff --git a/lib/release_management/generate_deploy_checklist.rb b/lib/release_management/generate_deploy_checklist.rb deleted file mode 100644 index fc504c85479..00000000000 --- a/lib/release_management/generate_deploy_checklist.rb +++ /dev/null @@ -1,118 +0,0 @@ -# rubocop:disable Rails/Output, Rails/Date - -require 'erb' -require 'date' - -module ReleaseManagement - class GenerateDeployChecklist - def call - prompt_user_for_checklist_values - template = File.read('lib/release_management/deploy_checklist.md.erb') - puts "\n\nAdd the following the wiki under RC #{rc_number}:\n\n" - puts ERB.new(template).result(binding) - end - - private - - attr_accessor :rc_number, :previous_rc_number, :rc_branch_name, :previous_rc_branch_name, - :branch_date, :staging_deploy_date, :production_deploy_date - - def prompt_user_for_checklist_values - prompt_for_rc_number - prompt_for_previous_rc_number - prompt_for_rc_branch_name - prompt_for_previous_rc_branch_name - prompt_for_branch_date - prompt_for_staging_deploy_date - prompt_for_production_deploy_date - end - - def prompt_for_rc_number - prompt_user_for( - :rc_number, - prompt: 'What is the RC number for this deploy (e.g. 81)', - ) - end - - def prompt_for_previous_rc_number - default_value = rc_number.to_i - 1 - prompt_user_for( - :previous_rc_number, - prompt: 'What is the RC number for the previous RC', - default: default_value, - ) - end - - def prompt_for_rc_branch_name - default_value = "stages/rc-#{next_thursday.strftime('%Y-%m-%d')}" - prompt_user_for( - :rc_branch_name, - prompt: 'What is the RC branch name', - default: default_value, - ) - end - - def prompt_for_previous_rc_branch_name - last_deploy_date = next_thursday - 14 - default_value = "stages/rc-#{last_deploy_date.strftime('%Y-%m-%d')}" - prompt_user_for( - :previous_rc_branch_name, - prompt: 'What was the previous RC branch name', - default: default_value, - ) - end - - def prompt_for_branch_date - default_branch_date = next_thursday - 3 - default_value = default_branch_date.strftime('%A, %B %d, %Y') - prompt_user_for( - :branch_date, - prompt: 'When will you create the new branch', - default: default_value, - ) - end - - def prompt_for_staging_deploy_date - default_staging_deploy_date = next_thursday - 2 - default_value = default_staging_deploy_date.strftime('%A, %B %d, %Y') - prompt_user_for( - :staging_deploy_date, - prompt: 'When will you deploy staging', - default: default_value, - ) - end - - def prompt_for_production_deploy_date - default_production_deploy_date = next_thursday - default_value = default_production_deploy_date.strftime('%A, %B %d, %Y') - prompt_user_for( - :production_deploy_date, - prompt: 'When will you deploy production', - default: default_value, - ) - end - - def prompt_user_for(name, prompt:, default: nil) - prompt = "#{prompt} (leave blank for #{default})" if default - print "#{prompt}? " - instance_variable_name = "@#{name}" - instance_variable_set(instance_variable_name, gets.strip) - return unless blank?(instance_variable_get(instance_variable_name)) - return prompt_user_for(name, prompt: prompt, default: default) if default.nil? - instance_variable_set(instance_variable_name, default) - end - - def next_thursday - days_until_thursday = (4 - Date.today.wday).abs - Date.today + days_until_thursday - end - - def blank?(string) - string.nil? || string.empty? # rubocop:disable Rails/Blank - end - end -end - -ReleaseManagement::GenerateDeployChecklist.new.call - -# rubocop:enable Rails/Output, Rails/Date