diff --git a/doc/development/testing_guide/end_to_end/test_pipelines.md b/doc/development/testing_guide/end_to_end/test_pipelines.md index 4afe215383e7fa11c88d78dbf25b381bc4edd522..28cf2ae6e16796ab169178c2447219b4a81810d4 100644 --- a/doc/development/testing_guide/end_to_end/test_pipelines.md +++ b/doc/development/testing_guide/end_to_end/test_pipelines.md @@ -194,7 +194,12 @@ This stage is responsible for [allure test report](index.md#allure-report) gener The `e2e:test-on-cng` child pipeline runs tests against [Cloud Native GitLab](https://gitlab.com/gitlab-org/build/CNG) installation. Unlike `review-apps`, this pipeline uses local [kind](https://github.com/kubernetes-sigs/kind) Kubernetes cluster. -Currently this pipeline is executed on nightly scheduled pipelines and is mainly responsible for testing compatibility with minimal supported version of `redis`. +Deployment is managed by the [`cng`](../../../../gems/gitlab-cng/README.md) orchestrator tool, which you can also use to locally recreate CI/CD deployments. + +This pipeline is executed every two hours on scheduled pipelines and runs the following validations: + +- Main test suite against the `CNG` deployment using default chart configuration. +- Minimal `health_check` test suite against the `CNG` deployment that uses minimal supported `redis` version. ### Setup @@ -224,3 +229,11 @@ Jobs in `test` stage perform following actions: #### report This stage is responsible for [allure test report](index.md#allure-report) generation as well as test metrics upload. + +### Debugging + +To help with debugging: + +- Each test job prints a list of arguments that you can pass to the [`cng`](../../../../gems/gitlab-cng/README.md) orchestrator to exactly recreate + the same deployment for local debugging. +- Cluster events log and all pod logs are saved in E2E test job artifacts. diff --git a/gems/gitlab-cng/README.md b/gems/gitlab-cng/README.md index 91a6fd4d598a171ee3b4b8b6e48b4d8f5fdd50ce..10aed418bc30a38c815bc665fadfb4c3cc1f1015 100644 --- a/gems/gitlab-cng/README.md +++ b/gems/gitlab-cng/README.md @@ -1,3 +1,52 @@ -# Cng +# `cng` -CLI tool to support setup and deployments of [Cloud Native GitLab](https://gitlab.com/gitlab-org/build/CNG) builds. +`cng` is a CLI tool that supports setting up and deploying [Cloud Native GitLab](https://gitlab.com/gitlab-org/build/CNG) builds +using the official [GitLab Chart](https://gitlab.com/gitlab-org/charts/gitlab). + +## Usage + +`cng` is internal gem so it is not published to [rubygems](https://rubygems.org/). Run `cng` by prefixing commands with +`bundle exec` within its directory. + +```shell +$ bundle exec cng +Commands: + cng create [SUBCOMMAND] # Manage deployment related object creation + cng destroy [SUBCOMMAND] # Manage deployment related object cleanup + cng doctor # Validate presence of all required system dependencies + cng help [COMMAND] # Describe available commands or one specific command + cng log [SUBCOMMAND] # Manage deployment related logs + cng version # Print cng orchestrator version +``` + +## Add new deployments + +The main feature `cng` is to programmatically manage different deployment type configurations and setup. To implement new deployment configuration: + +1. Add a new subcommand method to the [`Deployment`](lib/gitlab/cng/commands/subcommands/deployment.rb) class. This allows you to to define your own input + arguments and documentation. +1. Define a configuration class based on the [`Base`](lib/gitlab/cng/lib/deployment/configurations/_base.rb) configuration class. You can implement: + - `pre-deployment` setup: optional setup steps that are executed before installing the `GitLab` instance. + - `post-deployment` setup: optional setup steps that are executed after instance of `GitLab` has been installed. + - `helm` values: set of values to apply during installation. +1. Define a cleanup class based on the [`Base`](lib/gitlab/cng/lib/deployment/configurations/cleanup/_base.rb) cleanup class. Implement a single method + that deletes all objects created by `pre-deployment` and `post-deployment` setup. + +## Tips + +### kubectl context + +`cng` CLI uses [`kubectl`](https://github.com/kubernetes/kubectl) and [Helm](https://github.com/helm/helm) to perform all `kubernetes`-related +operations. When running a deployment, [current context](https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_current-context/) +is always used. If non-default arguments are used when running the deployment, make sure current context points to the cluster where the deployment should be executed. + +### Shell integration + +To make `cng` globally available in your shell without the need to run the commands from a specific folder and prefixed with `bundle exec`, add the following +function to your shell's configuration file (for example,`.zshrc` or `.bash_profile`): + +```shell +function cng() { + (cd $PATH_TO_GITLAB_REPO/gems/gitlab-cng && BUNDLE_AUTO_INSTALL=true bundle exec cng "$@") +} +```