Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
83d8c1d6
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
83d8c1d6
编写于
1月 22, 2020
作者:
G
GitLab Bot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add latest changes from gitlab-org/gitlab@master
上级
32d52eb6
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
119 addition
and
489 deletion
+119
-489
app/assets/javascripts/monitoring/components/charts/time_series.vue
.../javascripts/monitoring/components/charts/time_series.vue
+1
-4
app/assets/javascripts/monitoring/components/dashboard.vue
app/assets/javascripts/monitoring/components/dashboard.vue
+1
-1
app/assets/javascripts/monitoring/components/panel_type.vue
app/assets/javascripts/monitoring/components/panel_type.vue
+1
-6
app/assets/javascripts/pipelines/components/pipelines_table_row.vue
.../javascripts/pipelines/components/pipelines_table_row.vue
+0
-1
app/views/layouts/nav/sidebar/_project.html.haml
app/views/layouts/nav/sidebar/_project.html.haml
+1
-1
changelogs/unreleased/35552-improve-logging-of-sync-services-alt.yml
...unreleased/35552-improve-logging-of-sync-services-alt.yml
+5
-0
doc/ci/yaml/README.md
doc/ci/yaml/README.md
+1
-1
doc/development/background_migrations.md
doc/development/background_migrations.md
+7
-0
doc/development/ee_features.md
doc/development/ee_features.md
+49
-0
doc/development/i18n/externalization.md
doc/development/i18n/externalization.md
+25
-0
doc/development/scalability.md
doc/development/scalability.md
+16
-16
doc/raketasks/backup_restore.md
doc/raketasks/backup_restore.md
+4
-0
locale/gitlab.pot
locale/gitlab.pot
+5
-5
qa/qa.rb
qa/qa.rb
+0
-2
qa/qa/fixtures/monitored_auto_devops/.gitlab-ci.yml
qa/qa/fixtures/monitored_auto_devops/.gitlab-ci.yml
+0
-337
qa/qa/page/project/operations/metrics.rb
qa/qa/page/project/operations/metrics.rb
+0
-87
qa/qa/page/project/pipeline/index.rb
qa/qa/page/project/pipeline/index.rb
+3
-19
qa/qa/page/project/sub_menus/operations.rb
qa/qa/page/project/sub_menus/operations.rb
+0
-9
未找到文件。
app/assets/javascripts/monitoring/components/charts/time_series.vue
浏览文件 @
83d8c1d6
...
@@ -311,10 +311,7 @@ export default {
...
@@ -311,10 +311,7 @@ export default {
<gl-tooltip
:target=
"() => $refs.graphTitle"
:disabled=
"!showTitleTooltip"
>
<gl-tooltip
:target=
"() => $refs.graphTitle"
:disabled=
"!showTitleTooltip"
>
{{
graphData
.
title
}}
{{
graphData
.
title
}}
</gl-tooltip>
</gl-tooltip>
<div
<div
class=
"prometheus-graph-widgets js-graph-widgets flex-fill"
>
class=
"prometheus-graph-widgets js-graph-widgets flex-fill"
data-qa-selector=
"prometheus_graph_widgets"
>
<slot></slot>
<slot></slot>
</div>
</div>
</div>
</div>
...
...
app/assets/javascripts/monitoring/components/dashboard.vue
浏览文件 @
83d8c1d6
...
@@ -342,7 +342,7 @@ export default {
...
@@ -342,7 +342,7 @@ export default {
</
script
>
</
script
>
<
template
>
<
template
>
<div
class=
"prometheus-graphs"
data-qa-selector=
"prometheus_graphs"
>
<div
class=
"prometheus-graphs"
>
<div
class=
"prometheus-graphs-header gl-p-3 pb-0 border-bottom bg-gray-light"
>
<div
class=
"prometheus-graphs-header gl-p-3 pb-0 border-bottom bg-gray-light"
>
<div
class=
"row"
>
<div
class=
"row"
>
<template
v-if=
"environmentsEndpoint"
>
<template
v-if=
"environmentsEndpoint"
>
...
...
app/assets/javascripts/monitoring/components/panel_type.vue
浏览文件 @
83d8c1d6
...
@@ -138,7 +138,6 @@ export default {
...
@@ -138,7 +138,6 @@ export default {
v-gl-tooltip
v-gl-tooltip
class=
"ml-auto mx-3"
class=
"ml-auto mx-3"
toggle-class=
"btn btn-transparent border-0"
toggle-class=
"btn btn-transparent border-0"
data-qa-selector=
"prometheus_widgets_dropdown"
:right=
"true"
:right=
"true"
:no-caret=
"true"
:no-caret=
"true"
:title=
"__('More actions')"
:title=
"__('More actions')"
...
@@ -162,11 +161,7 @@ export default {
...
@@ -162,11 +161,7 @@ export default {
>
>
{{ __('Generate link to chart') }}
{{ __('Generate link to chart') }}
</gl-dropdown-item>
</gl-dropdown-item>
<gl-dropdown-item
<gl-dropdown-item
v-if=
"alertWidgetAvailable"
v-gl-modal=
"`alert-modal-${index}`"
>
v-if=
"alertWidgetAvailable"
v-gl-modal=
"`alert-modal-${index}`"
data-qa-selector=
"alert_widget_menu_item"
>
{{ __('Alerts') }}
{{ __('Alerts') }}
</gl-dropdown-item>
</gl-dropdown-item>
</gl-dropdown>
</gl-dropdown>
...
...
app/assets/javascripts/pipelines/components/pipelines_table_row.vue
浏览文件 @
83d8c1d6
...
@@ -331,7 +331,6 @@ export default {
...
@@ -331,7 +331,6 @@ export default {
:loading=
"isRetrying"
:loading=
"isRetrying"
:disabled=
"isRetrying"
:disabled=
"isRetrying"
container-class=
"js-pipelines-retry-button btn btn-default btn-retry"
container-class=
"js-pipelines-retry-button btn btn-default btn-retry"
data-qa-selector=
"pipeline_retry_button"
@
click=
"handleRetryClick"
@
click=
"handleRetryClick"
>
>
<icon
name=
"repeat"
/>
<icon
name=
"repeat"
/>
...
...
app/views/layouts/nav/sidebar/_project.html.haml
浏览文件 @
83d8c1d6
...
@@ -232,7 +232,7 @@
...
@@ -232,7 +232,7 @@
-
if
project_nav_tab?
:environments
-
if
project_nav_tab?
:environments
=
nav_link
(
controller: :environments
,
action:
[
:metrics
,
:metrics_redirect
])
do
=
nav_link
(
controller: :environments
,
action:
[
:metrics
,
:metrics_redirect
])
do
=
link_to
metrics_project_environments_path
(
@project
),
title:
_
(
'Metrics'
),
class:
'shortcuts-metrics'
,
data:
{
qa_selector:
'operations_metrics_link'
}
do
=
link_to
metrics_project_environments_path
(
@project
),
title:
_
(
'Metrics'
),
class:
'shortcuts-metrics'
do
%span
%span
=
_
(
'Metrics'
)
=
_
(
'Metrics'
)
...
...
changelogs/unreleased/35552-improve-logging-of-sync-services-alt.yml
0 → 100644
浏览文件 @
83d8c1d6
---
title
:
'
Geo:
Include
host
when
logging'
merge_request
:
22203
author
:
type
:
other
doc/ci/yaml/README.md
浏览文件 @
83d8c1d6
...
@@ -651,7 +651,7 @@ With `only`, individual keys are logically joined by an AND:
...
@@ -651,7 +651,7 @@ With `only`, individual keys are logically joined by an AND:
> NOT((any of refs) AND (any of variables) AND (any of changes) AND (if Kubernetes is active))
> NOT((any of refs) AND (any of variables) AND (any of changes) AND (if Kubernetes is active))
This
, more intuitively, means the keys join by an OR. A functionally equivalent expression
:
This
means the keys are treated as if joined by an OR. This relationship could be described as
:
> (any of refs) OR (any of variables) OR (any of changes) OR (if Kubernetes is active)
> (any of refs) OR (any of variables) OR (any of changes) OR (if Kubernetes is active)
...
...
doc/development/background_migrations.md
浏览文件 @
83d8c1d6
...
@@ -56,6 +56,13 @@ for more details.
...
@@ -56,6 +56,13 @@ for more details.
Make sure that in case that your migration job is going to be retried data
Make sure that in case that your migration job is going to be retried data
integrity is guaranteed.
integrity is guaranteed.
## Background migrations for EE-only features
All the background migration classes for EE-only features should be present in GitLab CE.
For this purpose, an empty class can be created for GitLab CE and for GitLab EE it can be extended
For this purpose, an empty class can be created for GitLab CE, and it can be extended for GitLab EE
as explained in the
[
guidelines for implementing Enterprise Edition features
](
ee_features.md#code-in-libgitlabbackground_migration
)
.
## How It Works
## How It Works
Background migrations are simple classes that define a
`perform`
method. A
Background migrations are simple classes that define a
`perform`
method. A
...
...
doc/development/ee_features.md
浏览文件 @
83d8c1d6
...
@@ -350,6 +350,55 @@ resolve when you add the indentation to the equation.
...
@@ -350,6 +350,55 @@ resolve when you add the indentation to the equation.
EE-specific views should be placed in
`ee/app/views/`
, using extra
EE-specific views should be placed in
`ee/app/views/`
, using extra
sub-directories if appropriate.
sub-directories if appropriate.
### Code in `lib/gitlab/background_migration/`
When you create EE-only background migrations, you have to plan for users that
downgrade GitLab EE to CE. In other words, every EE-only migration has to be present in
CE code but with no implementation, instead you need to extend it on EE side.
GitLab CE:
```
ruby
# lib/gitlab/background_migration/prune_orphaned_geo_events.rb
module
Gitlab
module
BackgroundMigration
class
PruneOrphanedGeoEvents
def
perform
(
table_name
)
end
end
end
end
Gitlab
::
BackgroundMigration
::
PruneOrphanedGeoEvents
.
prepend_if_ee
(
'EE::Gitlab::BackgroundMigration::PruneOrphanedGeoEvents'
)
```
GitLab EE:
```
ruby
# ee/lib/ee/gitlab/background_migration/prune_orphaned_geo_events.rb
module
EE
module
Gitlab
module
BackgroundMigration
module
PruneOrphanedGeoEvents
extend
::
Gitlab
::
Utils
::
Override
override
:perform
def
perform
(
table_name
=
EVENT_TABLES
.
first
)
return
if
::
Gitlab
::
Database
.
read_only?
deleted_rows
=
prune_orphaned_rows
(
table_name
)
table_name
=
next_table
(
table_name
)
if
deleted_rows
.
zero?
::
BackgroundMigrationWorker
.
perform_in
(
RESCHEDULE_DELAY
,
self
.
class
.
name
.
demodulize
,
table_name
)
if
table_name
end
end
end
end
end
```
#### Using `render_if_exists`
#### Using `render_if_exists`
Instead of using regular
`render`
, we should use
`render_if_exists`
, which
Instead of using regular
`render`
, we should use
`render_if_exists`
, which
...
...
doc/development/i18n/externalization.md
浏览文件 @
83d8c1d6
...
@@ -195,6 +195,31 @@ For example use `%{created_at}` in Ruby but `%{createdAt}` in JavaScript. Make s
...
@@ -195,6 +195,31 @@ For example use `%{created_at}` in Ruby but `%{createdAt}` in JavaScript. Make s
// => When x == 2: 'Last 2 days'
// => When x == 2: 'Last 2 days'
```
```
The
`n_`
method should only be used to fetch pluralized translations of the same
string, not to control the logic of showing different strings for different
quantities. Some languages have different quantities of target plural forms -
Chinese (simplified), for example, has only one target plural form in our
translation tool. This means the translator would have to choose to translate
only one of the strings and the translation would not behave as intended in the
other case.
For example, prefer to use:
```
ruby
if
selected_projects
.
one?
selected_projects
.
first
.
name
else
n__
(
"Project selected"
,
"%d projects selected"
,
selected_projects
.
count
)
end
```
rather than:
```
ruby
# incorrect usage example
n_
(
"%{project_name}"
,
"%d projects selected"
,
count
)
%
{
project_name:
'GitLab'
}
```
### Namespaces
### Namespaces
Sometimes you need to add some context to the text that you want to translate
Sometimes you need to add some context to the text that you want to translate
...
...
doc/development/scalability.md
浏览文件 @
83d8c1d6
...
@@ -104,10 +104,10 @@ GitLab.com](https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/7356).
...
@@ -104,10 +104,10 @@ GitLab.com](https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/7356).
There are several strategies to provide high-availability and redundancy:
There are several strategies to provide high-availability and redundancy:
1.
Write-ahead logs (WAL) streamed to object storage (e.g. S3, Google Cloud
-
Write-ahead logs (WAL) streamed to object storage (e.g. S3, Google Cloud
Storage).
Storage).
1.
Read-replicas (hot backups)
-
Read-replicas (hot backups).
1.
Delayed replicas
-
Delayed replicas.
To restore a database from a point in time, a base backup needs to have
To restore a database from a point in time, a base backup needs to have
been taken prior to that incident. Once a database has restored from
been taken prior to that incident. Once a database has restored from
...
@@ -145,9 +145,9 @@ saturate a single core, which can result in slower response times for
...
@@ -145,9 +145,9 @@ saturate a single core, which can result in slower response times for
background job and/or Web requests. There are two ways to address this
background job and/or Web requests. There are two ways to address this
limitation:
limitation:
1.
Run multiple PgBouncer instances
-
Run multiple PgBouncer instances.
1.
Use a multi-threaded connection pooler (e.g.
-
Use a multi-threaded connection pooler (e.g.
[
Odyssey
](
https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/7776
)
.
[
Odyssey
](
https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/7776
)
.
On some Linux systems, it's possible to run
[
multiple PgBouncer instances on
On some Linux systems, it's possible to run
[
multiple PgBouncer instances on
the same port
](
https://gitlab.com/gitlab-org/omnibus-gitlab/issues/4796
)
.
the same port
](
https://gitlab.com/gitlab-org/omnibus-gitlab/issues/4796
)
.
...
@@ -158,9 +158,9 @@ avoid saturating a single core.
...
@@ -158,9 +158,9 @@ avoid saturating a single core.
In addition, the PgBouncer instances that communicate with the primary
In addition, the PgBouncer instances that communicate with the primary
and secondaries are set up a bit differently:
and secondaries are set up a bit differently:
1.
Multiple PgBouncer instances in different availability zones talk to the
-
Multiple PgBouncer instances in different availability zones talk to the
PostgreSQL primary
PostgreSQL primary.
1.
Multiple PgBouncer processes are colocated with PostgreSQL read replicas
-
Multiple PgBouncer processes are colocated with PostgreSQL read replicas.
For replicas, colocating is advantageous because it reduces network hops
For replicas, colocating is advantageous because it reduces network hops
and hence latency. However, for the primary, colocating is
and hence latency. However, for the primary, colocating is
...
@@ -211,10 +211,10 @@ Redis process.
...
@@ -211,10 +211,10 @@ Redis process.
#### High availability/Risks
#### High availability/Risks
1.
Single-core: Like PgBouncer, a single Redis process can only use one
Single-core: Like PgBouncer, a single Redis process can only use one
core. It does not support multi-threading.
core. It does not support multi-threading.
1.
Dumb secondaries: Redis secondaries (aka slaves) don't actually
Dumb secondaries: Redis secondaries (aka slaves) don't actually
handle any load. Unlike PostgreSQL secondaries, they don't even serve
handle any load. Unlike PostgreSQL secondaries, they don't even serve
read queries. They simply replicate data from the primary and take over
read queries. They simply replicate data from the primary and take over
only when the primary fails.
only when the primary fails.
...
@@ -240,10 +240,10 @@ Sidekiq is a multi-threaded, background job processing system used in
...
@@ -240,10 +240,10 @@ Sidekiq is a multi-threaded, background job processing system used in
Ruby on Rails applications. In GitLab, Sidekiq performs the heavy
Ruby on Rails applications. In GitLab, Sidekiq performs the heavy
lifting of many activities, including:
lifting of many activities, including:
1.
Updating merge requests after a push
-
Updating merge requests after a push.
1.
Sending e-mails
-
Sending e-mails.
1.
Updating user authorizations
-
Updating user authorizations.
1.
Processing CI builds and pipelines
-
Processing CI builds and pipelines.
The full list of jobs can be found in the
The full list of jobs can be found in the
[
app/workers
](
https://gitlab.com/gitlab-org/gitlab/tree/master/app/workers
)
[
app/workers
](
https://gitlab.com/gitlab-org/gitlab/tree/master/app/workers
)
...
...
doc/raketasks/backup_restore.md
浏览文件 @
83d8c1d6
...
@@ -634,6 +634,10 @@ before attempting to perform it in a production environment.
...
@@ -634,6 +634,10 @@ before attempting to perform it in a production environment.
You can only restore a backup to
**exactly the same version and type (CE/EE)**
of
You can only restore a backup to
**exactly the same version and type (CE/EE)**
of
GitLab that you created it on, for example CE 9.1.0.
GitLab that you created it on, for example CE 9.1.0.
If your backup is a different version than the current installation, you will
need to
[
downgrade your GitLab installation
](
https://docs.gitlab.com/omnibus/update/README.html#downgrading
)
before restoring the backup.
### Restore prerequisites
### Restore prerequisites
You need to have a working GitLab installation before you can perform
You need to have a working GitLab installation before you can perform
...
...
locale/gitlab.pot
浏览文件 @
83d8c1d6
...
@@ -5742,11 +5742,6 @@ msgstr ""
...
@@ -5742,11 +5742,6 @@ msgstr ""
msgid "CycleAnalyticsStage|should be under a group"
msgid "CycleAnalyticsStage|should be under a group"
msgstr ""
msgstr ""
msgid "CycleAnalytics|%{projectName}"
msgid_plural "CycleAnalytics|%d projects selected"
msgstr[0] ""
msgstr[1] ""
msgid "CycleAnalytics|%{stageCount} stages selected"
msgid "CycleAnalytics|%{stageCount} stages selected"
msgstr ""
msgstr ""
...
@@ -5768,6 +5763,11 @@ msgstr ""
...
@@ -5768,6 +5763,11 @@ msgstr ""
msgid "CycleAnalytics|Number of tasks"
msgid "CycleAnalytics|Number of tasks"
msgstr ""
msgstr ""
msgid "CycleAnalytics|Project selected"
msgid_plural "CycleAnalytics|%d projects selected"
msgstr[0] ""
msgstr[1] ""
msgid "CycleAnalytics|Select labels"
msgid "CycleAnalytics|Select labels"
msgstr ""
msgstr ""
...
...
qa/qa.rb
浏览文件 @
83d8c1d6
...
@@ -289,8 +289,6 @@ module QA
...
@@ -289,8 +289,6 @@ module QA
autoload
:AddExisting
,
'qa/page/project/operations/kubernetes/add_existing'
autoload
:AddExisting
,
'qa/page/project/operations/kubernetes/add_existing'
autoload
:Show
,
'qa/page/project/operations/kubernetes/show'
autoload
:Show
,
'qa/page/project/operations/kubernetes/show'
end
end
autoload
:Metrics
,
'qa/page/project/operations/metrics'
end
end
module
Wiki
module
Wiki
...
...
qa/qa/fixtures/monitored_auto_devops/.gitlab-ci.yml
已删除
100644 → 0
浏览文件 @
32d52eb6
# This is stripped down version of the .gitlab-ci.yml found
# here: https://gitlab.com/joshlambert/autodevops-deploy.
#
# It performs only the deploy stage.
image
:
alpine:latest
variables
:
# AUTO_DEVOPS_DOMAIN is the application deployment domain and should be set as a variable at the group or project level.
AUTO_DEVOPS_DOMAIN
:
my-fake-domain.com
POSTGRES_USER
:
user
POSTGRES_PASSWORD
:
testing-password
POSTGRES_ENABLED
:
'
false'
POSTGRES_DB
:
$CI_ENVIRONMENT_SLUG
KUBERNETES_VERSION
:
1.11.6
HELM_VERSION
:
2.12.2
DOCKER_DRIVER
:
overlay2
stages
:
-
production
# This job continuously deploys to production on every push to `master`.
production
:
stage
:
production
script
:
-
check_kube_domain
-
install_dependencies
-
download_chart
-
ensure_namespace
-
initialize_tiller
-
create_secret
-
deploy
-
persist_environment_url
environment
:
name
:
production
url
:
http://$CI_PROJECT_PATH_SLUG.$AUTO_DEVOPS_DOMAIN
artifacts
:
paths
:
[
environment_url.txt
]
only
:
refs
:
-
master
kubernetes
:
active
# ---------------------------------------------------------------------------
.auto_devops
:
&auto_devops
|
# Auto DevOps variables and functions
[[ "$TRACE" ]] && set -x
auto_database_url=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${CI_ENVIRONMENT_SLUG}-postgres:5432/${POSTGRES_DB}
export DATABASE_URL=${DATABASE_URL-$auto_database_url}
export CI_APPLICATION_REPOSITORY=$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG
export CI_APPLICATION_TAG=$CI_COMMIT_SHA
export CI_CONTAINER_NAME=ci_job_build_${CI_JOB_ID}
export TILLER_NAMESPACE=$KUBE_NAMESPACE
# Extract "MAJOR.MINOR" from CI_SERVER_VERSION and generate "MAJOR-MINOR-stable" for Security Products
export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
function get_replicas() {
track="${1:-stable}"
percentage="${2:-100}"
env_track=$( echo $track | tr -s '[:lower:]' '[:upper:]' )
env_slug=$( echo ${CI_ENVIRONMENT_SLUG//-/_} | tr -s '[:lower:]' '[:upper:]' )
if [[ "$track" == "stable" ]] || [[ "$track" == "rollout" ]]; then
# for stable track get number of replicas from `PRODUCTION_REPLICAS`
eval new_replicas=\$${env_slug}_REPLICAS
if [[ -z "$new_replicas" ]]; then
new_replicas=$REPLICAS
fi
else
# for all tracks get number of replicas from `CANARY_PRODUCTION_REPLICAS`
eval new_replicas=\$${env_track}_${env_slug}_REPLICAS
if [[ -z "$new_replicas" ]]; then
eval new_replicas=\${env_track}_REPLICAS
fi
fi
replicas="${new_replicas:-1}"
replicas="$(($replicas * $percentage / 100))"
# always return at least one replicas
if [[ $replicas -gt 0 ]]; then
echo "$replicas"
else
echo 1
fi
}
# Extracts variables prefixed with K8S_SECRET_
# and creates a Kubernetes secret.
#
# e.g. If we have the following environment variables:
# K8S_SECRET_A=value1
# K8S_SECRET_B=multi\ word\ value
#
# Then we will create a secret with the following key-value pairs:
# data:
# A: dmFsdWUxCg==
# B: bXVsdGkgd29yZCB2YWx1ZQo=
function create_application_secret() {
track="${1-stable}"
export APPLICATION_SECRET_NAME=$(application_secret_name "$track")
env | sed -n "s/^K8S_SECRET_\(.*\)$/\1/p" > k8s_prefixed_variables
kubectl create secret \
-n "$KUBE_NAMESPACE" generic "$APPLICATION_SECRET_NAME" \
--from-env-file k8s_prefixed_variables -o yaml --dry-run |
kubectl replace -n "$KUBE_NAMESPACE" --force -f -
export APPLICATION_SECRET_CHECKSUM=$(cat k8s_prefixed_variables | sha256sum | cut -d ' ' -f 1)
rm k8s_prefixed_variables
}
function deploy_name() {
name="$CI_ENVIRONMENT_SLUG"
track="${1-stable}"
if [[ "$track" != "stable" ]]; then
name="$name-$track"
fi
echo $name
}
function application_secret_name() {
track="${1-stable}"
name=$(deploy_name "$track")
echo "${name}-secret"
}
function deploy() {
track="${1-stable}"
percentage="${2:-100}"
name=$(deploy_name "$track")
replicas="1"
service_enabled="true"
postgres_enabled="$POSTGRES_ENABLED"
# if track is different than stable,
# re-use all attached resources
if [[ "$track" != "stable" ]]; then
service_enabled="false"
postgres_enabled="false"
fi
replicas=$(get_replicas "$track" "$percentage")
if [[ "$CI_PROJECT_VISIBILITY" != "public" ]]; then
secret_name='gitlab-registry'
else
secret_name=''
fi
create_application_secret "$track"
env_slug=$(echo ${CI_ENVIRONMENT_SLUG//-/_} | tr -s '[:lower:]' '[:upper:]')
eval env_ADDITIONAL_HOSTS=\$${env_slug}_ADDITIONAL_HOSTS
if [ -n "$env_ADDITIONAL_HOSTS" ]; then
additional_hosts="{$env_ADDITIONAL_HOSTS}"
elif [ -n "$ADDITIONAL_HOSTS" ]; then
additional_hosts="{$ADDITIONAL_HOSTS}"
fi
if [[ -n "$DB_INITIALIZE" && -z "$(helm ls -q "^$name$")" ]]; then
echo "Deploying first release with database initialization..."
helm upgrade --install \
--wait \
--set service.enabled="$service_enabled" \
--set releaseOverride="$CI_ENVIRONMENT_SLUG" \
--set image.repository="registry.gitlab.com/joshlambert/ruby-gke/master" \
--set image.tag="63492726c2264a0277141d6a6573c3d22ecd7de3" \
--set image.pullPolicy=IfNotPresent \
--set image.secrets[0].name="$secret_name" \
--set application.track="$track" \
--set application.database_url="$DATABASE_URL" \
--set application.secretName="$APPLICATION_SECRET_NAME" \
--set application.secretChecksum="$APPLICATION_SECRET_CHECKSUM" \
--set service.url="$CI_ENVIRONMENT_URL" \
--set service.additionalHosts="$additional_hosts" \
--set replicaCount="$replicas" \
--set postgresql.enabled="$postgres_enabled" \
--set postgresql.nameOverride="postgres" \
--set postgresql.postgresUser="$POSTGRES_USER" \
--set postgresql.postgresPassword="$POSTGRES_PASSWORD" \
--set postgresql.postgresDatabase="$POSTGRES_DB" \
--set application.initializeCommand="$DB_INITIALIZE" \
--set gitlab.app="$CI_PROJECT_PATH_SLUG" \
--set gitlab.env="$CI_ENVIRONMENT_SLUG" \
--namespace="$KUBE_NAMESPACE" \
"$name" \
chart/
echo "Deploying second release..."
helm upgrade --reuse-values \
--wait \
--set application.initializeCommand="" \
--set application.migrateCommand="$DB_MIGRATE" \
--namespace="$KUBE_NAMESPACE" \
"$name" \
chart/
else
echo "Deploying new release..."
helm upgrade --install \
--wait \
--set service.enabled="$service_enabled" \
--set releaseOverride="$CI_ENVIRONMENT_SLUG" \
--set image.repository="registry.gitlab.com/joshlambert/ruby-gke/master" \
--set image.tag="63492726c2264a0277141d6a6573c3d22ecd7de3" \
--set image.pullPolicy=IfNotPresent \
--set image.secrets[0].name="$secret_name" \
--set application.track="$track" \
--set application.database_url="$DATABASE_URL" \
--set application.secretName="$APPLICATION_SECRET_NAME" \
--set application.secretChecksum="$APPLICATION_SECRET_CHECKSUM" \
--set service.url="$CI_ENVIRONMENT_URL" \
--set service.additionalHosts="$additional_hosts" \
--set replicaCount="$replicas" \
--set postgresql.enabled="$postgres_enabled" \
--set postgresql.nameOverride="postgres" \
--set postgresql.postgresUser="$POSTGRES_USER" \
--set postgresql.postgresPassword="$POSTGRES_PASSWORD" \
--set postgresql.postgresDatabase="$POSTGRES_DB" \
--set application.migrateCommand="$DB_MIGRATE" \
--set gitlab.app="$CI_PROJECT_PATH_SLUG" \
--set gitlab.env="$CI_ENVIRONMENT_SLUG" \
--namespace="$KUBE_NAMESPACE" \
"$name" \
chart/
fi
kubectl rollout status -n "$KUBE_NAMESPACE" -w "deployment/$name"
}
function install_dependencies() {
apk add -U openssl curl tar gzip bash ca-certificates git
wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.23-r3/glibc-2.23-r3.apk
apk add glibc-2.23-r3.apk
rm glibc-2.23-r3.apk
curl "https://kubernetes-helm.storage.googleapis.com/helm-v${HELM_VERSION}-linux-amd64.tar.gz" | tar zx
mv linux-amd64/helm /usr/bin/
mv linux-amd64/tiller /usr/bin/
helm version --client
tiller -version
curl -L -o /usr/bin/kubectl "https://storage.googleapis.com/kubernetes-release/release/v${KUBERNETES_VERSION}/bin/linux/amd64/kubectl"
chmod +x /usr/bin/kubectl
kubectl version --client
}
function download_chart() {
if [[ ! -d chart ]]; then
auto_chart=${AUTO_DEVOPS_CHART:-gitlab/auto-deploy-app}
auto_chart_name=$(basename $auto_chart)
auto_chart_name=${auto_chart_name%.tgz}
else
auto_chart="chart"
auto_chart_name="chart"
fi
helm init --client-only
helm repo add gitlab https://charts.gitlab.io
if [[ ! -d "$auto_chart" ]]; then
helm fetch ${auto_chart} --untar
fi
if [ "$auto_chart_name" != "chart" ]; then
mv ${auto_chart_name} chart
fi
helm dependency update chart/
helm dependency build chart/
}
function ensure_namespace() {
kubectl describe namespace "$KUBE_NAMESPACE" || kubectl create namespace "$KUBE_NAMESPACE"
}
function check_kube_domain() {
if [ -z ${AUTO_DEVOPS_DOMAIN+x} ]; then
echo "In order to deploy or use Review Apps, AUTO_DEVOPS_DOMAIN variable must be set"
echo "You can do it in Auto DevOps project settings or defining a secret variable at group or project level"
echo "You can also manually add it in .gitlab-ci.yml"
false
else
true
fi
}
function initialize_tiller() {
echo "Checking Tiller..."
export HELM_HOST="localhost:44134"
tiller -listen ${HELM_HOST} -alsologtostderr > /dev/null 2>&1 &
echo "Tiller is listening on ${HELM_HOST}"
if ! helm version --debug; then
echo "Failed to init Tiller."
return 1
fi
echo ""
}
function create_secret() {
echo "Create secret..."
if [[ "$CI_PROJECT_VISIBILITY" == "public" ]]; then
return
fi
kubectl create secret -n "$KUBE_NAMESPACE" \
docker-registry gitlab-registry \
--docker-server="$CI_REGISTRY" \
--docker-username="$CI_REGISTRY_USER" \
--docker-password="$CI_REGISTRY_PASSWORD" \
--docker-email="$GITLAB_USER_EMAIL" \
-o yaml --dry-run | kubectl replace -n "$KUBE_NAMESPACE" --force -f -
}
function persist_environment_url() {
echo $CI_ENVIRONMENT_URL > environment_url.txt
}
before_script
:
-
*auto_devops
qa/qa/page/project/operations/metrics.rb
已删除
100644 → 0
浏览文件 @
32d52eb6
# frozen_string_literal: true
module
QA
module
Page
module
Project
module
Operations
class
Metrics
<
Page
::
Base
EXPECTED_TITLE
=
'Memory Usage (Total)'
EXPECTED_LABEL
=
'Total (GB)'
LOADING_MESSAGE
=
'Waiting for performance data'
view
'app/assets/javascripts/monitoring/components/dashboard.vue'
do
element
:prometheus_graphs
end
view
'app/assets/javascripts/monitoring/components/charts/time_series.vue'
do
element
:prometheus_graph_widgets
end
view
'app/assets/javascripts/monitoring/components/panel_type.vue'
do
element
:prometheus_widgets_dropdown
element
:alert_widget_menu_item
end
view
'ee/app/assets/javascripts/monitoring/components/alert_widget_form.vue'
do
element
:alert_query_dropdown
element
:alert_query_option
element
:alert_threshold_field
end
def
wait_for_metrics
wait_for_data
return
if
has_metrics?
wait_until
(
max_duration:
180
)
do
wait_for_data
has_metrics?
end
end
def
wait_for_data
wait_until
(
reload:
false
)
{
!
has_text?
(
LOADING_MESSAGE
)
}
if
has_text?
(
LOADING_MESSAGE
)
end
def
has_metrics?
within_element
:prometheus_graphs
do
has_text?
(
EXPECTED_TITLE
)
end
end
def
wait_for_alert
(
operator
=
'>'
,
threshold
=
0
)
wait_until
(
reload:
false
)
{
has_alert?
(
operator
,
threshold
)
}
end
def
has_alert?
(
operator
=
'>'
,
threshold
=
0
)
within_element
:prometheus_graphs
do
has_text?
([
EXPECTED_LABEL
,
operator
,
threshold
].
join
(
' '
))
end
end
def
write_first_alert
(
operator
=
'>'
,
threshold
=
0
)
open_first_alert_modal
click_on
operator
fill_element
:alert_threshold_field
,
threshold
within
(
'.modal-content'
)
{
click_button
(
class:
'btn-success'
)
}
end
def
delete_first_alert
open_first_alert_modal
within
(
'.modal-content'
)
{
click_button
(
class:
'btn-danger'
)
}
wait_for_requests
end
def
open_first_alert_modal
all_elements
(
:prometheus_widgets_dropdown
,
minimum:
1
).
first
.
click
click_element
:alert_widget_menu_item
click_element
:alert_query_dropdown
unless
has_element?
(
:alert_query_option
,
wait:
3
)
all_elements
(
:alert_query_option
,
minimum:
1
).
first
.
click
end
end
end
end
end
end
qa/qa/page/project/pipeline/index.rb
浏览文件 @
83d8c1d6
...
@@ -9,7 +9,6 @@ module QA::Page
...
@@ -9,7 +9,6 @@ module QA::Page
view
'app/assets/javascripts/pipelines/components/pipelines_table_row.vue'
do
view
'app/assets/javascripts/pipelines/components/pipelines_table_row.vue'
do
element
:pipeline_commit_status
element
:pipeline_commit_status
element
:pipeline_retry_button
end
end
def
click_on_latest_pipeline
def
click_on_latest_pipeline
...
@@ -19,25 +18,10 @@ module QA::Page
...
@@ -19,25 +18,10 @@ module QA::Page
end
end
def
wait_for_latest_pipeline_success
def
wait_for_latest_pipeline_success
wait_for_latest_pipeline_status
{
has_text?
(
'passed'
)
}
end
def
wait_for_latest_pipeline_completion
wait_for_latest_pipeline_status
{
has_text?
(
'passed'
)
||
has_text?
(
'failed'
)
}
end
def
wait_for_latest_pipeline_status
wait_until
(
reload:
false
,
max_duration:
300
)
do
wait_until
(
reload:
false
,
max_duration:
300
)
do
within_element_by_index
(
:pipeline_commit_status
,
0
)
{
yield
}
within_element_by_index
(
:pipeline_commit_status
,
0
)
do
end
has_text?
(
'passed'
)
end
end
def
wait_for_latest_pipeline_success_or_retry
wait_for_latest_pipeline_completion
if
has_text?
(
'failed'
)
click_element
:pipeline_retry_button
wait_for_latest_pipeline_success
end
end
end
end
end
end
...
...
qa/qa/page/project/sub_menus/operations.rb
浏览文件 @
83d8c1d6
...
@@ -12,7 +12,6 @@ module QA
...
@@ -12,7 +12,6 @@ module QA
view
'app/views/layouts/nav/sidebar/_project.html.haml'
do
view
'app/views/layouts/nav/sidebar/_project.html.haml'
do
element
:link_operations
element
:link_operations
element
:operations_environments_link
element
:operations_environments_link
element
:operations_metrics_link
end
end
end
end
end
end
...
@@ -25,14 +24,6 @@ module QA
...
@@ -25,14 +24,6 @@ module QA
end
end
end
end
def
go_to_operations_metrics
hover_operations
do
within_submenu
do
click_element
(
:operations_metrics_link
)
end
end
end
def
go_to_operations_kubernetes
def
go_to_operations_kubernetes
hover_operations
do
hover_operations
do
within_submenu
do
within_submenu
do
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录