debian-mirror-gitlab/doc/topics/autodevops/index.md

523 lines
24 KiB
Markdown
Raw Normal View History

2018-03-17 18:26:18 +05:30
# Auto DevOps
2020-04-22 19:07:51 +05:30
> - [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/issues/37115) in GitLab 10.0.
2019-10-12 21:52:04 +05:30
> - Generally available on GitLab 11.0.
2018-03-17 18:26:18 +05:30
2020-05-24 23:13:21 +05:30
Auto DevOps provides pre-defined CI/CD configuration allowing you to automatically
detect, build, test, deploy, and monitor your applications. Leveraging CI/CD
best practices and tools, Auto DevOps aims to simplify the setup and execution
of a mature and modern software development lifecycle.
2018-03-17 18:26:18 +05:30
## Overview
2020-05-24 23:13:21 +05:30
You can spend a lot of effort to set up the workflow and processes required to
build, deploy, and monitor your project. It gets worse when your company has
hundreds, if not thousands, of projects to maintain. With new projects
constantly starting up, the entire software development process becomes
impossibly complex to manage.
Auto DevOps provides you a seamless software development process by
automatically detecting all dependencies and language technologies required to
test, build, package, deploy, and monitor every project with minimal
configuration. Automation enables consistency across your projects, seamless
management of processes, and faster creation of new projects: push your code,
and GitLab does the rest, improving your productivity and efficiency.
2018-10-15 14:42:47 +05:30
2019-09-04 21:01:54 +05:30
For an introduction to Auto DevOps, watch [AutoDevOps in GitLab 11.0](https://youtu.be/0Tc0YYBxqi4).
## Enabled by default
2020-03-13 15:44:24 +05:30
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/issues/41729) in GitLab 11.3.
2020-05-24 23:13:21 +05:30
Auto DevOps is enabled by default for all projects and attempts to run on all pipelines
in each project. An instance administrator can enable or disable this default in the
2020-03-13 15:44:24 +05:30
[Auto DevOps settings](../../user/admin_area/settings/continuous_integration.md#auto-devops-core-only).
2020-05-24 23:13:21 +05:30
Auto DevOps automatically disables in individual projects on their first pipeline failure,
2020-03-13 15:44:24 +05:30
if it has not been explicitly enabled for the project.
Since [GitLab 12.7](https://gitlab.com/gitlab-org/gitlab/issues/26655), Auto DevOps
2020-05-24 23:13:21 +05:30
runs on pipelines automatically only if a [`Dockerfile` or matching buildpack](stages.md#auto-build)
2020-03-13 15:44:24 +05:30
exists.
If a [CI/CD configuration file](../../ci/yaml/README.md) is present in the project,
it will continue to be used, whether or not Auto DevOps is enabled.
2019-09-04 21:01:54 +05:30
2018-11-08 19:23:39 +05:30
## Quick start
2020-05-24 23:13:21 +05:30
If you're using GitLab.com, see the [quick start guide](quick_start_guide.md)
for setting up Auto DevOps with GitLab.com and a Kubernetes cluster on Google Kubernetes
2018-12-13 13:39:08 +05:30
Engine (GKE).
2020-05-24 23:13:21 +05:30
If you use a self-managed instance of GitLab, you must configure the
2018-12-13 13:39:08 +05:30
[Google OAuth2 OmniAuth Provider](../../integration/google.md) before
2020-05-24 23:13:21 +05:30
configuring a cluster on GKE. After configuring the provider, you can follow
the steps in the [quick start guide](quick_start_guide.md) to get started.
In [GitLab 13.0](https://gitlab.com/gitlab-org/gitlab/-/issues/208132) and later, it is
possible to leverage Auto DevOps to deploy to [AWS ECS](#aws-ecs).
2018-11-08 19:23:39 +05:30
2018-10-15 14:42:47 +05:30
## Comparison to application platforms and PaaS
2020-05-24 23:13:21 +05:30
Auto DevOps provides features often included in an application
2018-12-13 13:39:08 +05:30
platform or a Platform as a Service (PaaS). It takes inspiration from the
2018-10-15 14:42:47 +05:30
innovative work done by [Heroku](https://www.heroku.com/) and goes beyond it
2018-12-13 13:39:08 +05:30
in multiple ways:
2018-10-15 14:42:47 +05:30
2019-10-12 21:52:04 +05:30
- Auto DevOps works with any Kubernetes cluster; you're not limited to running
on GitLab's infrastructure. (Note that many features also work without Kubernetes).
- There is no additional cost (no markup on the infrastructure costs), and you
2020-04-08 14:13:33 +05:30
can use a Kubernetes cluster you host or Containers as a Service on any
2019-10-12 21:52:04 +05:30
public cloud (for example, [Google Kubernetes Engine](https://cloud.google.com/kubernetes-engine/)).
- Auto DevOps has more features including security testing, performance testing,
and code quality testing.
- Auto DevOps offers an incremental graduation path. If you need advanced customizations,
2020-05-24 23:13:21 +05:30
you can start modifying the templates without starting over on a
2020-04-22 19:07:51 +05:30
completely different platform. Review the [customizing](customize.md) documentation for more information.
2018-10-15 14:42:47 +05:30
## Features
2018-03-17 18:26:18 +05:30
Comprised of a set of stages, Auto DevOps brings these best practices to your
2018-11-08 19:23:39 +05:30
project in a simple and automatic way:
2018-03-17 18:26:18 +05:30
2020-04-22 19:07:51 +05:30
1. [Auto Build](stages.md#auto-build)
1. [Auto Test](stages.md#auto-test)
1. [Auto Code Quality](stages.md#auto-code-quality-starter) **(STARTER)**
1. [Auto SAST (Static Application Security Testing)](stages.md#auto-sast-ultimate) **(ULTIMATE)**
1. [Auto Dependency Scanning](stages.md#auto-dependency-scanning-ultimate) **(ULTIMATE)**
1. [Auto License Compliance](stages.md#auto-license-compliance-ultimate) **(ULTIMATE)**
1. [Auto Container Scanning](stages.md#auto-container-scanning-ultimate) **(ULTIMATE)**
1. [Auto Review Apps](stages.md#auto-review-apps)
1. [Auto DAST (Dynamic Application Security Testing)](stages.md#auto-dast-ultimate) **(ULTIMATE)**
1. [Auto Deploy](stages.md#auto-deploy)
1. [Auto Browser Performance Testing](stages.md#auto-browser-performance-testing-premium) **(PREMIUM)**
1. [Auto Monitoring](stages.md#auto-monitoring)
2018-03-17 18:26:18 +05:30
2020-05-24 23:13:21 +05:30
As Auto DevOps relies on many different components, you should have a basic
2018-03-17 18:26:18 +05:30
knowledge of the following:
- [Kubernetes](https://kubernetes.io/docs/home/)
2019-12-21 20:55:43 +05:30
- [Helm](https://helm.sh/docs/)
2018-03-17 18:26:18 +05:30
- [Docker](https://docs.docker.com)
- [GitLab Runner](https://docs.gitlab.com/runner/)
- [Prometheus](https://prometheus.io/docs/introduction/overview/)
Auto DevOps provides great defaults for all the stages; you can, however,
2020-04-22 19:07:51 +05:30
[customize](customize.md) almost everything to your needs.
2018-03-17 18:26:18 +05:30
2020-04-08 14:13:33 +05:30
For an overview on the creation of Auto DevOps, read more
[in this blog post](https://about.gitlab.com/blog/2017/06/29/whats-next-for-gitlab-ci/).
2018-03-17 18:26:18 +05:30
2019-10-12 21:52:04 +05:30
NOTE: **Note**
Kubernetes clusters can [be used without](../../user/project/clusters/index.md)
Auto DevOps.
2018-11-08 19:23:39 +05:30
## Requirements
2018-03-17 18:26:18 +05:30
2020-05-24 23:13:21 +05:30
### Kubernetes
To make full use of Auto DevOps with Kubernetes, you need:
2018-03-17 18:26:18 +05:30
2020-05-24 23:13:21 +05:30
- **Kubernetes** (for [Auto Review Apps](stages.md#auto-review-apps),
[Auto Deploy](stages.md#auto-deploy), and [Auto Monitoring](stages.md#auto-monitoring))
2019-12-26 22:10:19 +05:30
2020-05-24 23:13:21 +05:30
To enable deployments, you need:
2019-12-26 22:10:19 +05:30
2020-05-24 23:13:21 +05:30
1. A [Kubernetes 1.12+ cluster](../../user/project/clusters/index.md) for your
project. The easiest way is to create a
[new cluster using the GitLab UI](../../user/project/clusters/add_remove_clusters.md#create-new-cluster).
For Kubernetes 1.16+ clusters, you must perform additional configuration for
[Auto Deploy for Kubernetes 1.16+](stages.md#kubernetes-116).
2019-12-26 22:10:19 +05:30
1. NGINX Ingress. You can deploy it to your Kubernetes cluster by installing
the [GitLab-managed app for Ingress](../../user/clusters/applications.md#ingress),
2020-05-24 23:13:21 +05:30
after configuring GitLab's Kubernetes integration in the previous step.
2019-12-26 22:10:19 +05:30
Alternatively, you can use the
[`nginx-ingress`](https://github.com/helm/charts/tree/master/stable/nginx-ingress)
Helm chart to install Ingress manually.
NOTE: **Note:**
2020-05-24 23:13:21 +05:30
If you use your own Ingress instead of the one provided by GitLab's managed
apps, ensure you're running at least version 0.9.0 of NGINX Ingress and
2019-12-26 22:10:19 +05:30
[enable Prometheus metrics](https://github.com/helm/charts/tree/master/stable/nginx-ingress#prometheus-metrics)
2020-05-24 23:13:21 +05:30
for the response metrics to appear. You must also
2019-12-26 22:10:19 +05:30
[annotate](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/)
the NGINX Ingress deployment to be scraped by Prometheus using
`prometheus.io/scrape: "true"` and `prometheus.io/port: "10254"`.
2020-05-24 23:13:21 +05:30
- **Base domain** (for [Auto Review Apps](stages.md#auto-review-apps),
[Auto Deploy](stages.md#auto-deploy), and [Auto Monitoring](stages.md#auto-monitoring))
2019-12-26 22:10:19 +05:30
2020-05-24 23:13:21 +05:30
You need a domain configured with wildcard DNS, which all of your Auto DevOps
applications will use. If you're using the
2019-12-26 22:10:19 +05:30
[GitLab-managed app for Ingress](../../user/clusters/applications.md#ingress),
2020-05-24 23:13:21 +05:30
the URL endpoint is automatically configured for you.
2019-12-26 22:10:19 +05:30
2020-05-24 23:13:21 +05:30
You must also [specify the Auto DevOps base domain](#auto-devops-base-domain).
2019-12-26 22:10:19 +05:30
2019-12-04 20:38:33 +05:30
- **GitLab Runner** (for all stages)
2020-05-24 23:13:21 +05:30
Your Runner must be configured to run Docker, usually with either the
[Docker](https://docs.gitlab.com/runner/executors/docker.html)
2019-12-04 20:38:33 +05:30
or [Kubernetes](https://docs.gitlab.com/runner/executors/kubernetes.html) executors, with
2019-10-12 21:52:04 +05:30
[privileged mode enabled](https://docs.gitlab.com/runner/executors/docker.html#use-docker-in-docker-with-privileged-mode).
2020-05-24 23:13:21 +05:30
The Runners don't need to be installed in the Kubernetes cluster, but the
Kubernetes executor is easy to use and automatically autoscales.
You can configure Docker-based Runners to autoscale as well, using
[Docker Machine](https://docs.gitlab.com/runner/install/autoscaling.html).
2019-12-04 20:38:33 +05:30
2020-05-24 23:13:21 +05:30
If you've configured GitLab's Kubernetes integration in the first step, you
2019-12-26 22:10:19 +05:30
can deploy it to your cluster by installing the
[GitLab-managed app for GitLab Runner](../../user/clusters/applications.md#gitlab-runner).
2019-12-04 20:38:33 +05:30
Runners should be registered as [shared Runners](../../ci/runners/README.md#registering-a-shared-runner)
2019-10-12 21:52:04 +05:30
for the entire GitLab instance, or [specific Runners](../../ci/runners/README.md#registering-a-specific-runner)
2020-05-24 23:13:21 +05:30
that are assigned to specific projects (the default if you've installed the
2019-12-26 22:10:19 +05:30
GitLab Runner managed application).
2019-12-04 20:38:33 +05:30
2020-05-24 23:13:21 +05:30
- **Prometheus** (for [Auto Monitoring](stages.md#auto-monitoring))
2019-12-04 20:38:33 +05:30
2020-05-24 23:13:21 +05:30
To enable Auto Monitoring, you need Prometheus installed either inside or
outside your cluster, and configured to scrape your Kubernetes cluster.
If you've configured GitLab's Kubernetes integration, you can deploy it to
2019-12-26 22:10:19 +05:30
your cluster by installing the
[GitLab-managed app for Prometheus](../../user/clusters/applications.md#prometheus).
2019-12-04 20:38:33 +05:30
2019-10-12 21:52:04 +05:30
The [Prometheus service](../../user/project/integrations/prometheus.md)
2020-05-24 23:13:21 +05:30
integration must be enabled for the project, or enabled as a
2019-10-12 21:52:04 +05:30
[default service template](../../user/project/integrations/services_templates.md)
2020-05-24 23:13:21 +05:30
for the entire GitLab installation.
2019-12-26 22:10:19 +05:30
2020-05-24 23:13:21 +05:30
To get response metrics (in addition to system metrics), you must
2019-12-26 22:10:19 +05:30
[configure Prometheus to monitor NGINX](../../user/project/integrations/prometheus_library/nginx_ingress.md#configuring-nginx-ingress-monitoring).
2018-03-17 18:26:18 +05:30
2020-03-13 15:44:24 +05:30
- **cert-manager** (optional, for TLS/HTTPS)
2020-05-24 23:13:21 +05:30
To enable HTTPS endpoints for your application, you must install cert-manager,
a native Kubernetes certificate management controller that helps with issuing
certificates. Installing cert-manager on your cluster issues a
[Lets Encrypt](https://letsencrypt.org/) certificate and ensures the
certificates are valid and up-to-date. If you've configured GitLab's Kubernetes
integration, you can deploy it to your cluster by installing the
2020-03-13 15:44:24 +05:30
[GitLab-managed app for cert-manager](../../user/clusters/applications.md#cert-manager).
2020-04-08 14:13:33 +05:30
2020-05-24 23:13:21 +05:30
If you don't have Kubernetes or Prometheus installed, then
[Auto Review Apps](stages.md#auto-review-apps),
[Auto Deploy](stages.md#auto-deploy), and [Auto Monitoring](stages.md#auto-monitoring)
are skipped.
After all requirements are met, you can [enable Auto DevOps](#enablingdisabling-auto-devops).
### AWS ECS
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/208132) in GitLab 13.0.
You can choose to target [AWS ECS](../../ci/cloud_deployment/index.md) as a deployment platform instead of using Kubernetes.
To get started on Auto DevOps to ECS, you'll have to add a specific Environment
Variable. To do so, follow these steps:
2018-03-17 18:26:18 +05:30
2020-05-24 23:13:21 +05:30
1. In your project, go to **Settings > CI / CD** and expand the **Variables**
section.
1. Specify which AWS platform to target during the Auto DevOps deployment
by adding the `AUTO_DEVOPS_PLATFORM_TARGET` variable.
1. Give this variable the value `ECS` before saving it.
When you trigger a pipeline, if you have AutoDev Ops enabled and if you have correctly
[entered AWS credentials as environment variables](../../ci/cloud_deployment/index.md#deploy-your-application-to-aws-elastic-container-service-ecs),
your application will be deployed to AWS ECS.
NOTE: **Note:**
If you have both a valid `AUTO_DEVOPS_PLATFORM_TARGET` variable and a Kubernetes cluster tied to your project,
only the deployment to Kubernetes will run.
2019-12-26 22:10:19 +05:30
2018-11-08 19:23:39 +05:30
## Auto DevOps base domain
2018-03-17 18:26:18 +05:30
2020-05-24 23:13:21 +05:30
The Auto DevOps base domain is required to use
2020-04-22 19:07:51 +05:30
[Auto Review Apps](stages.md#auto-review-apps), [Auto Deploy](stages.md#auto-deploy), and
2020-05-24 23:13:21 +05:30
[Auto Monitoring](stages.md#auto-monitoring). You can define the base domain in
any of the following places:
- either under the cluster's settings, whether for
[projects](../../user/project/clusters/index.md#base-domain) or
[groups](../../user/group/clusters/index.md#base-domain)
- or in instance-wide settings in **{admin}** **Admin Area > Settings** under the
**Continuous Integration and Delivery** section
2019-03-02 22:35:43 +05:30
- or at the project level as a variable: `KUBE_INGRESS_BASE_DOMAIN`
- or at the group level as a variable: `KUBE_INGRESS_BASE_DOMAIN`.
2019-09-04 21:01:54 +05:30
The base domain variable `KUBE_INGRESS_BASE_DOMAIN` follows the same order of precedence
2019-07-31 22:56:46 +05:30
as other environment [variables](../../ci/variables/README.md#priority-of-environment-variables).
2018-03-17 18:26:18 +05:30
2019-12-26 22:10:19 +05:30
TIP: **Tip:**
2020-05-24 23:13:21 +05:30
If you use the [GitLab managed app for Ingress](../../user/clusters/applications.md#ingress),
the URL endpoint should be automatically configured for you. All you must do
2019-12-26 22:10:19 +05:30
is use its value for the `KUBE_INGRESS_BASE_DOMAIN` variable.
NOTE: **Note:**
`AUTO_DEVOPS_DOMAIN` was [deprecated in GitLab 11.8](https://gitlab.com/gitlab-org/gitlab-foss/issues/52363)
2020-05-24 23:13:21 +05:30
and replaced with `KUBE_INGRESS_BASE_DOMAIN`, and removed in
2019-12-26 22:10:19 +05:30
[GitLab 12.0](https://gitlab.com/gitlab-org/gitlab-foss/issues/56959).
2019-09-04 21:01:54 +05:30
2020-05-24 23:13:21 +05:30
Auto DevOps requires a wildcard DNS A record matching the base domain(s). For
a base domain of `example.com`, you'd need a DNS entry like:
2018-03-17 18:26:18 +05:30
2020-05-24 23:13:21 +05:30
```plaintext
2018-03-17 18:26:18 +05:30
*.example.com 3600 A 1.2.3.4
```
2020-05-24 23:13:21 +05:30
In this case, the deployed applications are served from `example.com`, and `1.2.3.4`
is the IP address of your load balancer; generally NGINX ([see requirements](#requirements)).
Setting up the DNS record is beyond the scope of this document; check with your
DNS provider for information.
2018-03-17 18:26:18 +05:30
2020-05-24 23:13:21 +05:30
Alternatively, you can use free public services like [nip.io](https://nip.io)
which provide automatic wildcard DNS without any configuration. For [nip.io](https://nip.io),
set the Auto DevOps base domain to `1.2.3.4.nip.io`.
2018-10-15 14:42:47 +05:30
2020-05-24 23:13:21 +05:30
After completing setup, all requests hit the load balancer, which routes requests
to the Kubernetes pods running your application.
2018-03-17 18:26:18 +05:30
2018-12-13 13:39:08 +05:30
## Enabling/Disabling Auto DevOps
2018-03-17 18:26:18 +05:30
2020-05-24 23:13:21 +05:30
When first using Auto DevOps, review the [requirements](#requirements) to ensure
all the necessary components to make full use of Auto DevOps are available. First-time
users should follow the [quick start guide](quick_start_guide.md).
2018-03-17 18:26:18 +05:30
2020-05-24 23:13:21 +05:30
GitLab.com users can enable or disable Auto DevOps only at the project level.
Self-managed users can enable or disable Auto DevOps at the project, group, or
instance level.
2018-03-17 18:26:18 +05:30
2019-12-26 22:10:19 +05:30
### At the project level
2018-03-17 18:26:18 +05:30
2020-05-24 23:13:21 +05:30
If enabling, check that your project does not have a `.gitlab-ci.yml`, or if one exists, remove it.
2019-09-04 21:01:54 +05:30
2020-05-24 23:13:21 +05:30
1. Go to your project's **{settings}** **Settings > CI/CD > Auto DevOps**.
1. Select the **Default to Auto DevOps pipeline** checkbox to enable it.
1. (Optional, but recommended) When enabling, you can add in the
[base domain](#auto-devops-base-domain) Auto DevOps uses to
[deploy your application](stages.md#auto-deploy),
2019-12-26 22:10:19 +05:30
and choose the [deployment strategy](#deployment-strategy).
2018-12-13 13:39:08 +05:30
1. Click **Save changes** for the changes to take effect.
2020-05-24 23:13:21 +05:30
After enabling the feature, an Auto DevOps pipeline is triggered on the default branch.
2019-12-26 22:10:19 +05:30
2019-10-12 21:52:04 +05:30
### At the group level
2019-07-07 11:18:12 +05:30
2019-12-04 20:38:33 +05:30
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/issues/52447) in GitLab 11.10.
2019-07-07 11:18:12 +05:30
2019-09-04 21:01:54 +05:30
Only administrators and group owners can enable or disable Auto DevOps at the group level.
2020-05-24 23:13:21 +05:30
When enabling or disabling Auto DevOps at group level, group configuration is
implicitly used for the subgroups and projects inside that group, unless Auto DevOps
is specifically enabled or disabled on the subgroup or project.
2019-07-07 11:18:12 +05:30
2020-05-24 23:13:21 +05:30
To enable or disable Auto DevOps at the group level:
2019-07-07 11:18:12 +05:30
2020-05-24 23:13:21 +05:30
1. Go to your group's **{settings}** **Settings > CI/CD > Auto DevOps** page.
1. Select the **Default to Auto DevOps pipeline** checkbox to enable it.
1. Click **Save changes** for the changes to take effect.
2019-07-07 11:18:12 +05:30
2019-12-26 22:10:19 +05:30
### At the instance level (Administrators only)
2018-12-13 13:39:08 +05:30
2019-12-26 22:10:19 +05:30
Even when disabled at the instance level, group owners and project maintainers can still enable
Auto DevOps at the group and project level, respectively.
2018-12-13 13:39:08 +05:30
2020-05-24 23:13:21 +05:30
1. Go to **{admin}** **Admin Area > Settings > Continuous Integration and Deployment**.
1. Select **Default to Auto DevOps pipeline for all projects** to enable it.
1. (Optional) You can set up the Auto DevOps [base domain](#auto-devops-base-domain),
for Auto Deploy and Auto Review Apps to use.
2018-12-13 13:39:08 +05:30
1. Click **Save changes** for the changes to take effect.
2019-10-12 21:52:04 +05:30
### Enable for a percentage of projects
2018-03-17 18:26:18 +05:30
2020-05-24 23:13:21 +05:30
You can use a feature flag to enable Auto DevOps by default to your desired percentage
of projects. From the console, enter the following command, replacing `10` with
your desired percentage:
2019-09-04 21:01:54 +05:30
2020-05-24 23:13:21 +05:30
```ruby
Feature.get(:force_autodevops_on_by_default).enable_percentage_of_actors(10)
```
2018-11-20 20:47:30 +05:30
2018-11-08 19:23:39 +05:30
### Deployment strategy
2019-12-04 20:38:33 +05:30
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/issues/38542) in GitLab 11.0.
2018-11-08 19:23:39 +05:30
You can change the deployment strategy used by Auto DevOps by going to your
2020-05-24 23:13:21 +05:30
project's **{settings}** **Settings > CI/CD > Auto DevOps**. The following options
are available:
2018-11-08 19:23:39 +05:30
2020-04-22 19:07:51 +05:30
- **Continuous deployment to production**: Enables [Auto Deploy](stages.md#auto-deploy)
2018-12-05 23:21:45 +05:30
with `master` branch directly deployed to production.
- **Continuous deployment to production using timed incremental rollout**: Sets the
2020-04-22 19:07:51 +05:30
[`INCREMENTAL_ROLLOUT_MODE`](customize.md#timed-incremental-rollout-to-production-premium) variable
2020-05-24 23:13:21 +05:30
to `timed`. Production deployments execute with a 5 minute delay between
2018-12-05 23:21:45 +05:30
each increment in rollout.
- **Automatic deployment to staging, manual deployment to production**: Sets the
2020-04-22 19:07:51 +05:30
[`STAGING_ENABLED`](customize.md#deploy-policy-for-staging-and-production-environments) and
[`INCREMENTAL_ROLLOUT_MODE`](customize.md#incremental-rollout-to-production-premium) variables
2018-12-05 23:21:45 +05:30
to `1` and `manual`. This means:
- `master` branch is directly deployed to staging.
- Manual actions are provided for incremental rollout to production.
2018-11-08 19:23:39 +05:30
2019-12-26 22:10:19 +05:30
## Using multiple Kubernetes clusters **(PREMIUM)**
2020-05-24 23:13:21 +05:30
When using Auto DevOps, you can deploy different environments to
different Kubernetes clusters, due to the 1:1 connection
[existing between them](../../user/project/clusters/index.md#multiple-kubernetes-clusters-premium).
2019-12-26 22:10:19 +05:30
2020-05-24 23:13:21 +05:30
The [template](https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml)
used by Auto DevOps currently defines 3 environment names:
2019-12-26 22:10:19 +05:30
- `review/` (every environment starting with `review/`)
- `staging`
- `production`
2020-05-24 23:13:21 +05:30
Those environments are tied to jobs using [Auto Deploy](stages.md#auto-deploy), so
except for the environment scope, they must have a different deployment domain.
You must define a separate `KUBE_INGRESS_BASE_DOMAIN` variable for each of the above
[based on the environment](../../ci/variables/README.md#limit-the-environment-scopes-of-environment-variables).
2019-12-26 22:10:19 +05:30
2020-05-24 23:13:21 +05:30
The following table is an example of how to configure the three different clusters:
2019-12-26 22:10:19 +05:30
| Cluster name | Cluster environment scope | `KUBE_INGRESS_BASE_DOMAIN` variable value | Variable environment scope | Notes |
|--------------|---------------------------|-------------------------------------------|----------------------------|---|
2020-05-24 23:13:21 +05:30
| review | `review/*` | `review.example.com` | `review/*` | The review cluster which runs all [Review Apps](../../ci/review_apps/index.md). `*` is a wildcard, used by every environment name starting with `review/`. |
| staging | `staging` | `staging.example.com` | `staging` | (Optional) The staging cluster which runs the deployments of the staging environments. You must [enable it first](customize.md#deploy-policy-for-staging-and-production-environments). |
| production | `production` | `example.com` | `production` | The production cluster which runs the production environment deployments. You can use [incremental rollouts](customize.md#incremental-rollout-to-production-premium). |
2019-12-26 22:10:19 +05:30
To add a different cluster for each environment:
2020-05-24 23:13:21 +05:30
1. Navigate to your project's **{cloud-gear}** **Operations > Kubernetes**.
1. Create the Kubernetes clusters with their respective environment scope, as
described from the table above.
2019-12-26 22:10:19 +05:30
![Auto DevOps multiple clusters](img/autodevops_multiple_clusters.png)
2020-05-24 23:13:21 +05:30
1. After creating the clusters, navigate to each cluster and install Helm Tiller
2019-12-26 22:10:19 +05:30
and Ingress. Wait for the Ingress IP address to be assigned.
2020-05-24 23:13:21 +05:30
1. Make sure you've [configured your DNS](#auto-devops-base-domain) with the
2019-12-26 22:10:19 +05:30
specified Auto DevOps domains.
2020-05-24 23:13:21 +05:30
1. Navigate to each cluster's page, through **{cloud-gear}** **Operations > Kubernetes**,
2019-12-26 22:10:19 +05:30
and add the domain based on its Ingress IP address.
2020-05-24 23:13:21 +05:30
After completing configuration, you can test your setup by creating a merge request
and verifying your application is deployed as a Review App in the Kubernetes
2019-12-26 22:10:19 +05:30
cluster with the `review/*` environment scope. Similarly, you can check the
other environments.
2018-03-17 18:26:18 +05:30
## Currently supported languages
2019-09-04 21:01:54 +05:30
Note that not all buildpacks support Auto Test yet, as it's a relatively new
2020-05-24 23:13:21 +05:30
enhancement. All of Heroku's
[officially supported languages](https://devcenter.heroku.com/articles/heroku-ci#supported-languages)
support Auto Test. The languages supported by Heroku's Herokuish buildpacks all
support Auto Test, but notably the multi-buildpack does not.
2018-03-17 18:26:18 +05:30
As of GitLab 10.0, the supported buildpacks are:
2020-05-24 23:13:21 +05:30
```plaintext
2018-03-17 18:26:18 +05:30
- heroku-buildpack-multi v1.0.0
- heroku-buildpack-ruby v168
- heroku-buildpack-nodejs v99
- heroku-buildpack-clojure v77
- heroku-buildpack-python v99
- heroku-buildpack-java v53
- heroku-buildpack-gradle v23
- heroku-buildpack-scala v78
- heroku-buildpack-play v26
- heroku-buildpack-php v122
- heroku-buildpack-go v72
- heroku-buildpack-erlang fa17af9
- buildpack-nginx v8
```
2020-05-24 23:13:21 +05:30
If your application needs a buildpack that is not in the above list, you
might want to use a [custom buildpack](customize.md#custom-buildpacks).
2018-03-17 18:26:18 +05:30
## Limitations
The following restrictions apply.
2019-10-12 21:52:04 +05:30
### Private registry support
2020-05-24 23:13:21 +05:30
No documented way of using private container registry with Auto DevOps exists.
We strongly advise using GitLab Container Registry with Auto DevOps to
2019-10-12 21:52:04 +05:30
simplify configuration and prevent any unforeseen issues.
2019-12-04 20:38:33 +05:30
### Installing Helm behind a proxy
2020-05-24 23:13:21 +05:30
GitLab does not support installing [Helm as a GitLab-managed App](../../user/clusters/applications.md#helm) when
behind a proxy. Users who want to do so must inject their proxy settings
into the installation pods at runtime, such as by using a
2019-12-04 20:38:33 +05:30
[`PodPreset`](https://kubernetes.io/docs/concepts/workloads/pods/podpreset/):
2020-05-24 23:13:21 +05:30
```yaml
2019-12-04 20:38:33 +05:30
apiVersion: settings.k8s.io/v1alpha1
kind: PodPreset
metadata:
name: gitlab-managed-apps-default-proxy
namespace: gitlab-managed-apps
spec:
env:
- name: http_proxy
value: "PUT_YOUR_HTTP_PROXY_HERE"
- name: https_proxy
value: "PUT_YOUR_HTTPS_PROXY_HERE"
```
2018-03-17 18:26:18 +05:30
## Troubleshooting
2020-05-24 23:13:21 +05:30
### Unable to select a buildpack
Auto Build and Auto Test may fail to detect your language or framework with the
following error:
```plaintext
Step 5/11 : RUN /bin/herokuish buildpack build
---> Running in eb468cd46085
-----> Unable to select a buildpack
The command '/bin/sh -c /bin/herokuish buildpack build' returned a non-zero code: 1
```
The following are possible reasons:
- Your application may be missing the key files the buildpack is looking for.
Ruby applications require a `Gemfile` to be properly detected,
even though it's possible to write a Ruby app without a `Gemfile`.
- No buildpack may exist for your application. Try specifying a
[custom buildpack](customize.md#custom-buildpacks).
### Mismatch between testing frameworks
Auto Test may fail because of a mismatch between testing frameworks. In this
case, you may need to customize your `.gitlab-ci.yml` with your test commands.
### Pipeline that extends Auto DevOps with only / except fails
If your pipeline fails with the following message:
```plaintext
Found errors in your .gitlab-ci.yml:
jobs:test config key may not be used with `rules`: only
```
This error appears when the included jobs rules configuration has been overridden with the `only` or `except` syntax.
To fix this issue, you must either:
- Transition your `only/except` syntax to rules.
- (Temporarily) Pin your templates to the [GitLab 12.10 based templates](https://gitlab.com/gitlab-org/auto-devops-v12-10).
### Failure to create a Kubernetes namespace
Auto Deploy will fail if GitLab can't create a Kubernetes namespace and
service account for your project. For help debugging this issue, see
[Troubleshooting failed deployment jobs](../../user/project/clusters/index.md#troubleshooting).
2018-03-17 18:26:18 +05:30
2019-09-04 21:01:54 +05:30
## Development guides
2019-12-21 20:55:43 +05:30
[Development guide for Auto DevOps](../../development/auto_devops.md)