Skip to content
Snippets Groups Projects
Commit c4409ce7 authored by root's avatar root
Browse files

Update from merge request

parent c948b512
No related branches found
No related tags found
No related merge requests found
Pipeline #1704093202 passed
Showing
with 129 additions and 71 deletions
......@@ -26,7 +26,7 @@
extends:
- .qa-job-base
variables:
WORKING_DIR: qa/gems/gitlab-cng
WORKING_DIR: qa/gems/gitlab-orchestrator
cache: *qa-ruby-cng-gems-cache
.e2e-trigger-base:
......
......@@ -760,8 +760,8 @@
- "tooling/ci/job_tokens/docs/templates/fine_grained_permissions.md.erb"
.cng-orchestrator-patterns: &cng-orchestrator-patterns
- "qa/gems/gitlab-cng/**/*.rb"
- "qa/gems/gitlab-cng/{Gemfile,Gemfile.lock}"
- "qa/gems/gitlab-orchestrator/**/*.rb"
- "qa/gems/gitlab-orchestrator/{Gemfile,Gemfile.lock}"
.observability-code-patterns: &observability-code-patterns
# backend
......
......@@ -23,7 +23,7 @@ workflow:
- echo "${EXTRA_DEPLOY_VALUES}" > $CI_PROJECT_DIR/EXTRA_DEPLOY_VALUES
- export GITLAB_DOMAIN="$(getent hosts docker | awk '{ print $1 }' | head -n1).nip.io"
- |
bundle exec cng create deployment "${DEPLOYMENT_TYPE:-kind}" \
bundle exec orchestrator create deployment "${DEPLOYMENT_TYPE:-kind}" \
--gitlab-domain "${GITLAB_DOMAIN}" \
--timeout 5m \
--chart-sha "${GITLAB_HELM_CHART_REF}" \
......@@ -69,11 +69,11 @@ workflow:
echo "SUITE_FAILED=true" >> "$QA_SUITE_STATUS_ENV_FILE"
fi
- cd qa
- bundle exec cng log events --save
- bundle exec cng log pods --save --containers all --no-fail-on-missing-pods
- bundle exec orchestrator log events --save
- bundle exec orchestrator log pods --save --containers all --no-fail-on-missing-pods
# This command prints all the necessary arguments to be able to recreate the same deployment as on CI
- |
bundle exec cng create deployment "${DEPLOYMENT_TYPE}" \
bundle exec orchestrator create deployment "${DEPLOYMENT_TYPE}" \
--chart-sha "${GITLAB_HELM_CHART_REF}" \
--ci \
--print-deploy-args \
......@@ -126,7 +126,7 @@ cng-helm-cache:
allow_failure: true
changes:
- .gitlab/ci/qa-common/variables.gitlab-ci.yml
- qa/gems/gitlab-cng/lib/gitlab/cng/lib/kind/cluster.rb
- qa/gems/gitlab-orchestrator/lib/gitlab/orchestrator/lib/kind/cluster.rb
cng-instance:
extends:
......
......@@ -59,10 +59,10 @@ export default {
i18n: {
actionPrimaryText: s__('MlModelRegistry|Delete model'),
deleteConfirmationText: s__(
'MlExperimentTracking|Are you sure you would like to delete this model?',
'MlModelRegistry|Are you sure you would like to delete this model?',
),
deleteConfirmationNote: s__(
'MlExperimentTracking|Deleting this model also deletes all its versions, including any imported or uploaded artifacts, and their associated settings.',
'MlModelRegistry|Deleting this model also deletes all its versions, including any imported or uploaded artifacts, and their associated settings.',
),
},
};
......
......@@ -93,11 +93,11 @@ export default {
sortableFields: [
{
orderBy: LIST_KEY_VERSION,
label: s__('MlExperimentTracking|Version'),
label: s__('MlModelRegistry|Version'),
},
{
orderBy: LIST_KEY_CREATED_AT,
label: s__('MlExperimentTracking|Created'),
label: s__('MlModelRegistry|Created'),
},
],
emptyState: {
......
......@@ -9,11 +9,11 @@ export const SORT_KEY_ORDER = 'DESC';
export const BASE_SORT_FIELDS = Object.freeze([
{
orderBy: 'name',
label: s__('MlExperimentTracking|Name'),
label: s__('MlModelRegistry|Name'),
},
{
orderBy: LIST_KEY_CREATED_AT,
label: s__('MlExperimentTracking|Created'),
label: s__('MlModelRegistry|Created'),
},
]);
......
......@@ -239,7 +239,7 @@ export default {
<span class="gl-flex gl-flex-col gl-leading-24">
<span class="gl-text-sm gl-font-bold">
{{ item.text }}
<gl-emoji data-name="rocket" />
<gl-emoji data-name="rocket" aria-hidden="true" />
</span>
<span>
<span class="gl-mr-2">{{ item.version }}</span>
......@@ -258,8 +258,10 @@ export default {
<template #list-item="{ item }">
<span class="-gl-my-1 gl-flex gl-items-center gl-justify-between">
{{ item.text }}
<gl-badge v-if="item.count" pill variant="info">{{ item.count }}</gl-badge>
<kbd v-else-if="item.shortcut" class="flat">?</kbd>
<gl-badge v-if="item.count" pill variant="info" aria-hidden="true">{{
item.count
}}</gl-badge>
<kbd v-else-if="item.shortcut" aria-hidden="true" class="flat">?</kbd>
</span>
</template>
</gl-disclosure-dropdown-group>
......
......@@ -571,6 +571,22 @@ def deploy_freezes
end
end
def ensure_environment_tier
self.tier ||= guess_tier
end
def set_default_auto_stop_setting
self.auto_stop_setting = if Feature.enabled?(:new_default_for_auto_stop, project)
if production? || staging?
:with_action
else
:always
end
else
:always
end
end
private
def run_stop_action!(job, link_identity:)
......@@ -617,10 +633,6 @@ def generate_slug
self.slug = Gitlab::Slug::Environment.new(name).generate
end
def ensure_environment_tier
self.tier ||= guess_tier
end
def merge_request_not_changed
if merge_request_id_changed? && persisted?
errors.add(:merge_request, 'merge_request cannot be changed')
......
......@@ -20,7 +20,10 @@ def execute
end
begin
environment = project.environments.create!(**params.slice(*ALLOWED_ATTRIBUTES))
environment = project.environments.new(**params.slice(*ALLOWED_ATTRIBUTES))
environment.ensure_environment_tier
environment.set_default_auto_stop_setting unless params[:auto_stop_setting]
environment.save!
ServiceResponse.success(payload: { environment: environment })
rescue ActiveRecord::RecordInvalid => err
ServiceResponse.error(message: err.record.errors.full_messages, payload: { environment: nil })
......
......@@ -2,7 +2,7 @@
= s_('UsageQuota|Usage of resources across your projects')
- content_for :usage_quotas_alerts do
= render 'shared/shared_runners_minutes_limit', namespace: @namespace, usage_quotas_link_hidden: true, classes: 'gl-my-3'
= render_if_exists 'shared/shared_runners_minutes_limit', namespace: @namespace, usage_quotas_link_hidden: true, classes: 'gl-my-3'
- content_for :usage_quotas_tabs do
= render_if_exists 'shared/usage_quotas/tabs_content/pipelines'
......
---
name: new_default_for_auto_stop
feature_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/428625
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/181746
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/523169
milestone: '17.10'
group: group::environments
type: beta
default_enabled: false
# frozen_string_literal: true
class ScheduleIndexOnMergeRequestDiffsIdAndProjectId < Gitlab::Database::Migration[2.2]
milestone '17.10'
INDEX_NAME = 'index_merge_request_diffs_on_project_id_and_id'
def up
# rubocop:disable Migration/PreventIndexCreation -- This index will replace index_merge_request_diffs_on_project_id
prepare_async_index :merge_request_diffs, [:project_id, :id], name: INDEX_NAME
# rubocop:enable Migration/PreventIndexCreation
end
def down
unprepare_async_index :merge_request_diffs, [:project_id, :id], name: INDEX_NAME
end
end
caf5f7c0160bc89a8dcbdcc371d432a446b57b90eb83ac41625ec89511a70613
\ No newline at end of file
......@@ -422,6 +422,18 @@ To stop an environment in the GitLab UI:
1. Next to the environment you want to stop, select **Stop**.
1. On the confirmation dialog, select **Stop environment**.
### Default stopping behavior
GitLab automatically stops environments when the associated branch is deleted or merged.
This behavior persists even if no explicit `on_stop` CI/CD job is defined.
However, [issue 428625](https://gitlab.com/gitlab-org/gitlab/-/issues/428625) proposes to change this behavior
so that production and staging environments would stop only if an explicit `on_stop` CI/CD job is defined.
You can configure an environment's stopping behavior with the
[`auto_stop_setting`](../../api/environments.md#update-an-existing-environment)
parameter in the Environments API.
### Stop an environment when a branch is deleted
You can configure environments to stop when a branch is deleted.
......
......@@ -430,7 +430,7 @@ end
To override a method present in the CE codebase, use `prepend`. It
lets you override a method in a class with a method from a module, while
still having access the class's implementation with `super`.
still having access to the class's implementation with `super`.
There are a few gotchas with it:
......
......@@ -26,6 +26,32 @@ If you are not sure, ask for help in the [`#f_real-time` internal Slack channel]
{{< /alert >}}
## Working Safely with WebSockets
WebSockets are a relatively new technology at GitLab and you should code defensively when
using a WebSocket connection.
### Backwards Compatibility
Treat the connection as ephemeral and ensure the feature you're building is backwards compatible. Ensure critical functionality degrades gracefully when a WebSocket connection isn't available.
You can work on the frontend and backend at the same time because updates over WebSockets
are difficult to simulate without the necessary backend code in place.
However, always deploy backend changes first. It is strongly advised to package the backend
and frontend changes in separate releases or to manage rollout with a Feature Flag, especially
where a new connection is introduced.
This ensures that when the frontend starts subscribing to events, the backend is already prepared
to service them.
### New Connections at Scale
Introducing a new WebSocket connection is particularly risky at scale. If you need to establish a
connection on a new area of the site, perform the steps detailed in the
[Introduce a new WebSocket Connection](#introduce-a-new-websocket-connection) section before going
further.
## Build real-time view components
Prerequisites:
......@@ -330,20 +356,7 @@ of the issue's fields changing, we could extend `Issues::UpdateService` to call
The real-time view component is now functional. Updates to an issue should now propagate immediately into the GitLab UI.
## Deploy real-time view components
WebSockets are a relatively new technology at GitLab, and supporting them at
scale introduces some challenges. For that reason, new features should be rolled
out using the instructions below.
### Shipping a real-time component
You can work on the frontend and backend at the same time, because updates over WebSockets
are difficult to simulate without the necessary backend code in place.
However, it is safer to send changes in separate merge requests and deploy the backend changes first.
This ensures that when the frontend starts subscribing to events, the backend is already prepared
to service them.
## Shipping a real-time component
### Reuse an existing WebSocket connection
......@@ -363,7 +376,7 @@ connections and on downstream services; such as Redis and the primary database.
The first real-time feature to be fully enabled on GitLab.com was
[real-time assignees](https://gitlab.com/gitlab-org/gitlab/-/issues/17589). By comparing
peak throughput to the issue page against peak simultaneous WebSocket connections it is
possible to crudely estimate that each 1 request per second adds
possible to crudely estimate that each 1 request per second to a page adds
approximately 4200 WebSocket connections.
To understand the impact a new feature might have, sum the peak throughput (RPS)
......@@ -373,13 +386,13 @@ to the pages it originates from (`n`) and apply the formula:
(n * 4200) / peak_active_connections
```
Current active connections are visible on
[this Grafana chart](https://dashboards.gitlab.net/d/websockets-main/websockets-overview?viewPanel=1357460996&orgId=1).
This calculation is crude, and should be revised as new features are
deployed. It yields a rough estimate of the capacity that must be
supported, as a proportion of existing capacity.
Current active connections are visible on
[this Grafana chart](https://dashboards.gitlab.net/d/websockets-main/websockets-overview?viewPanel=1357460996&orgId=1).
### Graduated roll-out
New capacity may need to be provisioned to support your changes, depending on
......@@ -399,16 +412,6 @@ of the feature flag ensures that effects can be observed on the
1. Copy in a member of the Plan and Scalability teams to estimate a percentage-based
roll-out plan.
### Backward compatibility
For the duration of the feature flag roll-out and indefinitely thereafter,
real-time features must be backward-compatible, or at least degrade
gracefully. Not all customers have Action Cable enabled, and further work
needs to be done before Action Cable can be enabled by default.
Making real-time a requirement represents a breaking change, so the next
opportunity to do this is version 15.0.
### Real-time infrastructure on GitLab.com
On GitLab.com, WebSocket connections are served from dedicated infrastructure,
......
......@@ -31,8 +31,8 @@ This Rake task:
The `e2e:test-on-cng` child pipeline runs tests against a [Cloud Native GitLab](https://gitlab.com/gitlab-org/build/CNG) installation.
Deployment is managed by the [`cng`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/qa/gems/gitlab-cng/README.md)
orchestrator tool, which you can also use to locally recreate CI/CD deployments.
Deployment is managed by the [`orchestrator`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/qa/gems/gitlab-orchestrator/README.md)
CLI tool, which you can also use to locally recreate CI/CD deployments.
The `e2e:test-on-cng` child pipeline is executed in merge requests and is part of pre-merge validation lifecycle. If any test fails, you can't merge introduced
code changes.
......@@ -67,10 +67,9 @@ This stage is responsible for [allure test report](_index.md#allure-report) gene
To help with debugging:
- Each test job prints a list of arguments that you can pass to the [`cng`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/qa/gems/gitlab-cng/README.md)
orchestrator to exactly recreate the same deployment for local debugging.
- Each test job prints a list of arguments that you can pass to the [`orchestrator`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/qa/gems/gitlab-orchestrator/README.md) to exactly recreate the same deployment for local debugging.
- Cluster events log and all pod logs are saved in E2E test job artifacts.
- `cng` orchestrator automatically outputs all cluster events with errors in the case of failed deployment.
- `orchestrator` automatically outputs all cluster events with errors in the case of failed deployment.
## `e2e:test-on-omnibus`
......
......@@ -72,7 +72,7 @@ class Environments < ::API::Base
optional :kubernetes_namespace, type: String, desc: 'The Kubernetes namespace to associate with this environment'
optional :flux_resource_path, type: String, desc: 'The Flux resource path to associate with this environment'
optional :description, type: String, desc: 'The description of the environment'
optional :auto_stop_setting, type: String, default: "always", values: Environment.auto_stop_settings.keys, desc: 'The auto stop setting for the environment. Allowed values are `always` and `with_action`'
optional :auto_stop_setting, type: String, values: Environment.auto_stop_settings.keys, desc: 'The auto stop setting for the environment. Allowed values are `always` and `with_action`'
end
route_setting :authentication, job_token_allowed: true
route_setting :authorization, job_token_policies: :admin_environments
......
......@@ -36867,15 +36867,9 @@ msgstr ""
msgid "MissingSSHKeyWarningLink|You won't be able to pull or push repositories via SSH until you add an SSH key to your profile"
msgstr ""
 
msgid "MlExperimentTracking|Are you sure you would like to delete this model?"
msgstr ""
msgid "MlExperimentTracking|Create an experiment using MLflow"
msgstr ""
 
msgid "MlExperimentTracking|Created"
msgstr ""
msgid "MlExperimentTracking|Created at"
msgstr ""
 
......@@ -36900,9 +36894,6 @@ msgstr ""
msgid "MlExperimentTracking|Deleting this experiment will also delete its runs and their associated metadata."
msgstr ""
 
msgid "MlExperimentTracking|Deleting this model also deletes all its versions, including any imported or uploaded artifacts, and their associated settings."
msgstr ""
msgid "MlExperimentTracking|Deleting this run will delete the associated parameters, metrics, and metadata."
msgstr ""
 
......@@ -36981,9 +36972,6 @@ msgstr ""
msgid "MlExperimentTracking|Value"
msgstr ""
 
msgid "MlExperimentTracking|Version"
msgstr ""
msgid "MlExperimentTracking|by %{author}"
msgstr ""
 
......@@ -37011,6 +36999,9 @@ msgstr ""
msgid "MlModelRegistry|Are you sure you want to delete this model version?"
msgstr ""
 
msgid "MlModelRegistry|Are you sure you would like to delete this model?"
msgstr ""
msgid "MlModelRegistry|Artifact file creation failed"
msgstr ""
 
......@@ -37062,6 +37053,9 @@ msgstr ""
msgid "MlModelRegistry|Create/Import model"
msgstr ""
 
msgid "MlModelRegistry|Created"
msgstr ""
msgid "MlModelRegistry|Creating a model"
msgstr ""
 
......@@ -37086,6 +37080,9 @@ msgstr ""
msgid "MlModelRegistry|Delete version %{versionName}"
msgstr ""
 
msgid "MlModelRegistry|Deleting this model also deletes all its versions, including any imported or uploaded artifacts, and their associated settings."
msgstr ""
msgid "MlModelRegistry|Deleting this version also deletes all of its imported or uploaded artifacts and its settings."
msgstr ""
 
......@@ -37224,6 +37221,9 @@ msgstr ""
msgid "MlModelRegistry|Must be unique. May not contain spaces."
msgstr ""
 
msgid "MlModelRegistry|Name"
msgstr ""
msgid "MlModelRegistry|New version"
msgstr ""
 
......@@ -48,6 +48,6 @@ group :development do
end
group :ci do
gem 'gitlab-cng', path: 'gems/gitlab-cng'
gem 'gitlab-orchestrator', path: 'gems/gitlab-orchestrator'
gem 'junit_merge', '~> 0.1.2'
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