Skip to content
Snippets Groups Projects
Commit 6f0f893b authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent 8b1228b0
No related branches found
No related tags found
No related merge requests found
Showing
with 169 additions and 46 deletions
Loading
Loading
@@ -10,5 +10,8 @@ lint-ci-gitlab:
- "**/*.yml"
image: sdesbure/yamllint:latest
dependencies: []
variables:
LINT_PATHS: .gitlab-ci.yml .gitlab/ci lib/gitlab/ci/templates changelogs
script:
- yamllint .gitlab-ci.yml .gitlab/ci lib/gitlab/ci/templates changelogs
- '[[ ! -d "ee/" ]] || export LINT_PATHS="$LINT_PATHS ee/changelogs"'
- yamllint $LINT_PATHS
Loading
Loading
@@ -238,7 +238,7 @@ entry.
- Skip updating LFS objects in mirror updates if repository has not changed. !21744
- Add indexes on deployments to improve environments search. !21789
 
### Added (117 changes, 16 of them are from the community)
### Added (119 changes, 18 of them are from the community)
 
- Add upvote/downvotes attributes to GraphQL Epic query. !14311
- Delete kubernetes cluster association and resources. !16954
Loading
Loading
@@ -357,6 +357,8 @@ entry.
- Added migration which adds service desk username column. !21733
- Add SentryIssue table to store a link between issue and sentry issue. !37026
- Add path based targeting to broadcast messages.
- Add allow failure in pipeline webhook event. !20978 (Gaetan Semet)
- Add runner information in build web hook event. !20709 (Gaetan Semet)
 
### Other (51 changes, 28 of them are from the community)
 
Loading
Loading
@@ -483,7 +485,7 @@ entry.
- Do not display project labels that are not visible for user accessing group labels.
- Standardize error response when route is missing.
 
### Fixed (99 changes, 14 of them are from the community)
### Fixed (100 changes, 15 of them are from the community)
 
- Fix incorrect selection of custom templates. !17205
- Smaller width for design comments layout, truncate image title. !17547
Loading
Loading
@@ -584,6 +586,7 @@ entry.
- Only allow confirmed users to run pipelines.
- Fix scroll to bottom with new job log.
- Fixed protected branches flash styling.
- Show tag link whenever it's a tag in chat message integration for push events and pipeline events. !18126 (Mats Estensen)
 
### Deprecated (2 changes)
 
Loading
Loading
import axios from '~/lib/utils/axios_utils';
import Poll from './poll';
import httpStatusCodes from './http_status';
/**
* Polls an endpoint until it returns either a 200 OK or a error status.
* The Poll-Interval header in the responses are used to determine how
* frequently to poll.
*
* Once a 200 OK is received, the promise resolves with that response. If an
* error status is received, the promise rejects with the error.
*
* @param {string} url - The URL to poll.
* @param {Object} [config] - The config to provide to axios.get().
* @returns {Promise}
*/
export default (url, config = {}) =>
new Promise((resolve, reject) => {
const eTagPoll = new Poll({
resource: {
axiosGet(data) {
return axios.get(data.url, {
headers: {
'Content-Type': 'application/json',
},
...data.config,
});
},
},
data: { url, config },
method: 'axiosGet',
successCallback: response => {
if (response.status === httpStatusCodes.OK) {
resolve(response);
eTagPoll.stop();
}
},
errorCallback: reject,
});
eTagPoll.makeRequest();
});
Loading
Loading
@@ -66,7 +66,7 @@ export default {
:svg-path="illustrationPath"
:description="
__(
'Releases mark specific points in a project\'s development history, communicate information about the type of change, and deliver on prepared, often compiled, versions of the software to be reused elsewhere. Currently, releases can only be created through the API.',
'Releases are based on Git tags and mark specific points in a project\'s development history. They can contain information about the type of changes and can also deliver binaries, like compiled versions of your software.',
)
"
:primary-button-link="documentationLink"
Loading
Loading
Loading
Loading
@@ -76,6 +76,9 @@ module Types
field :last_release_short_version, GraphQL::STRING_TYPE,
null: true,
description: "Release version the error was last seen"
field :gitlab_commit, GraphQL::STRING_TYPE,
null: true,
description: "GitLab commit SHA attributed to the Error based on the release version"
 
def first_seen
DateTime.parse(object.first_seen)
Loading
Loading
# frozen_string_literal: true
 
module Ci
class Bridge < CommitStatus
include Ci::Processable
class Bridge < Ci::Processable
include Ci::Contextable
include Ci::PipelineDelegator
include Importable
Loading
Loading
# frozen_string_literal: true
 
module Ci
class Build < CommitStatus
include Ci::Processable
class Build < Ci::Processable
include Ci::Metadatable
include Ci::Contextable
include Ci::PipelineDelegator
Loading
Loading
Loading
Loading
@@ -33,8 +33,7 @@ module Ci
has_many :stages, -> { order(position: :asc) }, inverse_of: :pipeline
has_many :statuses, class_name: 'CommitStatus', foreign_key: :commit_id, inverse_of: :pipeline
has_many :latest_statuses_ordered_by_stage, -> { latest.order(:stage_idx, :stage) }, class_name: 'CommitStatus', foreign_key: :commit_id, inverse_of: :pipeline
has_many :processables, -> { processables },
class_name: 'CommitStatus', foreign_key: :commit_id, inverse_of: :pipeline
has_many :processables, class_name: 'Ci::Processable', foreign_key: :commit_id, inverse_of: :pipeline
has_many :builds, foreign_key: :commit_id, inverse_of: :pipeline
has_many :trigger_requests, dependent: :destroy, foreign_key: :commit_id # rubocop:disable Cop/ActiveRecordDependent
has_many :variables, class_name: 'Ci::PipelineVariable'
Loading
Loading
# frozen_string_literal: true
 
module Ci
##
# This module implements methods that need to be implemented by CI/CD
# entities that are supposed to go through pipeline processing
# services.
#
#
module Processable
extend ActiveSupport::Concern
class Processable < ::CommitStatus
has_many :needs, class_name: 'Ci::BuildNeed', foreign_key: :build_id, inverse_of: :build
 
included do
has_many :needs, class_name: 'Ci::BuildNeed', foreign_key: :build_id, inverse_of: :build
accepts_nested_attributes_for :needs
 
accepts_nested_attributes_for :needs
scope :preload_needs, -> { preload(:needs) }
 
scope :preload_needs, -> { preload(:needs) }
end
validates :type, presence: true
 
def schedulable?
raise NotImplementedError
Loading
Loading
Loading
Loading
@@ -45,7 +45,6 @@ class CommitStatus < ApplicationRecord
scope :before_stage, -> (index) { where('stage_idx < ?', index) }
scope :for_stage, -> (index) { where(stage_idx: index) }
scope :after_stage, -> (index) { where('stage_idx > ?', index) }
scope :processables, -> { where(type: %w[Ci::Build Ci::Bridge]) }
scope :for_ids, -> (ids) { where(id: ids) }
scope :for_ref, -> (ref) { where(ref: ref) }
scope :by_name, -> (name) { where(name: name) }
Loading
Loading
Loading
Loading
@@ -113,9 +113,8 @@ module ErrorTracking
when 'list_issues'
sentry_client.list_issues(**opts.symbolize_keys)
when 'issue_details'
{
issue: sentry_client.issue_details(**opts.symbolize_keys)
}
issue = sentry_client.issue_details(**opts.symbolize_keys)
{ issue: add_gitlab_issue_details(issue) }
when 'issue_latest_event'
{
latest_event: sentry_client.issue_latest_event(**opts.symbolize_keys)
Loading
Loading
@@ -140,6 +139,20 @@ module ErrorTracking
 
private
 
def add_gitlab_issue_details(issue)
issue.gitlab_commit = match_gitlab_commit(issue.first_release_version)
issue
end
def match_gitlab_commit(release_version)
return unless release_version
commit = project.repository.commit(release_version)
commit&.id
end
def handle_exceptions
yield
rescue Sentry::Client::Error => e
Loading
Loading
Loading
Loading
@@ -81,6 +81,10 @@ class Release < ApplicationRecord
evidence&.summary || {}
end
 
def milestone_titles
self.milestones.map {|m| m.title }.sort.join(", ")
end
private
 
def actual_sha
Loading
Loading
# frozen_string_literal: true
 
module Ci
class BridgePresenter < CommitStatusPresenter
class BridgePresenter < ProcessablePresenter
def detailed_status
@detailed_status ||= subject.detailed_status(user)
end
Loading
Loading
# frozen_string_literal: true
 
module Ci
class BuildPresenter < CommitStatusPresenter
class BuildPresenter < ProcessablePresenter
def erased_by_user?
# Build can be erased through API, therefore it does not have
# `erased_by` user assigned in that case.
Loading
Loading
# frozen_string_literal: true
module Ci
class ProcessablePresenter < CommitStatusPresenter
end
end
Loading
Loading
@@ -8,6 +8,7 @@ module ErrorTracking
:external_url,
:first_release_last_commit,
:first_release_short_version,
:gitlab_commit,
:first_seen,
:frequency,
:gitlab_issue,
Loading
Loading
Loading
Loading
@@ -11,10 +11,13 @@ module Releases
return error('params is empty', 400) if empty_params?
return error("Milestone(s) not found: #{inexistent_milestones.join(', ')}", 400) if inexistent_milestones.any?
 
params[:milestones] = milestones if param_for_milestone_titles_provided?
if param_for_milestone_titles_provided?
previous_milestones = release.milestones.map(&:title)
params[:milestones] = milestones
end
 
if release.update(params)
success(tag: existing_tag, release: release)
success(tag: existing_tag, release: release, milestones_updated: milestones_updated?(previous_milestones))
else
error(release.errors.messages || '400 Bad request', 400)
end
Loading
Loading
@@ -29,5 +32,11 @@ module Releases
def empty_params?
params.except(:tag).empty?
end
def milestones_updated?(previous_milestones)
return false unless param_for_milestone_titles_provided?
previous_milestones.to_set != release.milestones.map(&:title)
end
end
end
Loading
Loading
@@ -188,3 +188,4 @@
- create_evidence
- group_export
- self_monitoring_project_create
- self_monitoring_project_delete
# frozen_string_literal: true
module SelfMonitoringProjectWorker
extend ActiveSupport::Concern
included do
# This worker falls under Self-monitoring with Monitor::APM group. However,
# self-monitoring is not classified as a feature category but rather as
# Other Functionality. Metrics seems to be the closest feature_category for
# this worker.
feature_category :metrics
end
LEASE_TIMEOUT = 15.minutes.to_i
EXCLUSIVE_LEASE_KEY = 'self_monitoring_service_creation_deletion'
class_methods do
# @param job_id [String]
# Job ID that is used to construct the cache keys.
# @return [Hash]
# Returns true if the job is enqueued or in progress and false otherwise.
def in_progress?(job_id)
Gitlab::SidekiqStatus.job_status(Array.wrap(job_id)).first
end
end
private
def lease_key
EXCLUSIVE_LEASE_KEY
end
def lease_timeout
self.class::LEASE_TIMEOUT
end
end
Loading
Loading
@@ -3,38 +3,11 @@
class SelfMonitoringProjectCreateWorker
include ApplicationWorker
include ExclusiveLeaseGuard
# This worker falls under Self-monitoring with Monitor::APM group. However,
# self-monitoring is not classified as a feature category but rather as
# Other Functionality. Metrics seems to be the closest feature_category for
# this worker.
feature_category :metrics
LEASE_TIMEOUT = 15.minutes.to_i
EXCLUSIVE_LEASE_KEY = 'self_monitoring_service_creation_deletion'
include SelfMonitoringProjectWorker
 
def perform
try_obtain_lease do
Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService.new.execute
end
end
# @param job_id [String]
# Job ID that is used to construct the cache keys.
# @return [Hash]
# Returns true if the job is enqueued or in progress and false otherwise.
def self.in_progress?(job_id)
Gitlab::SidekiqStatus.job_status(Array.wrap(job_id)).first
end
private
def lease_key
EXCLUSIVE_LEASE_KEY
end
def lease_timeout
LEASE_TIMEOUT
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment