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
d6a82345
Commit
d6a82345
authored
Nov 20, 2019
by
Kamil Trzciński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch 'remove-depend_on_persistent_pipeline_ref-feature-flag' into 'master'"
This reverts merge request !18185
parent
25df3e13
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
1 deletion
+35
-1
app/models/ci/persistent_ref.rb
app/models/ci/persistent_ref.rb
+11
-1
doc/ci/pipelines.md
doc/ci/pipelines.md
+12
-0
spec/models/ci/persistent_ref_spec.rb
spec/models/ci/persistent_ref_spec.rb
+12
-0
No files found.
app/models/ci/persistent_ref.rb
View file @
d6a82345
...
...
@@ -14,13 +14,15 @@ module Ci
delegate
:ref_exists?
,
:create_ref
,
:delete_refs
,
to: :repository
def
exist?
return
unless
enabled?
ref_exists?
(
path
)
rescue
false
end
def
create
return
if
exist?
return
unless
enabled?
&&
!
exist?
create_ref
(
sha
,
path
)
rescue
=>
e
...
...
@@ -29,6 +31,8 @@ module Ci
end
def
delete
return
unless
enabled?
delete_refs
(
path
)
rescue
Gitlab
::
Git
::
Repository
::
NoRepository
# no-op
...
...
@@ -40,5 +44,11 @@ module Ci
def
path
"refs/
#{
Repository
::
REF_PIPELINES
}
/
#{
pipeline
.
id
}
"
end
private
def
enabled?
Feature
.
enabled?
(
:depend_on_persistent_pipeline_ref
,
project
)
end
end
end
doc/ci/pipelines.md
View file @
d6a82345
...
...
@@ -468,3 +468,15 @@ To illustrate its life cycle:
even if the commit history of the
`example`
branch has been overwritten by force-push.
1.
GitLab Runner fetches the persistent pipeline ref and gets source code from the checkout-SHA.
1.
When the pipeline finished, its persistent ref is cleaned up in a background process.
NOTE:
**NOTE**
: At this moment, this feature is off dy default and can be manually enabled
by enabling
`depend_on_persistent_pipeline_ref`
feature flag, however, we'd remove this
feature flag and make it enabled by deafult by the day we release 12.4 _if we don't find any issues_.
If you'd be interested in manually turning on this behavior, please ask the administrator
to execute the following commands in rails console.
```
shell
>
sudo
gitlab-rails console
# Login to Rails console of GitLab instance.
>
project
=
Project.find_by_full_path
(
'namespace/project-name'
)
# Get the project instance.
>
Feature.enable
(
:depend_on_persistent_pipeline_ref, project
)
# Enable the feature flag.
```
spec/models/ci/persistent_ref_spec.rb
View file @
d6a82345
...
...
@@ -45,6 +45,18 @@ describe Ci::PersistentRef do
expect
(
pipeline
.
persistent_ref
).
to
be_exist
end
context
'when depend_on_persistent_pipeline_ref feature flag is disabled'
do
before
do
stub_feature_flags
(
depend_on_persistent_pipeline_ref:
false
)
end
it
'does not create a persistent ref'
do
expect
(
project
.
repository
).
not_to
receive
(
:create_ref
)
subject
end
end
context
'when sha does not exist in the repository'
do
let
(
:sha
)
{
'not-exist'
}
...
...
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