Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-01-08 03:32:37 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-01-08 03:32:37 +0300
commit469a50879c1085ec77c95d650b7f135fee2c9e13 (patch)
tree0d639a63294b5abdb4e4a7bf1ed5a497d5e6869f /app
parentaa5ca44f172f02f04cca448b1f9c17d6d933de40 (diff)
Add latest changes from gitlab-org/gitlab@13-7-stable-ee
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/jobs/store/actions.js24
-rw-r--r--app/assets/javascripts/jobs/store/mutations.js1
-rw-r--r--app/assets/javascripts/registry/explorer/components/details_page/tags_list_row.vue4
-rw-r--r--app/controllers/projects/jobs_controller.rb30
-rw-r--r--app/graphql/types/container_repository_tag_type.rb10
-rw-r--r--app/models/clusters/applications/helm.rb2
-rw-r--r--app/models/environment.rb5
-rw-r--r--app/policies/project_policy.rb6
-rw-r--r--app/services/environments/canary_ingress/update_service.rb1
9 files changed, 36 insertions, 47 deletions
diff --git a/app/assets/javascripts/jobs/store/actions.js b/app/assets/javascripts/jobs/store/actions.js
index cac9dc06284..e3ded725168 100644
--- a/app/assets/javascripts/jobs/store/actions.js
+++ b/app/assets/javascripts/jobs/store/actions.js
@@ -21,7 +21,8 @@ export const init = ({ dispatch }, { endpoint, logState, pagePath }) => {
logState,
pagePath,
});
- dispatch('fetchJob');
+
+ return Promise.all([dispatch('fetchJob'), dispatch('fetchTrace')]);
};
export const setJobEndpoint = ({ commit }, endpoint) => commit(types.SET_JOB_ENDPOINT, endpoint);
@@ -39,7 +40,6 @@ export const toggleSidebar = ({ dispatch, state }) => {
};
let eTagPoll;
-let isTraceReadyForRender;
export const clearEtagPoll = () => {
eTagPoll = null;
@@ -71,14 +71,7 @@ export const fetchJob = ({ state, dispatch }) => {
});
if (!Visibility.hidden()) {
- // eslint-disable-next-line promise/catch-or-return
- eTagPoll.makeRequest().then(() => {
- // if a job is canceled we still need to dispatch
- // fetchTrace to get the trace so we check for has_trace
- if (state.job.started || state.job.has_trace) {
- dispatch('fetchTrace');
- }
- });
+ eTagPoll.makeRequest();
} else {
axios
.get(state.jobEndpoint)
@@ -88,15 +81,9 @@ export const fetchJob = ({ state, dispatch }) => {
Visibility.change(() => {
if (!Visibility.hidden()) {
- // This check is needed to ensure the loading icon
- // is not shown for a finished job during a visibility change
- if (!isTraceReadyForRender && state.job.started) {
- dispatch('startPollingTrace');
- }
dispatch('restartPolling');
} else {
dispatch('stopPolling');
- dispatch('stopPollingTrace');
}
});
};
@@ -177,8 +164,6 @@ export const fetchTrace = ({ dispatch, state }) =>
params: { state: state.traceState },
})
.then(({ data }) => {
- isTraceReadyForRender = data.complete;
-
dispatch('toggleScrollisInBottom', isScrolledToBottom());
dispatch('receiveTraceSuccess', data);
@@ -258,7 +243,7 @@ export const receiveJobsForStageError = ({ commit }) => {
flash(__('An error occurred while fetching the jobs.'));
};
-export const triggerManualJob = ({ state, dispatch }, variables) => {
+export const triggerManualJob = ({ state }, variables) => {
const parsedVariables = variables.map(variable => {
const copyVar = { ...variable };
delete copyVar.id;
@@ -269,6 +254,5 @@ export const triggerManualJob = ({ state, dispatch }, variables) => {
.post(state.job.status.action.path, {
job_variables_attributes: parsedVariables,
})
- .then(() => dispatch('fetchTrace'))
.catch(() => flash(__('An error occurred while triggering the job.')));
};
diff --git a/app/assets/javascripts/jobs/store/mutations.js b/app/assets/javascripts/jobs/store/mutations.js
index dea53f715a7..924b811d0d6 100644
--- a/app/assets/javascripts/jobs/store/mutations.js
+++ b/app/assets/javascripts/jobs/store/mutations.js
@@ -49,7 +49,6 @@ export default {
[types.SET_TRACE_TIMEOUT](state, id) {
state.traceTimeout = id;
- state.isTraceComplete = false;
},
/**
diff --git a/app/assets/javascripts/registry/explorer/components/details_page/tags_list_row.vue b/app/assets/javascripts/registry/explorer/components/details_page/tags_list_row.vue
index 5aeafd318aa..3a5cccc7d08 100644
--- a/app/assets/javascripts/registry/explorer/components/details_page/tags_list_row.vue
+++ b/app/assets/javascripts/registry/explorer/components/details_page/tags_list_row.vue
@@ -63,7 +63,9 @@ export default {
},
computed: {
formattedSize() {
- return this.tag.totalSize ? numberToHumanSize(this.tag.totalSize) : NOT_AVAILABLE_SIZE;
+ return this.tag.totalSize
+ ? numberToHumanSize(Number(this.tag.totalSize))
+ : NOT_AVAILABLE_SIZE;
},
layers() {
return this.tag.layers ? n__('%d layer', '%d layers', this.tag.layers) : '';
diff --git a/app/controllers/projects/jobs_controller.rb b/app/controllers/projects/jobs_controller.rb
index 900ebc61856..d2703f5cc38 100644
--- a/app/controllers/projects/jobs_controller.rb
+++ b/app/controllers/projects/jobs_controller.rb
@@ -49,21 +49,25 @@ class Projects::JobsController < Projects::ApplicationController
# rubocop: enable CodeReuse/ActiveRecord
def trace
- @build.trace.read do |stream|
- respond_to do |format|
- format.json do
- @build.trace.being_watched!
-
- build_trace = Ci::BuildTrace.new(
- build: @build,
- stream: stream,
- state: params[:state])
-
- render json: BuildTraceSerializer
- .new(project: @project, current_user: @current_user)
- .represent(build_trace)
+ @build.trace.being_watched! if @build.running?
+
+ if @build.has_trace?
+ @build.trace.read do |stream|
+ respond_to do |format|
+ format.json do
+ build_trace = Ci::BuildTrace.new(
+ build: @build,
+ stream: stream,
+ state: params[:state])
+
+ render json: BuildTraceSerializer
+ .new(project: @project, current_user: @current_user)
+ .represent(build_trace)
+ end
end
end
+ else
+ head :no_content
end
end
diff --git a/app/graphql/types/container_repository_tag_type.rb b/app/graphql/types/container_repository_tag_type.rb
index 25e605b689d..6de16416395 100644
--- a/app/graphql/types/container_repository_tag_type.rb
+++ b/app/graphql/types/container_repository_tag_type.rb
@@ -11,11 +11,11 @@ module Types
field :name, GraphQL::STRING_TYPE, null: false, description: 'Name of the tag.'
field :path, GraphQL::STRING_TYPE, null: false, description: 'Path of the tag.'
field :location, GraphQL::STRING_TYPE, null: false, description: 'URL of the tag.'
- field :digest, GraphQL::STRING_TYPE, null: false, description: 'Digest of the tag.'
- field :revision, GraphQL::STRING_TYPE, null: false, description: 'Revision of the tag.'
- field :short_revision, GraphQL::STRING_TYPE, null: false, description: 'Short revision of the tag.'
- field :total_size, GraphQL::INT_TYPE, null: false, description: 'The size of the tag.'
- field :created_at, Types::TimeType, null: false, description: 'Timestamp when the tag was created.'
+ field :digest, GraphQL::STRING_TYPE, null: true, description: 'Digest of the tag.'
+ field :revision, GraphQL::STRING_TYPE, null: true, description: 'Revision of the tag.'
+ field :short_revision, GraphQL::STRING_TYPE, null: true, description: 'Short revision of the tag.'
+ field :total_size, GraphQL::Types::BigInt, null: true, description: 'The size of the tag.'
+ field :created_at, Types::TimeType, null: true, description: 'Timestamp when the tag was created.'
field :can_delete, GraphQL::BOOLEAN_TYPE, null: false, description: 'Can the current user delete this tag.'
def can_delete
diff --git a/app/models/clusters/applications/helm.rb b/app/models/clusters/applications/helm.rb
index 6f4b273a2c8..e89cb8be1e7 100644
--- a/app/models/clusters/applications/helm.rb
+++ b/app/models/clusters/applications/helm.rb
@@ -18,7 +18,7 @@ module Clusters
include ::Clusters::Concerns::ApplicationStatus
include ::Gitlab::Utils::StrongMemoize
- default_value_for :version, Gitlab::Kubernetes::Helm::HELM_VERSION
+ default_value_for :version, Gitlab::Kubernetes::Helm::V2::BaseCommand::HELM_VERSION
before_create :create_keys_and_certs
diff --git a/app/models/environment.rb b/app/models/environment.rb
index 31a95bb1b5d..4f7f688a040 100644
--- a/app/models/environment.rb
+++ b/app/models/environment.rb
@@ -405,6 +405,11 @@ class Environment < ApplicationRecord
deployment_platform.patch_ingress(deployment_namespace, ingress, data)
end
+ def clear_all_caches
+ expire_etag_cache
+ clear_reactive_cache!
+ end
+
private
def rollout_status_available?
diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb
index 403fb34803e..3b8c59c6bf8 100644
--- a/app/policies/project_policy.rb
+++ b/app/policies/project_policy.rb
@@ -135,10 +135,6 @@ class ProjectPolicy < BasePolicy
::Feature.enabled?(:build_service_proxy, @subject)
end
- condition(:project_bot_is_member) do
- user.project_bot? & team_member?
- end
-
with_scope :subject
condition(:packages_disabled) { !@subject.packages_enabled }
@@ -619,8 +615,6 @@ class ProjectPolicy < BasePolicy
enable :admin_resource_access_tokens
end
- rule { project_bot_is_member & ~blocked }.enable :bot_log_in
-
private
def user_is_user?
diff --git a/app/services/environments/canary_ingress/update_service.rb b/app/services/environments/canary_ingress/update_service.rb
index 474c3de23d9..2b510280873 100644
--- a/app/services/environments/canary_ingress/update_service.rb
+++ b/app/services/environments/canary_ingress/update_service.rb
@@ -24,6 +24,7 @@ module Environments
end
if environment.patch_ingress(canary_ingress, patch_data)
+ environment.clear_all_caches
success
else
error(_('Failed to update the Canary Ingress.'), :bad_request)