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
ecdab9f9
Commit
ecdab9f9
authored
Sep 07, 2017
by
Achilleas Pipinellis
Committed by
Rémy Coutable
Sep 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add script and job to trigger a docs build
parent
4ae8e20c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
140 additions
and
3 deletions
+140
-3
.gitlab-ci.yml
.gitlab-ci.yml
+39
-3
doc/development/img/manual_build_docs.png
doc/development/img/manual_build_docs.png
+0
-0
doc/development/writing_documentation.md
doc/development/writing_documentation.md
+21
-0
scripts/trigger-build-docs
scripts/trigger-build-docs
+80
-0
scripts/trigger-build-omnibus
scripts/trigger-build-omnibus
+0
-0
No files found.
.gitlab-ci.yml
View file @
ecdab9f9
...
...
@@ -40,6 +40,7 @@ stages:
-
test
-
post-test
-
pages
-
post-cleanup
# Predefined scopes
.dedicated-runner
:
&dedicated-runner
...
...
@@ -153,8 +154,7 @@ stages:
-
master@gitlab/gitlabhq
-
master@gitlab/gitlab-ee
# Trigger a package build on omnibus-gitlab repository
# Trigger a package build in omnibus-gitlab repository
build-package
:
image
:
ruby:2.3-alpine
before_script
:
[]
...
...
@@ -166,11 +166,47 @@ build-package:
cache
:
{}
when
:
manual
script
:
-
scripts/trigger-build
-
scripts/trigger-build
-omnibus
only
:
-
//@gitlab-org/gitlab-ce
-
//@gitlab-org/gitlab-ee
# Review docs base
.review-docs
:
&review-docs
image
:
ruby:2.4-alpine
before_script
:
[]
services
:
[]
variables
:
SETUP_DB
:
"
false"
USE_BUNDLE_INSTALL
:
"
false"
cache
:
{}
when
:
manual
only
:
-
branches
# Trigger a docs build in gitlab-docs
# Useful to preview the docs changes live
review-docs-deploy
:
<<
:
*review-docs
stage
:
build
environment
:
name
:
review-docs/$CI_COMMIT_REF_NAME
on_stop
:
review-docs-cleanup
script
:
-
gem install gitlab --no-doc
-
scripts/trigger-build-docs deploy
# Cleanup remote environment of gitlab-docs
review-docs-cleanup
:
<<
:
*review-docs
stage
:
post-cleanup
environment
:
name
:
review-docs/$CI_COMMIT_REF_NAME
action
:
stop
script
:
-
gem install gitlab --no-doc
-
scripts/trigger-build-docs cleanup
# Retrieve knapsack and rspec_flaky reports
retrieve-tests-metadata
:
<<
:
*tests-metadata-state
...
...
doc/development/img/manual_build_docs.png
0 → 100644
View file @
ecdab9f9
14.5 KB
doc/development/writing_documentation.md
View file @
ecdab9f9
...
...
@@ -103,3 +103,24 @@ If that job fails, read the instructions in the job log for what to do next.
Contributors do not need to submit their changes to EE, GitLab Inc. employees
on the other hand need to make sure that their changes apply cleanly to both
CE and EE.
## Previewing the changes live
If you want to preview your changes live, you can use the manual
`build-docs`
job in your merge request.
![
Manual trigger a docs build
](
img/manual_build_docs.png
)
This job will:
1.
Create a new branch in the
[
gitlab-docs
](
https://gitlab.com/gitlab-com/gitlab-docs
)
project named after the scheme:
`<CE/EE-branch-slug>-built-from-ce-ee`
1.
Trigger a pipeline and build the docs site with your changes
Look for the docs URL at the output of the
`build-docs`
job.
>**Note:**
Make sure that you always delete the branch of the merge request you were
working on. If you don't, the remote docs branch won't be removed either,
and the server where the Review Apps are hosted will eventually be out of
disk space.
scripts/trigger-build-docs
0 → 100755
View file @
ecdab9f9
#!/usr/bin/env ruby
require
'gitlab'
#
# Give the remote branch a different name than the current one
# in order to avoid conflicts
#
@docs_branch
=
"
#{
ENV
[
"CI_COMMIT_REF_SLUG"
]
}
-built-from-ce-ee"
GITLAB_DOCS_REPO
=
'gitlab-com/gitlab-docs'
#
# Configure credentials to be used with gitlab gem
#
Gitlab
.
configure
do
|
config
|
config
.
endpoint
=
'https://gitlab.com/api/v4'
config
.
private_token
=
ENV
[
"DOCS_API_TOKEN"
]
# GitLab Docs bot access token which has only Developer access to gitlab-docs
end
#
# Dummy way to find out in which repo we are, CE or EE
#
def
is_ee?
File
.
exists?
(
'CHANGELOG-EE.md'
)
end
#
# Create a remote branch in gitlab-docs
#
def
create_remote_branch
Gitlab
.
create_branch
(
GITLAB_DOCS_REPO
,
@docs_branch
,
'master'
)
puts
"Remote branch '
#{
@docs_branch
}
' created"
rescue
Gitlab
::
Error
::
BadRequest
=>
e
puts
"Remote branch '
#{
@docs_branch
}
' already exists"
end
#
# Remove a remote branch in gitlab-docs
#
def
remove_remote_branch
Gitlab
.
delete_branch
(
GITLAB_DOCS_REPO
,
@docs_branch
)
puts
"Remote branch '
#{
@docs_branch
}
' deleted"
end
#
# Trigger a pipeline in gitlab-docs
#
def
trigger_pipeline
# Overriding vars in https://gitlab.com/gitlab-com/gitlab-docs/blob/master/.gitlab-ci.yml
param_name
=
is_ee?
?
'BRANCH_EE'
:
'BRANCH_CE'
# The review app URL
app_url
=
"http://
#{
@docs_branch
}
.
#{
ENV
[
"DOCS_REVIEW_APPS_DOMAIN"
]
}
/
#{
is_ee?
?
'ee'
:
'ce'
}
"
# Create the pipeline
puts
"=> Triggering a pipeline..."
pipeline
=
Gitlab
.
run_trigger
(
GITLAB_DOCS_REPO
,
ENV
[
"DOCS_TRIGGER_TOKEN"
],
@docs_branch
,
{
param_name
=>
ENV
[
"CI_COMMIT_REF_NAME"
]
})
puts
"=> Pipeline created:"
puts
""
puts
"https://gitlab.com/gitlab-com/gitlab-docs/pipelines/
#{
pipeline
.
id
}
"
puts
""
puts
"=> Preview your changes live at:"
puts
""
puts
app_url
puts
""
end
#
# When the first argument is deploy then create the branch and trigger pipeline
# When it is 'stop', it deleted the remote branch. That way, we ensure there
# are no stale remote branches and the Review server doesn't fill.
#
case
ARGV
[
0
]
when
'deploy'
create_remote_branch
trigger_pipeline
when
'cleanup'
remove_remote_branch
end
scripts/trigger-build
→
scripts/trigger-build
-omnibus
View file @
ecdab9f9
File moved
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