Commit f4dd12eb authored by GitLab Bot's avatar GitLab Bot

Merge remote-tracking branch 'upstream/master' into ce-to-ee-2018-04-02

# Conflicts:
#	app/models/ci/build.rb
#	doc/ci/variables/README.md

[ci skip]
parents 16967419 055a02ed
...@@ -6,7 +6,6 @@ end ...@@ -6,7 +6,6 @@ end
gem_versions = {} gem_versions = {}
gem_versions['activerecord_sane_schema_dumper'] = rails5? ? '1.0' : '0.2' gem_versions['activerecord_sane_schema_dumper'] = rails5? ? '1.0' : '0.2'
gem_versions['default_value_for'] = rails5? ? '~> 3.0.5' : '~> 3.0.0' gem_versions['default_value_for'] = rails5? ? '~> 3.0.5' : '~> 3.0.0'
gem_versions['html-pipeline'] = rails5? ? '~> 2.6.0' : '~> 1.11.0'
gem_versions['rails'] = rails5? ? '5.0.6' : '4.2.10' gem_versions['rails'] = rails5? ? '5.0.6' : '4.2.10'
gem_versions['rails-i18n'] = rails5? ? '~> 5.1' : '~> 4.0.9' gem_versions['rails-i18n'] = rails5? ? '~> 5.1' : '~> 4.0.9'
# --- The end of special code for migrating to Rails 5.0 --- # --- The end of special code for migrating to Rails 5.0 ---
...@@ -146,7 +145,7 @@ gem 'aws-sdk' ...@@ -146,7 +145,7 @@ gem 'aws-sdk'
gem 'faraday_middleware-aws-signers-v4' gem 'faraday_middleware-aws-signers-v4'
# Markdown and HTML processing # Markdown and HTML processing
gem 'html-pipeline', gem_versions['html-pipeline'] gem 'html-pipeline', '~> 2.7.1'
gem 'deckar01-task_list', '2.0.0' gem 'deckar01-task_list', '2.0.0'
gem 'gitlab-markup', '~> 1.6.2' gem 'gitlab-markup', '~> 1.6.2'
gem 'redcarpet', '~> 3.4' gem 'redcarpet', '~> 3.4'
......
...@@ -426,9 +426,9 @@ GEM ...@@ -426,9 +426,9 @@ GEM
hipchat (1.5.2) hipchat (1.5.2)
httparty httparty
mimemagic mimemagic
html-pipeline (1.11.0) html-pipeline (2.7.1)
activesupport (>= 2) activesupport (>= 2)
nokogiri (~> 1.4) nokogiri (>= 1.4)
html2text (0.2.0) html2text (0.2.0)
nokogiri (~> 1.6) nokogiri (~> 1.6)
htmlentities (4.3.4) htmlentities (4.3.4)
...@@ -1119,7 +1119,7 @@ DEPENDENCIES ...@@ -1119,7 +1119,7 @@ DEPENDENCIES
hashie-forbidden_attributes hashie-forbidden_attributes
health_check (~> 2.6.0) health_check (~> 2.6.0)
hipchat (~> 1.5.0) hipchat (~> 1.5.0)
html-pipeline (~> 1.11.0) html-pipeline (~> 2.7.1)
html2text html2text
httparty (~> 0.13.3) httparty (~> 0.13.3)
influxdb (~> 0.2) influxdb (~> 0.2)
......
...@@ -7,8 +7,11 @@ module Ci ...@@ -7,8 +7,11 @@ module Ci
include Presentable include Presentable
include Importable include Importable
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
<<<<<<< HEAD
prepend EE::Ci::Build prepend EE::Ci::Build
=======
>>>>>>> upstream/master
MissingDependenciesError = Class.new(StandardError) MissingDependenciesError = Class.new(StandardError)
...@@ -288,6 +291,7 @@ module Ci ...@@ -288,6 +291,7 @@ module Ci
variables.concat(pipeline.pipeline_schedule.job_variables) if pipeline.pipeline_schedule variables.concat(pipeline.pipeline_schedule.job_variables) if pipeline.pipeline_schedule
end end
end end
<<<<<<< HEAD
## ##
# Variables that do not depend on the environment name. # Variables that do not depend on the environment name.
...@@ -299,6 +303,19 @@ module Ci ...@@ -299,6 +303,19 @@ module Ci
end end
## ##
=======
##
# Variables that do not depend on the environment name.
#
def simple_variables
strong_memoize(:simple_variables) do
scoped_variables(environment: nil).to_runner_variables
end
end
##
>>>>>>> upstream/master
# All variables, including persisted environment variables. # All variables, including persisted environment variables.
# #
def variables def variables
......
...@@ -53,6 +53,10 @@ module Clusters ...@@ -53,6 +53,10 @@ module Clusters
scope :enabled, -> { where(enabled: true) } scope :enabled, -> { where(enabled: true) }
scope :disabled, -> { where(enabled: false) } scope :disabled, -> { where(enabled: false) }
scope :user_provided, -> { where(provider_type: ::Clusters::Cluster.provider_types[:user]) }
scope :gcp_provided, -> { where(provider_type: ::Clusters::Cluster.provider_types[:gcp]) }
scope :gcp_installed, -> { gcp_provided.includes(:provider_gcp).where(cluster_providers_gcp: { status: ::Clusters::Providers::Gcp.state_machines[:status].states[:created].value }) }
scope :default_environment, -> { where(environment_scope: DEFAULT_ENVIRONMENT) } scope :default_environment, -> { where(environment_scope: DEFAULT_ENVIRONMENT) }
def status_name def status_name
......
...@@ -4,6 +4,8 @@ module Clusters ...@@ -4,6 +4,8 @@ module Clusters
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do
scope :installed, -> { where(status: self.state_machines[:status].states[:installed].value) }
state_machine :status, initial: :not_installable do state_machine :status, initial: :not_installable do
state :not_installable, value: -2 state :not_installable, value: -2
state :errored, value: -1 state :errored, value: -1
......
= form_for @application_setting, url: admin_application_settings_path, html: { class: 'form-horizontal fieldset-form' } do |f|
= form_errors(@application_setting)
%fieldset
%p
These settings require a
= link_to 'restart', help_page_path('administration/restart_gitlab')
to take effect.
.form-group
.col-sm-offset-2.col-sm-10
.checkbox
= f.label :sidekiq_throttling_enabled do
= f.check_box :sidekiq_throttling_enabled
Enable Sidekiq Job Throttling
.help-block
Limit the amount of resources slow running jobs are assigned.
.form-group
= f.label :sidekiq_throttling_queues, 'Sidekiq queues to throttle', class: 'control-label col-sm-2'
.col-sm-10
= f.select :sidekiq_throttling_queues, sidekiq_queue_options_for_select, { include_hidden: false }, multiple: true, class: 'select2 select-wide', data: { field: 'sidekiq_throttling_queues' }
.help-block
Choose which queues you wish to throttle.
.form-group
= f.label :sidekiq_throttling_factor, 'Throttling Factor', class: 'control-label col-sm-2'
.col-sm-10
= f.number_field :sidekiq_throttling_factor, class: 'form-control', min: '0.01', max: '0.99', step: '0.01'
.help-block
The factor by which the queues should be throttled. A value between 0.0 and 1.0, exclusive.
= f.submit 'Save changes', class: "btn btn-success"
...@@ -12,111 +12,6 @@ ...@@ -12,111 +12,6 @@
.col-sm-10 .col-sm-10
= f.number_field :container_registry_token_expire_delay, class: 'form-control' = f.number_field :container_registry_token_expire_delay, class: 'form-control'
%fieldset
%legend Profiling - Performance Bar
%p
Enable the Performance Bar for a given group.
= link_to icon('question-circle'), help_page_path('administration/monitoring/performance/performance_bar')
.form-group
.col-sm-offset-2.col-sm-10
.checkbox
= f.label :performance_bar_enabled do
= f.check_box :performance_bar_enabled
Enable the Performance Bar
.form-group
= f.label :performance_bar_allowed_group_id, 'Allowed group', class: 'control-label col-sm-2'
.col-sm-10
= f.text_field :performance_bar_allowed_group_id, class: 'form-control', placeholder: 'my-org/my-group', value: @application_setting.performance_bar_allowed_group&.full_path
%fieldset
%legend Background Jobs
%p
These settings require a
= link_to 'restart', help_page_path('administration/restart_gitlab')
to take effect.
.form-group
.col-sm-offset-2.col-sm-10
.checkbox
= f.label :sidekiq_throttling_enabled do
= f.check_box :sidekiq_throttling_enabled
Enable Sidekiq Job Throttling
.help-block
Limit the amount of resources slow running jobs are assigned.
.form-group
= f.label :sidekiq_throttling_queues, 'Sidekiq queues to throttle', class: 'control-label col-sm-2'
.col-sm-10
= f.select :sidekiq_throttling_queues, sidekiq_queue_options_for_select, { include_hidden: false }, multiple: true, class: 'select2 select-wide', data: { field: 'sidekiq_throttling_queues' }
.help-block
Choose which queues you wish to throttle.
.form-group
= f.label :sidekiq_throttling_factor, 'Throttling Factor', class: 'control-label col-sm-2'
.col-sm-10
= f.number_field :sidekiq_throttling_factor, class: 'form-control', min: '0.01', max: '0.99', step: '0.01'
.help-block
The factor by which the queues should be throttled. A value between 0.0 and 1.0, exclusive.
%fieldset
%legend Spam and Anti-bot Protection
.form-group
.col-sm-offset-2.col-sm-10
.checkbox
= f.label :recaptcha_enabled do
= f.check_box :recaptcha_enabled
Enable reCAPTCHA
%span.help-block#recaptcha_help_block Helps prevent bots from creating accounts
.form-group
= f.label :recaptcha_site_key, 'reCAPTCHA Site Key', class: 'control-label col-sm-2'
.col-sm-10
= f.text_field :recaptcha_site_key, class: 'form-control'
.help-block
Generate site and private keys at
%a{ href: 'http://www.google.com/recaptcha', target: 'blank' } http://www.google.com/recaptcha
.form-group
= f.label :recaptcha_private_key, 'reCAPTCHA Private Key', class: 'control-label col-sm-2'
.col-sm-10
= f.text_field :recaptcha_private_key, class: 'form-control'
.form-group
.col-sm-offset-2.col-sm-10
.checkbox
= f.label :akismet_enabled do
= f.check_box :akismet_enabled
Enable Akismet
%span.help-block#akismet_help_block Helps prevent bots from creating issues
.form-group
= f.label :akismet_api_key, 'Akismet API Key', class: 'control-label col-sm-2'
.col-sm-10
= f.text_field :akismet_api_key, class: 'form-control'
.help-block
Generate API key at
%a{ href: 'http://www.akismet.com', target: 'blank' } http://www.akismet.com
.form-group
.col-sm-offset-2.col-sm-10
.checkbox
= f.label :unique_ips_limit_enabled do
= f.check_box :unique_ips_limit_enabled
Limit sign in from multiple ips
%span.help-block#unique_ip_help_block
Helps prevent malicious users hide their activity
.form-group
= f.label :unique_ips_limit_per_user, 'IPs per user', class: 'control-label col-sm-2'
.col-sm-10
= f.number_field :unique_ips_limit_per_user, class: 'form-control'
.help-block
Maximum number of unique IPs per user
.form-group
= f.label :unique_ips_limit_time_window, 'IP expiration time', class: 'control-label col-sm-2'
.col-sm-10
= f.number_field :unique_ips_limit_time_window, class: 'form-control'
.help-block
How many seconds an IP will be counted towards the limit
%fieldset %fieldset
%legend Abuse reports %legend Abuse reports
.form-group .form-group
......
= form_for @application_setting, url: admin_application_settings_path, html: { class: 'form-horizontal fieldset-form' } do |f|
= form_errors(@application_setting)
%fieldset
.form-group
.col-sm-offset-2.col-sm-10
.checkbox
= f.label :performance_bar_enabled do
= f.check_box :performance_bar_enabled
Enable the Performance Bar
.form-group
= f.label :performance_bar_allowed_group_id, 'Allowed group', class: 'control-label col-sm-2'
.col-sm-10
= f.text_field :performance_bar_allowed_group_id, class: 'form-control', placeholder: 'my-org/my-group', value: @application_setting.performance_bar_allowed_group&.full_path
= f.submit 'Save changes', class: "btn btn-success"
= form_for @application_setting, url: admin_application_settings_path, html: { class: 'form-horizontal fieldset-form' } do |f|
= form_errors(@application_setting)
%fieldset
.form-group
.col-sm-offset-2.col-sm-10
.checkbox
= f.label :recaptcha_enabled do
= f.check_box :recaptcha_enabled
Enable reCAPTCHA
%span.help-block#recaptcha_help_block Helps prevent bots from creating accounts
.form-group
= f.label :recaptcha_site_key, 'reCAPTCHA Site Key', class: 'control-label col-sm-2'
.col-sm-10
= f.text_field :recaptcha_site_key, class: 'form-control'
.help-block
Generate site and private keys at
%a{ href: 'http://www.google.com/recaptcha', target: 'blank' } http://www.google.com/recaptcha
.form-group
= f.label :recaptcha_private_key, 'reCAPTCHA Private Key', class: 'control-label col-sm-2'
.col-sm-10
= f.text_field :recaptcha_private_key, class: 'form-control'
.form-group
.col-sm-offset-2.col-sm-10
.checkbox
= f.label :akismet_enabled do
= f.check_box :akismet_enabled
Enable Akismet
%span.help-block#akismet_help_block Helps prevent bots from creating issues
.form-group
= f.label :akismet_api_key, 'Akismet API Key', class: 'control-label col-sm-2'
.col-sm-10
= f.text_field :akismet_api_key, class: 'form-control'
.help-block
Generate API key at
%a{ href: 'http://www.akismet.com', target: 'blank' } http://www.akismet.com
.form-group
.col-sm-offset-2.col-sm-10
.checkbox
= f.label :unique_ips_limit_enabled do
= f.check_box :unique_ips_limit_enabled
Limit sign in from multiple ips
%span.help-block#unique_ip_help_block
Helps prevent malicious users hide their activity
.form-group
= f.label :unique_ips_limit_per_user, 'IPs per user', class: 'control-label col-sm-2'
.col-sm-10
= f.number_field :unique_ips_limit_per_user, class: 'form-control'
.help-block
Maximum number of unique IPs per user
.form-group
= f.label :unique_ips_limit_time_window, 'IP expiration time', class: 'control-label col-sm-2'
.col-sm-10
= f.number_field :unique_ips_limit_time_window, class: 'form-control'
.help-block
How many seconds an IP will be counted towards the limit
= f.submit 'Save changes', class: "btn btn-success"
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
.settings-header .settings-header
%h4 %h4
= _('Visibility and access controls') = _('Visibility and access controls')
%button.btn.js-settings-toggle %button.btn.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand' = expanded ? 'Collapse' : 'Expand'
%p %p
= _('Set default and restrict visibility levels. Configure import sources and git access protocol.') = _('Set default and restrict visibility levels. Configure import sources and git access protocol.')
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
.settings-header .settings-header
%h4 %h4
= _('Account and limit settings') = _('Account and limit settings')
%button.btn.js-settings-toggle %button.btn.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand' = expanded ? 'Collapse' : 'Expand'
%p %p
= _('Session expiration, projects limit and attachment size.') = _('Session expiration, projects limit and attachment size.')
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
.settings-header .settings-header
%h4 %h4
= _('Sign-up restrictions') = _('Sign-up restrictions')
%button.btn.js-settings-toggle %button.btn.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand' = expanded ? 'Collapse' : 'Expand'
%p %p
= _('Configure the way a user creates a new account.') = _('Configure the way a user creates a new account.')
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
.settings-header .settings-header
%h4 %h4
= _('Sign-in restrictions') = _('Sign-in restrictions')
%button.btn.js-settings-toggle %button.btn.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand' = expanded ? 'Collapse' : 'Expand'
%p %p
= _('Set requirements for a user to sign-in. Enable mandatory two-factor authentication.') = _('Set requirements for a user to sign-in. Enable mandatory two-factor authentication.')
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
.settings-header .settings-header
%h4 %h4
= _('Help page') = _('Help page')
%button.btn.js-settings-toggle %button.btn.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand' = expanded ? 'Collapse' : 'Expand'
%p %p
= _('Help page text and support page url.') = _('Help page text and support page url.')
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
.settings-header .settings-header
%h4 %h4
= _('Pages') = _('Pages')
%button.btn.js-settings-toggle %button.btn.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand' = expanded ? 'Collapse' : 'Expand'
%p %p
= _('Size and domain settings for static websites') = _('Size and domain settings for static websites')
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
.settings-header .settings-header
%h4 %h4
= _('Continuous Integration and Deployment') = _('Continuous Integration and Deployment')
%button.btn.js-settings-toggle %button.btn.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand' = expanded ? 'Collapse' : 'Expand'
%p %p
= _('Auto DevOps, runners amd job artifacts') = _('Auto DevOps, runners amd job artifacts')
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
.settings-header .settings-header
%h4 %h4
= _('Metrics - Influx') = _('Metrics - Influx')
%button.btn.js-settings-toggle %button.btn.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand' = expanded ? 'Collapse' : 'Expand'
%p %p
= _('Enable and configure InfluxDB metrics.') = _('Enable and configure InfluxDB metrics.')
...@@ -95,12 +95,46 @@ ...@@ -95,12 +95,46 @@
.settings-header .settings-header
%h4 %h4
= _('Metrics - Prometheus') = _('Metrics - Prometheus')
%button.btn.js-settings-toggle %button.btn.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand' = expanded ? 'Collapse' : 'Expand'
%p %p
= _('Enable and configure Prometheus metrics.') = _('Enable and configure Prometheus metrics.')
.settings-content .settings-content
= render 'prometheus' = render 'prometheus'
%section.settings.as-performance.no-animate#js-performance-settings{ class: ('expanded' if expanded) }
.settings-header
%h4
= _('Profiling - Performance bar')
%button.btn.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand'
%p
= _('Enable the Performance Bar for a given group.')
= link_to icon('question-circle'), help_page_path('administration/monitoring/performance/performance_bar')
.settings-content
= render 'performance_bar'
%section.settings.as-background.no-animate#js-background-settings{ class: ('expanded' if expanded) }
.settings-header
%h4
= _('Background jobs')
%button.btn.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand'
%p
= _('Configure Sidekiq job throttling.')
.settings-content
= render 'background_jobs'
%section.settings.as-spam.no-animate#js-spam-settings{ class: ('expanded' if expanded) }
.settings-header
%h4
= _('Spam and Anti-bot Protection')
%button.btn.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand'
%p
= _('Enable reCAPTCHA or Akismet and set IP limits.')
.settings-content
= render 'spam'
.prepend-top-20 .prepend-top-20
= render 'form' = render 'form'
---
title: Add additional cluster usage metrics to usage ping.
merge_request: 17922
author:
type: changed
---
title: Bump html-pipeline to 2.7.1
merge_request: 18132
author: "@blackst0ne"
type: other
...@@ -1454,3 +1454,7 @@ POST /projects/:id/mirror/pull ...@@ -1454,3 +1454,7 @@ POST /projects/:id/mirror/pull
## Project badges ## Project badges
Read more in the [Project Badges](project_badges.md) documentation. Read more in the [Project Badges](project_badges.md) documentation.
## Issue and merge request description templates
The non-default [issue and merge request description templates](../user/project/description_templates.md) are managed inside the project's repository. So you can manage them via the API through the [Repositories API](repositories.md) and the [Repository Files API](repository_files.md).
\ No newline at end of file
...@@ -470,7 +470,76 @@ export CI_REGISTRY_USER="gitlab-ci-token" ...@@ -470,7 +470,76 @@ export CI_REGISTRY_USER="gitlab-ci-token"
export CI_REGISTRY_PASSWORD="longalfanumstring" export CI_REGISTRY_PASSWORD="longalfanumstring"
``` ```
<<<<<<< HEAD
[ee-2112]: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/2112 [ee-2112]: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/2112
=======
## Variables expressions
> Variables expressions were added in GitLab 10.7.
It is possible to use variables expressions with only / except policies in
`.gitlab-ci.yml`. By using this approach you can limit what builds are going to
be created within a pipeline after pushing code to GitLab.
This is particularly useful in combination with secret variables and triggered
pipeline variables.
```yaml
deploy:
script: cap staging deploy
environment: staging
only:
variables:
- $RELEASE == "staging"
- $STAGING
```
Each provided variables expression is going to be evaluated before creating
a pipeline.
If any of the conditions in `variables` evaluates to truth when using `only`,
a new job is going to be created. If any of the expressions evaluates to truth
when `except` is being used, a job is not going to be created.
This follows usual rules for `only` / `except` policies.
### Supported syntax
Below you can find currently supported syntax reference:
1. Equality matching using a string
Example: `$VARIABLE == "some value"`
You can use equality operator `==` to compare a variable content to a
string. We support both, double quotes and single quotes to define a string
value, so both `$VARIABLE == "some value"` and `$VARIABLE == 'some value'`
are supported. `"some value" == $VARIABLE` is correct too.
1. Checking for an undefined value
It sometimes happens that you want to check whether variable is defined or
not. To do that, you can compare variable to `null` value, like
`$VARIABLE == null`. This expression is going to evaluate to truth if
variable is not set.
1. Checking for an empty variable
If you want to check whether a variable is defined, but is empty, you can
simply compare it against an empty string, like `$VAR == ''`.
1. Comparing two variables
It is possible to compare two variables. `$VARIABLE_1 == $VARIABLE_2`.
1. Variable presence check
If you only want to create a job when there is some variable present,
which means that it is defined and non-empty, you can simply use
variable name as an expression, like `$STAGING`. If `$STAGING` variable
is defined, and is non empty, expression will evaluate to truth.
>>>>>>> upstream/master
[ce-13784]: https://gitlab.com/gitlab-org/gitlab-ce/issues/13784 "Simple protection of CI secret variables" [ce-13784]: https://gitlab.com/gitlab-org/gitlab-ce/issues/13784 "Simple protection of CI secret variables"
[premium]: https://about.gitlab.com/products/ "Available only in GitLab Premium" [premium]: https://about.gitlab.com/products/ "Available only in GitLab Premium"
[envs]: ../environments.md [envs]: ../environments.md
......
...@@ -315,9 +315,14 @@ policy configuration. ...@@ -315,9 +315,14 @@ policy configuration.
GitLab now supports both, simple and complex strategies, so it is possible to GitLab now supports both, simple and complex strategies, so it is possible to
use an array and a hash configuration scheme. use an array and a hash configuration scheme.
Two keys are now available: `refs` and `kubernetes`. Refs strategy equals to Three keys are now available: `refs`, `kubernetes` and `variables`.
simplified only/except configuration, whereas kubernetes strategy accepts only Refs strategy equals to simplified only/except configuration, whereas
`active` keyword. kubernetes strategy accepts only `active` keyword.
`variables` keyword is used to define variables expressions. In other words
you can use predefined variables / secret variables / project / group or
environment-scoped variables to define an expression GitLab is going to
evaluate in order to decide whether a job should be created or not.
See the example below. Job is going to be created only when pipeline has been See the example below. Job is going to be created only when pipeline has been
scheduled or runs for a `master` branch, and only if kubernetes service is scheduled or runs for a `master` branch, and only if kubernetes service is
...@@ -332,6 +337,20 @@ job: ...@@ -332,6 +337,20 @@ job:
kubernetes: active kubernetes: active
``` ```
Example of using variables expressions:
```yaml
deploy:
only:
refs:
- branches
variables:
- $RELEASE == "staging"
- $STAGING
```
Learn more about variables expressions on a separate page.
## `tags` ## `tags`
`tags` is used to select specific Runners from the list of all Runners that are `tags` is used to select specific Runners from the list of all Runners that are
......
...@@ -11,7 +11,7 @@ module Banzai ...@@ -11,7 +11,7 @@ module Banzai
IGNORED_ANCESTOR_TAGS = %w(pre code tt).to_set IGNORED_ANCESTOR_TAGS = %w(pre code tt).to_set
def call def call
search_text_nodes(doc).each do |node| doc.search(".//text()").each do |node|
content = node.to_html content = node.to_html
next if has_ancestor?(node, IGNORED_ANCESTOR_TAGS) next if has_ancestor?(node, IGNORED_ANCESTOR_TAGS)
......
...@@ -57,7 +57,7 @@ module Banzai ...@@ -57,7 +57,7 @@ module Banzai
ALLOWED_IMAGE_EXTENSIONS = /.+(jpg|png|gif|svg|bmp)\z/i.freeze ALLOWED_IMAGE_EXTENSIONS = /.+(jpg|png|gif|svg|bmp)\z/i.freeze
def call def call
search_text_nodes(doc).each do |node| doc.search(".//text()").each do |node|
# A Gollum ToC tag is `[[_TOC_]]`, but due to MarkdownFilter running # A Gollum ToC tag is `[[_TOC_]]`, but due to MarkdownFilter running
# before this one, it will be converted into `[[<em>TOC</em>]]`, so it # before this one, it will be converted into `[[<em>TOC</em>]]`, so it
# needs special-case handling # needs special-case handling
......
...@@ -4,7 +4,7 @@ module Banzai ...@@ -4,7 +4,7 @@ module Banzai
IGNORED_ANCESTOR_TAGS = %w(pre code tt).to_set IGNORED_ANCESTOR_TAGS = %w(pre code tt).to_set
def call def call
search_text_nodes(doc).each do |node| doc.search(".//text()").each do |node|
next if has_ancestor?(node, IGNORED_ANCESTOR_TAGS) next if has_ancestor?(node, IGNORED_ANCESTOR_TAGS)
content = node.to_html content = node.to_html
......
...@@ -69,6 +69,12 @@ module Gitlab ...@@ -69,6 +69,12 @@ module Gitlab
clusters: ::Clusters::Cluster.count, clusters: ::Clusters::Cluster.count,
clusters_enabled: ::Clusters::Cluster.enabled.count, clusters_enabled: ::Clusters::Cluster.enabled.count,
clusters_disabled: ::Clusters::Cluster.disabled.count, clusters_disabled: ::Clusters::Cluster.disabled.count,
clusters_platforms_gke: ::Clusters::Cluster.gcp_installed.enabled.count,
clusters_platforms_user: ::Clusters::Cluster.user_provided.enabled.count,
clusters_applications_helm: ::Clusters::Applications::Helm.installed.count,
clusters_applications_ingress: ::Clusters::Applications::Ingress.installed.count,
clusters_applications_prometheus: ::Clusters::Applications::Prometheus.installed.count,
clusters_applications_runner: ::Clusters::Applications::Runner.installed.count,
in_review_folder: ::Environment.in_review_folder.count, in_review_folder: ::Environment.in_review_folder.count,
groups: Group.count, groups: Group.count,
issues: Issue.count, issues: Issue.count,
......
...@@ -145,6 +145,53 @@ feature 'Admin updates settings' do ...@@ -145,6 +145,53 @@ feature 'Admin updates settings' do
expect(page).to have_content "Application settings saved successfully" expect(page).to have_content "Application settings saved successfully"
end end
scenario 'Change Performance bar settings' do
group = create(:group)
page.within('.as-performance') do
check 'Enable the Performance Bar'
fill_in 'Allowed group', with: group.path
click_on 'Save changes'
end
expect(page).to have_content "Application settings saved successfully"
expect(find_field('Enable the Performance Bar')).to be_checked
expect(find_field('Allowed group').value).to eq group.path
page.within('.as-performance') do
uncheck 'Enable the Performance Bar'
click_on 'Save changes'
end
expect(page).to have_content 'Application settings saved successfully'
expect(find_field('Enable the Performance Bar')).not_to be_checked
expect(find_field('Allowed group').value).to be_nil
end
scenario 'Change Background jobs settings' do
page.within('.as-background') do
fill_in 'Throttling Factor', with: 1
click_button 'Save changes'
end
expect(Gitlab::CurrentSettings.sidekiq_throttling_factor).to eq(1)
expect(page).to have_content "Application settings saved successfully"
end
scenario 'Change Spam settings' do
page.within('.as-spam') do
check 'Enable reCAPTCHA'
fill_in 'reCAPTCHA Site Key', with: 'key'
fill_in 'reCAPTCHA Private Key', with: 'key'
fill_in 'IPs per user', with: 15
click_button 'Save changes'
end
expect(page).to have_content "Application settings saved successfully"
expect(Gitlab::CurrentSettings.recaptcha_enabled).to be true
expect(Gitlab::CurrentSettings.unique_ips_limit_per_user).to eq(15)
end
scenario 'Change Slack Notifications Service template settings' do scenario 'Change Slack Notifications Service template settings' do
first(:link, 'Service Templates').click first(:link, 'Service Templates').click
click_link 'Slack notifications' click_link 'Slack notifications'
...@@ -197,29 +244,6 @@ feature 'Admin updates settings' do ...@@ -197,29 +244,6 @@ feature 'Admin updates settings' do
expect(find_field('ED25519 SSH keys').value).to eq(forbidden) expect(find_field('ED25519 SSH keys').value).to eq(forbidden)
end end
scenario 'Change Performance Bar settings' do
group = create(:group)
check 'Enable the Performance Bar'
fill_in 'Allowed group', with: group.path
click_on 'Save'
expect(page).to have_content 'Application settings saved successfully'
expect(find_field('Enable the Performance Bar')).to be_checked
expect(find_field('Allowed group').value).to eq group.path
uncheck 'Enable the Performance Bar'
click_on 'Save'
expect(page).to have_content 'Application settings saved successfully'
expect(find_field('Enable the Performance Bar')).not_to be_checked
expect(find_field('Allowed group').value).to be_nil
end
def check_all_events def check_all_events
page.check('Active') page.check('Active')
page.check('Push') page.check('Push')
......
...@@ -13,6 +13,14 @@ describe Gitlab::UsageData do ...@@ -13,6 +13,14 @@ describe Gitlab::UsageData do
create(:service, project: projects[0], type: 'SlackSlashCommandsService', active: true) create(:service, project: projects[0], type: 'SlackSlashCommandsService', active: true)
create(:service, project: projects[1], type: 'SlackService', active: true) create(:service, project: projects[1], type: 'SlackService', active: true)
create(:service, project: projects[2], type: 'SlackService', active: true) create(:service, project: projects[2], type: 'SlackService', active: true)
gcp_cluster = create(:cluster, :provided_by_gcp)
create(:cluster, :provided_by_user)
create(:cluster, :provided_by_user, :disabled)
create(:clusters_applications_helm, :installed, cluster: gcp_cluster)
create(:clusters_applications_ingress, :installed, cluster: gcp_cluster)
create(:clusters_applications_prometheus, :installed, cluster: gcp_cluster)
create(:clusters_applications_runner, :installed, cluster: gcp_cluster)
end end
subject { described_class.data } subject { described_class.data }
...@@ -78,6 +86,12 @@ describe Gitlab::UsageData do ...@@ -78,6 +86,12 @@ describe Gitlab::UsageData do
clusters clusters
clusters_enabled clusters_enabled
clusters_disabled clusters_disabled
clusters_platforms_gke
clusters_platforms_user
clusters_applications_helm
clusters_applications_ingress
clusters_applications_prometheus
clusters_applications_runner
in_review_folder in_review_folder
groups groups
issues issues
...@@ -116,6 +130,15 @@ describe Gitlab::UsageData do ...@@ -116,6 +130,15 @@ describe Gitlab::UsageData do
expect(count_data[:projects_jira_active]).to eq(2) expect(count_data[:projects_jira_active]).to eq(2)
expect(count_data[:projects_slack_notifications_active]).to eq(2) expect(count_data[:projects_slack_notifications_active]).to eq(2)
expect(count_data[:projects_slack_slash_active]).to eq(1) expect(count_data[:projects_slack_slash_active]).to eq(1)
expect(count_data[:clusters_enabled]).to eq(6)
expect(count_data[:clusters_disabled]).to eq(1)
expect(count_data[:clusters_platforms_gke]).to eq(1)
expect(count_data[:clusters_platforms_user]).to eq(1)
expect(count_data[:clusters_applications_helm]).to eq(1)
expect(count_data[:clusters_applications_ingress]).to eq(1)
expect(count_data[:clusters_applications_prometheus]).to eq(1)
expect(count_data[:clusters_applications_runner]).to eq(1)
end end
end end
......
...@@ -3,6 +3,18 @@ require 'rails_helper' ...@@ -3,6 +3,18 @@ require 'rails_helper'
describe Clusters::Applications::Helm do describe Clusters::Applications::Helm do
include_examples 'cluster application core specs', :clusters_applications_helm include_examples 'cluster application core specs', :clusters_applications_helm
describe '.installed' do
subject { described_class.installed }
let!(:cluster) { create(:clusters_applications_helm, :installed) }
before do
create(:clusters_applications_helm, :errored)
end
it { is_expected.to contain_exactly(cluster) }
end
describe '#install_command' do describe '#install_command' do
let(:helm) { create(:clusters_applications_helm) } let(:helm) { create(:clusters_applications_helm) }
......
...@@ -11,6 +11,18 @@ describe Clusters::Applications::Ingress do ...@@ -11,6 +11,18 @@ describe Clusters::Applications::Ingress do
allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_async) allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_async)
end end
describe '.installed' do
subject { described_class.installed }
let!(:cluster) { create(:clusters_applications_ingress, :installed) }
before do
create(:clusters_applications_ingress, :errored)
end
it { is_expected.to contain_exactly(cluster) }
end
describe '#make_installed!' do describe '#make_installed!' do
before do before do
application.make_installed! application.make_installed!
......
...@@ -4,6 +4,18 @@ describe Clusters::Applications::Prometheus do ...@@ -4,6 +4,18 @@ describe Clusters::Applications::Prometheus do
include_examples 'cluster application core specs', :clusters_applications_prometheus include_examples 'cluster application core specs', :clusters_applications_prometheus
include_examples 'cluster application status specs', :cluster_application_prometheus include_examples 'cluster application status specs', :cluster_application_prometheus
describe '.installed' do
subject { described_class.installed }
let!(:cluster) { create(:clusters_applications_prometheus, :installed) }
before do
create(:clusters_applications_prometheus, :errored)
end
it { is_expected.to contain_exactly(cluster) }
end
describe 'transition to installed' do describe 'transition to installed' do
let(:project) { create(:project) } let(:project) { create(:project) }
let(:cluster) { create(:cluster, projects: [project]) } let(:cluster) { create(:cluster, projects: [project]) }
......
...@@ -8,6 +8,18 @@ describe Clusters::Applications::Runner do ...@@ -8,6 +8,18 @@ describe Clusters::Applications::Runner do
it { is_expected.to belong_to(:runner) } it { is_expected.to belong_to(:runner) }
describe '.installed' do
subject { described_class.installed }
let!(:cluster) { create(:clusters_applications_runner, :installed) }
before do
create(:clusters_applications_runner, :errored)
end
it { is_expected.to contain_exactly(cluster) }
end
describe '#install_command' do describe '#install_command' do
let(:kubeclient) { double('kubernetes client') } let(:kubeclient) { double('kubernetes client') }
let(:gitlab_runner) { create(:clusters_applications_runner, runner: ci_runner) } let(:gitlab_runner) { create(:clusters_applications_runner, runner: ci_runner) }
......
...@@ -40,6 +40,42 @@ describe Clusters::Cluster do ...@@ -40,6 +40,42 @@ describe Clusters::Cluster do
it { is_expected.to contain_exactly(cluster) } it { is_expected.to contain_exactly(cluster) }
end end
describe '.user_provided' do
subject { described_class.user_provided }
let!(:cluster) { create(:cluster, :provided_by_user) }
before do
create(:cluster, :provided_by_gcp)
end
it { is_expected.to contain_exactly(cluster) }
end
describe '.gcp_provided' do
subject { described_class.gcp_provided }
let!(:cluster) { create(:cluster, :provided_by_gcp) }
before do
create(:cluster, :provided_by_user)
end
it { is_expected.to contain_exactly(cluster) }
end
describe '.gcp_installed' do
subject { described_class.gcp_installed }
let!(:cluster) { create(:cluster, :provided_by_gcp) }
before do
create(:cluster, :providing_by_gcp)
end
it { is_expected.to contain_exactly(cluster) }
end
describe 'validation' do describe 'validation' do
subject { cluster.valid? } subject { cluster.valid? }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment