Skip to content

Commit

Permalink
Fix regression with my previous staging attempt
Browse files Browse the repository at this point in the history
Staging projects have more disabled repositories than I
thought, we forgot about the bootstrap_copy repository,
which led to all staging projects in Factory being 'building'
after my last change was deployed.

Now reverting this in parts and leaving the build_state
unaffected, but forcing all checks of disabled repositories
to 'pending' as such forcing the staging project to 'testing'
  • Loading branch information
coolo committed Mar 1, 2019
1 parent ffd8dd6 commit bf36f59
Show file tree
Hide file tree
Showing 7 changed files with 1,875 additions and 22 deletions.
17 changes: 15 additions & 2 deletions src/api/app/models/obs_factory/staging_project.rb
Expand Up @@ -44,7 +44,6 @@ def self.find(distribution, id)
# @return [String] description of the Project object
delegate :description, to: :project

delegate :checks, to: :project
delegate :missing_checks, to: :project

# Checks if the project is adi staging project
Expand Down Expand Up @@ -207,11 +206,25 @@ def attributes
end

def build_state
return :building if building_repositories.present? || disabled_repositories.present?
return :building if building_repositories.present?
return :failed if broken_packages.present?
:acceptable
end

def checks
# for stagings we ignore 'old' checks in disabled repositories
repos = disabled_repositories
project.checks.each do |check|
next unless repos.include?(check.status_report.checkable)
# we can't simply ignore them as missing_checks is calculated
# independently, so we would be left without missing checks
# but without checks - so better mark them as 'old/pending',
# but only in memory, not in the database.
check.state = :pending
check.url = nil
end
end

def check_state
if missing_checks.present? || checks.any?(&:pending?)
:testing
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bf36f59

Please sign in to comment.