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
a1949da8
Commit
a1949da8
authored
Apr 30, 2020
by
Hordur Freyr Yngvason
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move Auto DevOps Build.gitlab-ci.yml to rules
Part of
https://gitlab.com/gitlab-org/gitlab/-/issues/213336
parent
1468db1d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
3 deletions
+65
-3
changelogs/unreleased/move-build-template-to-rules-syntax.yml
...gelogs/unreleased/move-build-template-to-rules-syntax.yml
+5
-0
lib/gitlab/ci/templates/Jobs/Build.gitlab-ci.yml
lib/gitlab/ci/templates/Jobs/Build.gitlab-ci.yml
+2
-3
spec/lib/gitlab/ci/templates/Jobs/build_gitlab_ci_yaml_spec.rb
...lib/gitlab/ci/templates/Jobs/build_gitlab_ci_yaml_spec.rb
+58
-0
No files found.
changelogs/unreleased/move-build-template-to-rules-syntax.yml
0 → 100644
View file @
a1949da8
---
title
:
Move Build.gitlab-ci.yml to `rules` syntax
merge_request
:
30895
author
:
type
:
changed
lib/gitlab/ci/templates/Jobs/Build.gitlab-ci.yml
View file @
a1949da8
...
@@ -15,6 +15,5 @@ build:
...
@@ -15,6 +15,5 @@ build:
export CI_APPLICATION_TAG=${CI_APPLICATION_TAG:-$CI_COMMIT_TAG}
export CI_APPLICATION_TAG=${CI_APPLICATION_TAG:-$CI_COMMIT_TAG}
fi
fi
-
/build/build.sh
-
/build/build.sh
only
:
rules
:
-
branches
-
if
:
'
$CI_COMMIT_TAG
||
$CI_COMMIT_BRANCH'
-
tags
spec/lib/gitlab/ci/templates/Jobs/build_gitlab_ci_yaml_spec.rb
0 → 100644
View file @
a1949da8
# frozen_string_literal: true
require
'spec_helper'
describe
'Jobs/Build.gitlab-ci.yml'
do
subject
(
:template
)
{
Gitlab
::
Template
::
GitlabCiYmlTemplate
.
find
(
'Jobs/Build'
)
}
describe
'the created pipeline'
do
let_it_be
(
:user
)
{
create
(
:admin
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:repository
)
}
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
.
content
)
allow_any_instance_of
(
Ci
::
BuildScheduleWorker
).
to
receive
(
:perform
).
and_return
(
true
)
allow
(
project
).
to
receive
(
:default_branch
).
and_return
(
default_branch
)
end
context
'on master'
do
it
'creates the build job'
do
expect
(
build_names
).
to
contain_exactly
(
'build'
)
end
end
context
'on another branch'
do
let
(
:pipeline_ref
)
{
'feature'
}
it
'creates the build job'
do
expect
(
build_names
).
to
contain_exactly
(
'build'
)
end
end
context
'on tag'
do
let
(
:pipeline_ref
)
{
'v1.0.0'
}
it
'creates the build job'
do
expect
(
pipeline
).
to
be_tag
expect
(
build_names
).
to
contain_exactly
(
'build'
)
end
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