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
c2b9adad
Commit
c2b9adad
authored
Apr 03, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
9a4bb4cc
47807774
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
816 additions
and
921 deletions
+816
-921
changelogs/unreleased/47234-composable-auto-devops.yml
changelogs/unreleased/47234-composable-auto-devops.yml
+5
-0
doc/topics/autodevops/index.md
doc/topics/autodevops/index.md
+15
-0
doc/user/project/clusters/index.md
doc/user/project/clusters/index.md
+23
-6
lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml
lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml
+11
-876
lib/gitlab/ci/templates/Jobs/Browser-Performance-Testing.gitlab-ci.yml
.../templates/Jobs/Browser-Performance-Testing.gitlab-ci.yml
+38
-0
lib/gitlab/ci/templates/Jobs/Build.gitlab-ci.yml
lib/gitlab/ci/templates/Jobs/Build.gitlab-ci.yml
+18
-0
lib/gitlab/ci/templates/Jobs/Code-Quality.gitlab-ci.yml
lib/gitlab/ci/templates/Jobs/Code-Quality.gitlab-ci.yml
+27
-0
lib/gitlab/ci/templates/Jobs/DAST.gitlab-ci.yml
lib/gitlab/ci/templates/Jobs/DAST.gitlab-ci.yml
+54
-0
lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml
lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml
+575
-0
lib/gitlab/ci/templates/Jobs/Test.gitlab-ci.yml
lib/gitlab/ci/templates/Jobs/Test.gitlab-ci.yml
+23
-0
lib/gitlab/ci/templates/Security/Container-Scanning.gitlab-ci.yml
...ab/ci/templates/Security/Container-Scanning.gitlab-ci.yml
+6
-1
lib/gitlab/ci/templates/Security/DAST.gitlab-ci.yml
lib/gitlab/ci/templates/Security/DAST.gitlab-ci.yml
+4
-37
lib/gitlab/ci/templates/Security/Dependency-Scanning.gitlab-ci.yml
...b/ci/templates/Security/Dependency-Scanning.gitlab-ci.yml
+6
-0
lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml
lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml
+6
-0
spec/lib/gitlab/ci/templates/templates_spec.rb
spec/lib/gitlab/ci/templates/templates_spec.rb
+5
-1
No files found.
changelogs/unreleased/47234-composable-auto-devops.yml
0 → 100644
View file @
c2b9adad
---
title
:
Split Auto-DevOps.gitlab-ci.yml into reusable templates
merge_request
:
26520
author
:
type
:
changed
doc/topics/autodevops/index.md
View file @
c2b9adad
...
...
@@ -699,6 +699,21 @@ renaming `.staging` to `staging`. Then make sure to uncomment the `when` key of
the
`production`
job to turn it into a manual action instead of deploying
automatically.
### Using components of Auto-DevOps
If you only require a subset of the features offered by Auto-DevOps, you can include
individual Auto-DevOps jobs into your own
`.gitlab-ci.yml`
.
For example, to make use of
[
Auto Build
](
#auto-build
)
, you can add the following to
your
`.gitlab-ci.yml`
:
```
yaml
include
:
-
template
:
Jobs/Build.gitlab-ci.yml
```
Consult the [Auto DevOps template] for information on available jobs.
### PostgreSQL database support
In order to support applications that require a database,
...
...
doc/user/project/clusters/index.md
View file @
c2b9adad
...
...
@@ -314,12 +314,6 @@ install it manually.
## Installing applications
NOTE:
**Note:**
Before starting the installation of applications, make sure that time is synchronized
between your GitLab server and your Kubernetes cluster. Otherwise, installation could fail
and you may get errors like
`Error: remote error: tls: bad certificate`
in the
`stdout`
of pods created by GitLab in your Kubernetes cluster.
GitLab provides a one-click install for various applications which can
be added directly to your configured cluster. Those applications are
needed for
[
Review Apps
](
../../../ci/review_apps/index.md
)
and
...
...
@@ -378,6 +372,29 @@ Upgrades will reset values back to the values built into the `runner`
chart plus the values set by
[
`values.yaml`
](
https://gitlab.com/gitlab-org/gitlab-ce/blob/master/vendor/runner/values.yaml
)
### Troubleshooting applications
Applications can fail with the following error:
```
text
Error: remote error: tls: bad certificate
```
To avoid installation errors:
-
Before starting the installation of applications, make sure that time is synchronized
between your GitLab server and your Kubernetes cluster.
-
Ensure certificates are not out of sync. When installing applications, GitLab expects a new cluster with no previous installation of Tiller.
You can confirm that the certificates match via
`kubectl`
:
```
sh
kubectl get configmaps/values-content-configuration-ingress
-n
gitlab-managed-apps
-o
\
"jsonpath={.data['cert
\.
pem']}"
|
base64
-d
>
a.pem
kubectl get secrets/tiller-secret
-n
gitlab-managed-apps
-o
"jsonpath={.data['ca
\.
crt']}"
|
base64
-d
>
b.pem
diff a.pem b.pem
```
## Getting the external endpoint
NOTE:
**Note:**
...
...
lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml
View file @
c2b9adad
This diff is collapsed.
Click to expand it.
lib/gitlab/ci/templates/Jobs/Browser-Performance-Testing.gitlab-ci.yml
0 → 100644
View file @
c2b9adad
performance
:
stage
:
performance
image
:
docker:stable
allow_failure
:
true
services
:
-
docker:stable-dind
script
:
-
|
if ! docker info &>/dev/null; then
if [ -z "$DOCKER_HOST" -a "$KUBERNETES_PORT" ]; then
export DOCKER_HOST='tcp://localhost:2375'
fi
fi
-
export CI_ENVIRONMENT_URL=$(cat environment_url.txt)
-
mkdir gitlab-exporter
-
wget -O gitlab-exporter/index.js https://gitlab.com/gitlab-org/gl-performance/raw/10-5/index.js
-
mkdir sitespeed-results
-
|
if [ -f .gitlab-urls.txt ]
then
sed -i -e 's@^@'"$CI_ENVIRONMENT_URL"'@' .gitlab-urls.txt
docker run --shm-size=1g --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io:6.3.1 --plugins.add ./gitlab-exporter --outputFolder sitespeed-results .gitlab-urls.txt
else
docker run --shm-size=1g --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io:6.3.1 --plugins.add ./gitlab-exporter --outputFolder sitespeed-results "$CI_ENVIRONMENT_URL"
fi
-
mv sitespeed-results/data/performance.json performance.json
artifacts
:
paths
:
-
performance.json
-
sitespeed-results/
only
:
refs
:
-
branches
-
tags
kubernetes
:
active
except
:
variables
:
-
$PERFORMANCE_DISABLED
lib/gitlab/ci/templates/Jobs/Build.gitlab-ci.yml
0 → 100644
View file @
c2b9adad
build
:
stage
:
build
image
:
"
registry.gitlab.com/gitlab-org/cluster-integration/auto-build-image/master:stable"
services
:
-
docker:stable-dind
script
:
-
|
if [[ -z "$CI_COMMIT_TAG" ]]; then
export CI_APPLICATION_REPOSITORY=${CI_APPLICATION_REPOSITORY:-$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG}
export CI_APPLICATION_TAG=${CI_APPLICATION_TAG:-$CI_COMMIT_SHA}
else
export CI_APPLICATION_REPOSITORY=${CI_APPLICATION_REPOSITORY:-$CI_REGISTRY_IMAGE}
export CI_APPLICATION_TAG=${CI_APPLICATION_TAG:-$CI_COMMIT_TAG}
fi
-
/build/build.sh
only
:
-
branches
-
tags
lib/gitlab/ci/templates/Jobs/Code-Quality.gitlab-ci.yml
0 → 100644
View file @
c2b9adad
code_quality
:
stage
:
test
image
:
docker:stable
allow_failure
:
true
services
:
-
docker:stable-dind
script
:
-
export CQ_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
-
|
if ! docker info &>/dev/null; then
if [ -z "$DOCKER_HOST" -a "$KUBERNETES_PORT" ]; then
export DOCKER_HOST='tcp://localhost:2375'
fi
fi
-
|
docker run --env SOURCE_CODE="$PWD" \
--volume "$PWD":/code \
--volume /var/run/docker.sock:/var/run/docker.sock \
"registry.gitlab.com/gitlab-org/security-products/codequality:$CQ_VERSION" /code
artifacts
:
paths
:
[
gl-code-quality-report.json
]
only
:
-
branches
-
tags
except
:
variables
:
-
$CODE_QUALITY_DISABLED
lib/gitlab/ci/templates/Jobs/DAST.gitlab-ci.yml
0 → 100644
View file @
c2b9adad
dast
:
stage
:
dast
image
:
docker:stable
variables
:
DOCKER_DRIVER
:
overlay2
allow_failure
:
true
services
:
-
docker:stable-dind
script
:
-
export DAST_WEBSITE=${DAST_WEBSITE:-$(cat environment_url.txt)}
-
export DAST_VERSION=${SP_VERSION:-$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')}
-
|
if ! docker info &>/dev/null; then
if [ -z "$DOCKER_HOST" -a "$KUBERNETES_PORT" ]; then
export DOCKER_HOST='tcp://localhost:2375'
fi
fi
-
|
function dast_run() {
docker run \
--env DAST_TARGET_AVAILABILITY_TIMEOUT \
--volume "$PWD:/output" \
--volume /var/run/docker.sock:/var/run/docker.sock \
-w /output \
"registry.gitlab.com/gitlab-org/security-products/dast:$DAST_VERSION" \
/analyze -t $DAST_WEBSITE \
"$@"
}
-
|
if [ -n "$DAST_AUTH_URL" ]
then
dast_run \
--auth-url $DAST_AUTH_URL \
--auth-username $DAST_USERNAME \
--auth-password $DAST_PASSWORD \
--auth-username-field $DAST_USERNAME_FIELD \
--auth-password-field $DAST_PASSWORD_FIELD
else
dast_run
fi
artifacts
:
reports
:
dast
:
gl-dast-report.json
only
:
refs
:
-
branches
-
tags
variables
:
-
$GITLAB_FEATURES =~ /\bdast\b/
except
:
refs
:
-
master
variables
:
-
$DAST_DISABLED
lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml
0 → 100644
View file @
c2b9adad
This diff is collapsed.
Click to expand it.
lib/gitlab/ci/templates/Jobs/Test.gitlab-ci.yml
0 → 100644
View file @
c2b9adad
test
:
services
:
-
postgres:latest
variables
:
POSTGRES_DB
:
test
stage
:
test
image
:
gliderlabs/herokuish:latest
script
:
-
|
if [ -z ${KUBERNETES_PORT+x} ]; then
DB_HOST=postgres
else
DB_HOST=localhost
fi
-
export DATABASE_URL="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DB_HOST}:5432/${POSTGRES_DB}"
-
cp -R . /tmp/app
-
/bin/herokuish buildpack test
only
:
-
branches
-
tags
except
:
variables
:
-
$TEST_DISABLED
lib/gitlab/ci/templates/Security/Container-Scanning.gitlab-ci.yml
View file @
c2b9adad
...
...
@@ -28,6 +28,12 @@ container_scanning:
-
docker:stable-dind
script
:
-
if [ -z "$DOCKER_HOST" -a "$KUBERNETES_PORT" ]; then { export DOCKER_SERVICE="localhost" ; export DOCKER_HOST="tcp://${DOCKER_SERVICE}:2375" ; } fi
-
|
if [[ -n "$CI_REGISTRY_USER" ]]; then
echo "Logging to GitLab Container Registry with CI credentials..."
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
echo ""
fi
-
docker run -d --name db arminc/clair-db:latest
-
docker run -p 6060:6060 --link db:postgres -d --name clair --restart on-failure arminc/clair-local-scan:${CLAIR_LOCAL_SCAN_VERSION}
-
apk add -U wget ca-certificates
...
...
@@ -36,7 +42,6 @@ container_scanning:
-
mv clair-scanner_linux_amd64 clair-scanner
-
chmod +x clair-scanner
-
touch clair-whitelist.yml
-
while( ! wget -q -O /dev/null http://${DOCKER_SERVICE}:6060/v1/namespaces ) ; do sleep 1 ; done
-
retries=0
-
echo "Waiting for clair daemon to start"
-
while( ! wget -T 10 -q -O /dev/null http://${DOCKER_SERVICE}:6060/v1/namespaces ) ; do sleep 1 ; echo -n "." ; if [ $retries -eq 10 ] ; then echo " Timeout, aborting." ; exit 1 ; fi ; retries=$(($retries+1)) ; done
...
...
lib/gitlab/ci/templates/Security/DAST.gitlab-ci.yml
View file @
c2b9adad
...
...
@@ -4,6 +4,9 @@
# List of the variables: https://gitlab.com/gitlab-org/security-products/dast#settings
# How to set: https://docs.gitlab.com/ee/ci/yaml/#variables
include
:
-
template
:
Jobs/DAST.gitlab-ci.yml
variables
:
DAST_WEBSITE
:
http://example.com
# Please edit to be your website to scan for vulnerabilities
...
...
@@ -14,46 +17,10 @@ stages:
-
dast
dast
:
stage
:
dast
image
:
docker:stable
variables
:
DOCKER_DRIVER
:
overlay2
allow_failure
:
true
services
:
-
docker:stable-dind
script
:
-
export DAST_VERSION=${SP_VERSION:-$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')}
-
|
function dast_run() {
docker run \
--env DAST_TARGET_AVAILABILITY_TIMEOUT \
--volume "$PWD:/output" \
--volume /var/run/docker.sock:/var/run/docker.sock \
-w /output \
"registry.gitlab.com/gitlab-org/security-products/dast:$DAST_VERSION" \
/analyze -t $DAST_WEBSITE \
"$@"
}
-
|
if [ -n "$DAST_AUTH_URL" ]
then
dast_run \
--auth-url $DAST_AUTH_URL \
--auth-username $DAST_USERNAME \
--auth-password $DAST_PASSWORD \
--auth-username-field $DAST_USERNAME_FIELD \
--auth-password-field $DAST_PASSWORD_FIELD
else
dast_run
fi
artifacts
:
reports
:
dast
:
gl-dast-report.json
only
:
refs
:
-
branches
variables
:
-
$GITLAB_FEATURES =~ /\bdast\b/
except
:
refs
:
[]
# Override default from template
variables
:
-
$DAST_DISABLED
lib/gitlab/ci/templates/Security/Dependency-Scanning.gitlab-ci.yml
View file @
c2b9adad
...
...
@@ -14,6 +14,12 @@ dependency_scanning:
-
docker:stable-dind
script
:
-
export DS_VERSION=${SP_VERSION:-$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')}
-
|
if ! docker info &>/dev/null; then
if [ -z "$DOCKER_HOST" -a "$KUBERNETES_PORT" ]; then
export DOCKER_HOST='tcp://localhost:2375'
fi
fi
-
|
docker run \
--env DS_ANALYZER_IMAGES \
...
...
lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml
View file @
c2b9adad
...
...
@@ -14,6 +14,12 @@ sast:
-
docker:stable-dind
script
:
-
export SAST_VERSION=${SP_VERSION:-$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')}
-
|
if ! docker info &>/dev/null; then
if [ -z "$DOCKER_HOST" -a "$KUBERNETES_PORT" ]; then
export DOCKER_HOST='tcp://localhost:2375'
fi
fi
-
|
docker run \
--env SAST_ANALYZER_IMAGES \
...
...
spec/lib/gitlab/ci/templates/templates_spec.rb
View file @
c2b9adad
...
...
@@ -4,6 +4,7 @@ require 'spec_helper'
describe
"CI YML Templates"
do
ABSTRACT_TEMPLATES
=
%w[Serverless]
.
freeze
PROJECT_DEPENDENT_TEMPLATES
=
%w[Auto-DevOps]
.
freeze
def
self
.
concrete_templates
Gitlab
::
Template
::
GitlabCiYmlTemplate
.
all
.
reject
do
|
template
|
...
...
@@ -20,7 +21,10 @@ describe "CI YML Templates" do
describe
'concrete templates with CI/CD jobs'
do
concrete_templates
.
each
do
|
template
|
it
"
#{
template
.
name
}
template should be valid"
do
expect
{
Gitlab
::
Ci
::
YamlProcessor
.
new
(
template
.
content
)
}
# Trigger processing of included files
project
=
create
(
:project
,
:test_repo
)
if
PROJECT_DEPENDENT_TEMPLATES
.
include?
(
template
.
name
)
expect
{
Gitlab
::
Ci
::
YamlProcessor
.
new
(
template
.
content
,
project:
project
)
}
.
not_to
raise_error
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