-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'refs/remotes/origin/master' into featur…
…e/github/stages/retry_counter # Conflicts: # db/schema.rb # spec/app/github_app_spec.rb
- Loading branch information
Showing
54 changed files
with
1,226 additions
and
258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
# | ||
# delayed_job.rb | ||
# Part of NetDEF CI System | ||
# | ||
# Copyright (c) 2024 by | ||
# Network Device Education Foundation, Inc. ("NetDEF") | ||
# | ||
# frozen_string_literal: true | ||
|
||
require_relative '../lib/helpers/github_logger' | ||
require_relative '../database_loader' | ||
|
||
require 'delayed_job' | ||
require 'active_support' | ||
|
||
module Rails | ||
class << self | ||
attr_accessor :logger | ||
end | ||
end | ||
|
||
DELAYED_JOB_TIMER = 5 | ||
|
||
Rails.logger = GithubLogger.instance.create('delayed_job.log', Logger::INFO) | ||
ActiveRecord::Base.logger = GithubLogger.instance.create('delayed_job.log', Logger::INFO) | ||
|
||
# this is used by DJ to guess where tmp/pids is located (default) | ||
RAILS_ROOT = File.expand_path(__FILE__) | ||
|
||
Delayed::Worker.backend = :active_record | ||
Delayed::Worker.destroy_failed_jobs = true | ||
Delayed::Worker.sleep_delay = 5 | ||
Delayed::Worker.max_attempts = 5 | ||
Delayed::Worker.max_run_time = 5.minutes | ||
|
||
config = YAML.load_file('config/database.yml')[ENV.fetch('RACK_ENV', 'development')] | ||
ActiveRecord::Base.establish_connection(config) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
db/migrate/20240408141736_add_check_suite_cancelled_ref.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
# | ||
# 20240408141736_add_check_suite_cancelled_ref.rb | ||
# Part of NetDEF CI System | ||
# | ||
# Copyright (c) 2024 by | ||
# Network Device Education Foundation, Inc. ("NetDEF") | ||
# | ||
# frozen_string_literal: true | ||
|
||
class AddCheckSuiteCancelledRef < ActiveRecord::Migration[6.0] | ||
def change | ||
add_column :check_suites, :cancelled_by_id, :bigint | ||
add_index :check_suites, :cancelled_by_id | ||
add_foreign_key :check_suites, :stages, column: :cancelled_by_id | ||
end | ||
end |
15 changes: 15 additions & 0 deletions
15
db/migrate/20240408164410_add_check_suite_cancelled_in_stage.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
# | ||
# 20240408152636_add_check_suite_cancelled_in_stage.rb | ||
# Part of NetDEF CI System | ||
# | ||
# Copyright (c) 2024 by | ||
# Network Device Education Foundation, Inc. ("NetDEF") | ||
# | ||
# frozen_string_literal: true | ||
|
||
class AddCheckSuiteCancelledInStage < ActiveRecord::Migration[6.0] | ||
def change | ||
add_reference :stages, :cancelled_at_stage, foreign_key: { to_table: :check_suites } | ||
end | ||
end |
17 changes: 17 additions & 0 deletions
17
db/migrate/20240417094603_change_check_suite_cancelled_by_id.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
# | ||
# 20240417094603_change_check_suite_cancelled_by_id.rb | ||
# Part of NetDEF CI System | ||
# | ||
# Copyright (c) 2024 by | ||
# Network Device Education Foundation, Inc. ("NetDEF") | ||
# | ||
# frozen_string_literal: true | ||
|
||
class ChangeCheckSuiteCancelledById < ActiveRecord::Migration[6.0] | ||
def change | ||
change_table :check_suites do |t| | ||
t.references :cancelled_previous_check_suite, foreign_key: { to_table: :check_suites } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
# | ||
# 20240417102854_remove_check_suite_columns.rb | ||
# Part of NetDEF CI System | ||
# | ||
# Copyright (c) 2024 by | ||
# Network Device Education Foundation, Inc. ("NetDEF") | ||
# | ||
# frozen_string_literal: true | ||
|
||
class RemoveCheckSuiteColumns < ActiveRecord::Migration[6.0] | ||
def change | ||
if ActiveRecord::Base.connection.column_exists?(:check_suites, :cancelled_by_id) | ||
remove_column :check_suites, :cancelled_by_id | ||
end | ||
|
||
remove_column :check_suites, :id_id if ActiveRecord::Base.connection.column_exists?(:check_suites, :id_id) | ||
end | ||
end |
30 changes: 30 additions & 0 deletions
30
db/migrate/20240417130601_change_check_suite_stopped_in_stage.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
# | ||
# 202404130601_change_check_suite_stopped_in_stage.rb | ||
# Part of NetDEF CI System | ||
# | ||
# Copyright (c) 2024 by | ||
# Network Device Education Foundation, Inc. ("NetDEF") | ||
# | ||
# frozen_string_literal: true | ||
|
||
class ChangeCheckSuiteStoppedInStage < ActiveRecord::Migration[6.0] | ||
def change | ||
if ActiveRecord::Base.connection.column_exists?(:stages, :cancelled_at_stage_id) | ||
remove_column :stages, :cancelled_at_stage_id | ||
end | ||
|
||
if ActiveRecord::Base.connection.column_exists?(:check_suites, :cancelled_in_stage_id) | ||
remove_column :check_suites, :cancelled_in_stage_id | ||
end | ||
|
||
if ActiveRecord::Base.connection.column_exists?(:check_suites, :cancelled_previous_check_suite_id) | ||
remove_column :check_suites, :cancelled_previous_check_suite_id | ||
end | ||
|
||
change_table :check_suites do |t| | ||
t.references :stopped_in_stage, foreign_key: { to_table: :stages } | ||
t.references :cancelled_previous_check_suite, foreign_key: { to_table: :check_suites } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
# | ||
# 20240617121935_create_delayed_jobs.rb | ||
# Part of NetDEF CI System | ||
# | ||
# Copyright (c) 2024 by | ||
# Network Device Education Foundation, Inc. ("NetDEF") | ||
# | ||
# frozen_string_literal: true | ||
|
||
class CreateDelayedJobs < ActiveRecord::Migration[6.0] | ||
def change | ||
create_table :delayed_jobs do |t| | ||
t.integer :priority, default: 0, null: false | ||
t.integer :attempts, default: 0, null: false | ||
t.text :handler, null: false | ||
t.text :last_error | ||
t.datetime :run_at | ||
t.datetime :locked_at | ||
t.datetime :failed_at | ||
t.string :locked_by | ||
t.string :queue | ||
t.timestamps null: false | ||
end | ||
end | ||
end |
Oops, something went wrong.