diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/clusters_list/components/ancestor_notice.vue | 34 | ||||
-rw-r--r-- | app/assets/javascripts/clusters_list/components/clusters.vue | 4 | ||||
-rw-r--r-- | app/assets/javascripts/clusters_list/store/state.js | 1 | ||||
-rw-r--r-- | app/graphql/types/jira_user_type.rb | 6 | ||||
-rw-r--r-- | app/helpers/clusters_helper.rb | 1 | ||||
-rw-r--r-- | app/services/ci/register_job_service.rb | 19 | ||||
-rw-r--r-- | app/services/jira_import/users_mapper.rb | 7 | ||||
-rw-r--r-- | app/views/clusters/clusters/index.html.haml | 11 | ||||
-rw-r--r-- | app/workers/concerns/reenqueuer.rb | 2 |
9 files changed, 68 insertions, 17 deletions
diff --git a/app/assets/javascripts/clusters_list/components/ancestor_notice.vue b/app/assets/javascripts/clusters_list/components/ancestor_notice.vue new file mode 100644 index 00000000000..7954fc61785 --- /dev/null +++ b/app/assets/javascripts/clusters_list/components/ancestor_notice.vue @@ -0,0 +1,34 @@ +<script> +import { GlLink, GlSprintf } from '@gitlab/ui'; +import { mapState } from 'vuex'; + +export default { + components: { + GlLink, + GlSprintf, + }, + computed: { + ...mapState(['ancestorHelperPath', 'hasAncestorClusters']), + }, +}; +</script> + +<template> + <div v-if="hasAncestorClusters" class="bs-callout bs-callout-info"> + <p> + <gl-sprintf + :message=" + s__( + 'ClusterIntegration|Clusters are utilized by selecting the nearest ancestor with a matching environment scope. For example, project clusters will override group clusters. %{linkStart}More information%{linkEnd}', + ) + " + > + <template #link="{ content }"> + <gl-link :href="ancestorHelperPath"> + <strong>{{ content }}</strong> + </gl-link> + </template> + </gl-sprintf> + </p> + </div> +</template> diff --git a/app/assets/javascripts/clusters_list/components/clusters.vue b/app/assets/javascripts/clusters_list/components/clusters.vue index a51760599ea..7e9b720d269 100644 --- a/app/assets/javascripts/clusters_list/components/clusters.vue +++ b/app/assets/javascripts/clusters_list/components/clusters.vue @@ -9,6 +9,7 @@ import { GlSprintf, GlTable, } from '@gitlab/ui'; +import AncestorNotice from './ancestor_notice.vue'; import tooltip from '~/vue_shared/directives/tooltip'; import { CLUSTER_TYPES, STATUSES } from '../constants'; import { __, sprintf } from '~/locale'; @@ -17,6 +18,7 @@ export default { nodeMemoryText: __('%{totalMemory} (%{freeSpacePercentage}%{percentSymbol} free)'), nodeCpuText: __('%{totalCpu} (%{freeSpacePercentage}%{percentSymbol} free)'), components: { + AncestorNotice, GlBadge, GlLink, GlLoadingIcon, @@ -195,6 +197,8 @@ export default { <gl-loading-icon v-if="loadingClusters" size="md" class="gl-mt-3" /> <section v-else> + <ancestor-notice /> + <gl-table :items="clusters" :fields="fields" stacked="md" class="qa-clusters-table"> <template #cell(name)="{ item }"> <div :class="[contentAlignClasses, 'js-status']"> diff --git a/app/assets/javascripts/clusters_list/store/state.js b/app/assets/javascripts/clusters_list/store/state.js index 8f42cba6a6e..51fafd49479 100644 --- a/app/assets/javascripts/clusters_list/store/state.js +++ b/app/assets/javascripts/clusters_list/store/state.js @@ -1,4 +1,5 @@ export default (initialState = {}) => ({ + ancestorHelperPath: initialState.ancestorHelpPath, endpoint: initialState.endpoint, hasAncestorClusters: false, clusters: [], diff --git a/app/graphql/types/jira_user_type.rb b/app/graphql/types/jira_user_type.rb index 8aa21ce669b..999526a920e 100644 --- a/app/graphql/types/jira_user_type.rb +++ b/app/graphql/types/jira_user_type.rb @@ -13,7 +13,11 @@ module Types field :jira_email, GraphQL::STRING_TYPE, null: true, description: 'Email of the Jira user, returned only for users with public emails' field :gitlab_id, GraphQL::INT_TYPE, null: true, - description: 'Id of the matched GitLab user' + description: 'ID of the matched GitLab user' + field :gitlab_username, GraphQL::STRING_TYPE, null: true, + description: 'Username of the matched GitLab user' + field :gitlab_name, GraphQL::STRING_TYPE, null: true, + description: 'Name of the matched GitLab user' end # rubocop: enable Graphql/AuthorizeTypes end diff --git a/app/helpers/clusters_helper.rb b/app/helpers/clusters_helper.rb index 005070cca5c..b87d1c4e1ce 100644 --- a/app/helpers/clusters_helper.rb +++ b/app/helpers/clusters_helper.rb @@ -18,6 +18,7 @@ module ClustersHelper def js_clusters_list_data(path = nil) { + ancestor_help_path: help_page_path('user/group/clusters/index', anchor: 'cluster-precedence'), endpoint: path, img_tags: { aws: { path: image_path('illustrations/logos/amazon_eks.svg'), text: s_('ClusterIntegration|Amazon EKS') }, diff --git a/app/services/ci/register_job_service.rb b/app/services/ci/register_job_service.rb index 17b9e56636b..3797ea1d96c 100644 --- a/app/services/ci/register_job_service.rb +++ b/app/services/ci/register_job_service.rb @@ -11,7 +11,7 @@ module Ci METRICS_SHARD_TAG_PREFIX = 'metrics_shard::'.freeze DEFAULT_METRICS_SHARD = 'default'.freeze - Result = Struct.new(:build, :valid?) + Result = Struct.new(:build, :build_json, :valid?) def initialize(runner) @runner = runner @@ -59,7 +59,7 @@ module Ci end register_failure - Result.new(nil, valid) + Result.new(nil, nil, valid) end # rubocop: enable CodeReuse/ActiveRecord @@ -71,7 +71,7 @@ module Ci # In case when 2 runners try to assign the same build, second runner will be declined # with StateMachines::InvalidTransition or StaleObjectError when doing run! or save method. if assign_runner!(build, params) - Result.new(build, true) + present_build!(build) end rescue StateMachines::InvalidTransition, ActiveRecord::StaleObjectError # We are looping to find another build that is not conflicting @@ -83,8 +83,10 @@ module Ci # In case we hit the concurrency-access lock, # we still have to return 409 in the end, # to make sure that this is properly handled by runner. - Result.new(nil, false) + Result.new(nil, nil, false) rescue => ex + # If an error (e.g. GRPC::DeadlineExceeded) occurred constructing + # the result, consider this as a failure to be retried. scheduler_failure!(build) track_exception_for_build(ex, build) @@ -92,6 +94,15 @@ module Ci nil end + # Force variables evaluation to occur now + def present_build!(build) + # We need to use the presenter here because Gitaly calls in the presenter + # may fail, and we need to ensure the response has been generated. + presented_build = ::Ci::BuildRunnerPresenter.new(build) # rubocop:disable CodeReuse/Presenter + build_json = ::API::Entities::JobRequest::Response.new(presented_build).to_json + Result.new(build, build_json, true) + end + def assign_runner!(build, params) build.runner_id = runner.id build.runner_session_attributes = params[:session] if params[:session].present? diff --git a/app/services/jira_import/users_mapper.rb b/app/services/jira_import/users_mapper.rb index 31a3f721556..c3cbeb157bd 100644 --- a/app/services/jira_import/users_mapper.rb +++ b/app/services/jira_import/users_mapper.rb @@ -14,9 +14,8 @@ module JiraImport { jira_account_id: jira_user['accountId'], jira_display_name: jira_user['displayName'], - jira_email: jira_user['emailAddress'], - gitlab_id: match_user(jira_user) - } + jira_email: jira_user['emailAddress'] + }.merge(match_user(jira_user)) end end @@ -25,7 +24,7 @@ module JiraImport # TODO: Matching user by email and displayName will be done as the part # of follow-up issue: https://gitlab.com/gitlab-org/gitlab/-/issues/219023 def match_user(jira_user) - nil + { gitlab_id: nil, gitlab_username: nil, gitlab_name: nil } end end end diff --git a/app/views/clusters/clusters/index.html.haml b/app/views/clusters/clusters/index.html.haml index a654a8741a4..557ad1bf280 100644 --- a/app/views/clusters/clusters/index.html.haml +++ b/app/views/clusters/clusters/index.html.haml @@ -12,15 +12,14 @@ = s_('ClusterIntegration|Kubernetes clusters can be used to deploy applications and to provide Review Apps for this project') = render 'clusters/clusters/buttons' - - if @has_ancestor_clusters - .bs-callout.bs-callout-info - = s_('ClusterIntegration|Clusters are utilized by selecting the nearest ancestor with a matching environment scope. For example, project clusters will override group clusters.') - %strong - = link_to _('More information'), help_page_path('user/group/clusters/index', anchor: 'cluster-precedence') - - if Feature.enabled?(:clusters_list_redesign) #js-clusters-list-app{ data: js_clusters_list_data(clusterable.index_path(format: :json)) } - else + - if @has_ancestor_clusters + .bs-callout.bs-callout-info + = s_('ClusterIntegration|Clusters are utilized by selecting the nearest ancestor with a matching environment scope. For example, project clusters will override group clusters.') + %strong + = link_to _('More information'), help_page_path('user/group/clusters/index', anchor: 'cluster-precedence') .clusters-table.js-clusters-list .gl-responsive-table-row.table-row-header{ role: "row" } .table-section.section-60{ role: "rowheader" } diff --git a/app/workers/concerns/reenqueuer.rb b/app/workers/concerns/reenqueuer.rb index 79a1d2d0070..bf6f6546c03 100644 --- a/app/workers/concerns/reenqueuer.rb +++ b/app/workers/concerns/reenqueuer.rb @@ -60,8 +60,6 @@ module Reenqueuer 5.seconds end - # We intend to get rid of sleep: - # https://gitlab.com/gitlab-org/gitlab/issues/121697 module ReenqueuerSleeper # The block will run, and then sleep until the minimum duration. Returns the # block's return value. |