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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
7d46bd61
Commit
7d46bd61
authored
Sep 30, 2016
by
Z.J. van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Save a fetchable ref per deployement
parent
4be63f5b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
2 deletions
+26
-2
CHANGELOG
CHANGELOG
+1
-0
app/models/deployment.rb
app/models/deployment.rb
+8
-2
app/models/environment.rb
app/models/environment.rb
+4
-0
doc/ci/environments.md
doc/ci/environments.md
+13
-0
No files found.
CHANGELOG
View file @
7d46bd61
...
...
@@ -8,6 +8,7 @@ v 8.13.0 (unreleased)
- Replaced the check sign to arrow in the show build view. !6501
- Add a /wip slash command to toggle the Work In Progress status of a merge request. !6259 (tbalthazar)
- Speed-up group milestones show page
- Keep refs for each deployment
- Log LDAP lookup errors and don't swallow unrelated exceptions. !6103 (Markus Koller)
- Add more tests for calendar contribution (ClemMakesApps)
- Avoid database queries on Banzai::ReferenceParser::BaseParser for nodes without references
...
...
app/models/deployment.rb
View file @
7d46bd61
...
...
@@ -11,7 +11,7 @@ class Deployment < ActiveRecord::Base
delegate
:name
,
to: :environment
,
prefix:
true
after_save
:
keep_around_commit
after_save
:
create_ref
def
commit
project
.
commit
(
sha
)
...
...
@@ -30,7 +30,7 @@ class Deployment < ActiveRecord::Base
end
def
keep_around_commit
project
.
repository
.
keep_around
(
self
.
sha
)
project
.
repository
.
fetch_ref
(
project
.
repository
.
path_to_repo
,
ref
,
ref_path
)
end
def
manual_actions
...
...
@@ -76,4 +76,10 @@ class Deployment < ActiveRecord::Base
where
.
not
(
id:
self
.
id
).
take
end
private
def
ref_path
"
#{
environment
.
ref_path
}#{
id
}
"
end
end
app/models/environment.rb
View file @
7d46bd61
...
...
@@ -47,4 +47,8 @@ class Environment < ActiveRecord::Base
def
update_merge_request_metrics?
self
.
name
==
"production"
end
def
ref_path
"refs/environments/
#{
Shellwords
.
shellescape
(
name
)
}
/"
end
end
doc/ci/environments.md
View file @
7d46bd61
...
...
@@ -14,6 +14,19 @@ Defining environments in a project's `.gitlab-ci.yml` lets developers track
Deployments are created when [jobs] deploy versions of code to [environments].
### Checkout deployments locally
Since 8.13, a reference in the git repository is saved for each deployment. So
knowing what the state is of your current environments is only a
`git fetch`
away.
In your git config, append the
`[remote "<your-remote>"] block with an extra
fetch line:
```
fetch = +refs/environments/*:refs/remotes/origin/environments/*
```
## Defining environments
You can create and delete environments manually in the web interface, but we
...
...
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