Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
0da060c9
Commit
0da060c9
authored
May 12, 2020
by
Hordur Freyr Yngvason
Committed by
Thong Kuah
May 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move Browser-Performance-Testing template to rules
Part of
https://gitlab.com/gitlab-org/gitlab/-/issues/213336
parent
19031b99
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
96 additions
and
8 deletions
+96
-8
changelogs/unreleased/move-browser-performance-testing-to-rules-syntax.yml
...ased/move-browser-performance-testing-to-rules-syntax.yml
+5
-0
lib/gitlab/ci/templates/Jobs/Browser-Performance-Testing.gitlab-ci.yml
.../templates/Jobs/Browser-Performance-Testing.gitlab-ci.yml
+6
-8
spec/lib/gitlab/ci/templates/Jobs/browser_performance_testing_gitlab_ci_yaml_spec.rb
...s/Jobs/browser_performance_testing_gitlab_ci_yaml_spec.rb
+85
-0
No files found.
changelogs/unreleased/move-browser-performance-testing-to-rules-syntax.yml
0 → 100644
View file @
0da060c9
---
title
:
Move Browser-Perfomance-Testing.gitlab-ci.yml to `rules` syntax
merge_request
:
31413
author
:
type
:
changed
lib/gitlab/ci/templates/Jobs/Browser-Performance-Testing.gitlab-ci.yml
View file @
0da060c9
...
...
@@ -30,11 +30,9 @@ performance:
paths
:
-
performance.json
-
sitespeed-results/
only
:
refs
:
-
branches
-
tags
kubernetes
:
active
except
:
variables
:
-
$PERFORMANCE_DISABLED
rules
:
-
if
:
'
$CI_KUBERNETES_ACTIVE
==
null
||
$CI_KUBERNETES_ACTIVE
==
""'
when
:
never
-
if
:
'
$PERFORMANCE_DISABLED'
when
:
never
-
if
:
'
$CI_COMMIT_TAG
||
$CI_COMMIT_BRANCH'
spec/lib/gitlab/ci/templates/Jobs/browser_performance_testing_gitlab_ci_yaml_spec.rb
0 → 100644
View file @
0da060c9
# frozen_string_literal: true
require
'spec_helper'
describe
'Jobs/Browser-Performance-Testing.gitlab-ci.yml'
do
subject
(
:template
)
do
<<~
YAML
stages:
- test
- performance
include:
- template: 'Jobs/Browser-Performance-Testing.gitlab-ci.yml'
placeholder:
script:
- keep pipeline validator happy by having a job when stages are intentionally empty
YAML
end
describe
'the created pipeline'
do
let
(
:user
)
{
create
(
:admin
)
}
let
(
:project
)
do
create
(
:project
,
:repository
,
variables:
[
build
(
:ci_variable
,
key:
'CI_KUBERNETES_ACTIVE'
,
value:
'true'
)
])
end
let
(
:default_branch
)
{
'master'
}
let
(
:pipeline_ref
)
{
default_branch
}
let
(
:service
)
{
Ci
::
CreatePipelineService
.
new
(
project
,
user
,
ref:
pipeline_ref
)
}
let
(
:pipeline
)
{
service
.
execute!
(
:push
)
}
let
(
:build_names
)
{
pipeline
.
builds
.
pluck
(
:name
)
}
before
do
stub_ci_pipeline_yaml_file
(
template
)
allow_any_instance_of
(
Ci
::
BuildScheduleWorker
).
to
receive
(
:perform
).
and_return
(
true
)
allow
(
project
).
to
receive
(
:default_branch
).
and_return
(
default_branch
)
end
it
'has no errors'
do
expect
(
pipeline
.
errors
).
to
be_empty
end
shared_examples_for
'performance job on tag or branch'
do
it
'by default'
do
expect
(
build_names
).
to
include
(
'performance'
)
end
it
'when PERFORMANCE_DISABLED'
do
create
(
:ci_variable
,
project:
project
,
key:
'PERFORMANCE_DISABLED'
,
value:
'1'
)
expect
(
build_names
).
not_to
include
(
'performance'
)
end
end
context
'on master'
do
it_behaves_like
'performance job on tag or branch'
end
context
'on another branch'
do
let
(
:pipeline_ref
)
{
'feature'
}
it_behaves_like
'performance job on tag or branch'
end
context
'on tag'
do
let
(
:pipeline_ref
)
{
'v1.0.0'
}
it_behaves_like
'performance job on tag or branch'
end
context
'on merge request'
do
let
(
:service
)
{
MergeRequests
::
CreatePipelineService
.
new
(
project
,
user
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
:simple
,
source_project:
project
)
}
let
(
:pipeline
)
{
service
.
execute
(
merge_request
)
}
it
'has no jobs'
do
expect
(
pipeline
).
to
be_merge_request_event
expect
(
build_names
).
to
be_empty
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment