Commit a4308950 authored by Federico Falconieri's avatar Federico Falconieri
Browse files

Merge branch 'hoverht-master-patch-51460' into 'master'

docs: Update readme and add CONTRIBUTING.md

Closes #34

See merge request ci/templates!22
parents 953dce32 89c9f821
Loading
Loading
Loading
Loading

CONTRIBUTING.md

0 → 100644
+5 −0
Original line number Diff line number Diff line
# Contributing

Would you like to contribute? There are 2 ways:
1. Fork this project, commit your changes there, and do a Merge Request against this project. Don't forget to assign either @falconierif or @hoverht to have a look at your code.
2. Ask us to become a Developer in this repo, so you can develop in a branch here.
+42 −64
Original line number Diff line number Diff line
# CI templates

## Version 3 released :tada: 

Have a look at !119 for the many (breaking) changes in v3.
Maintainers:
* Federico Falconieri: @falconierif
* Ruben ten Hove: @hoverht

If you're not ready to migrate, you can still use the v2 jobs by adding the
following to your job includes:
Any questions, problems, suggestions? [Create an issue](issues/new)!

```yaml
include:
  - project: 'utils/ci-templates'
    file: 'docker/kaniko-build-image.yml'
    ref: 'v2'
```

## Repository
## Version 3 released :tada: 

This repository contains a collection of modular gitlab ci jobs and pipelines.
In order to use them in your project, you will need to have a gitlab runner configured.

Maintainers:
* Federico Falconieri: @falconierif
* Ruben ten Hove: @rhtenhove
In order to use them in your project, you will need to have a [GitLab runner](https://docs.gitlab.com/ee/ci/runners/) configured.

This is a example of how you import the pylint job from this repository in your 
own downstream project `.gitlab-ci.yml`:
own project's `.gitlab-ci.yml`:

```yaml
include:
  - project: 'utils/ci-templates'
  - project: 'ci/templates'
    file: 'python/pylint.yml'

# Add your own jobs here...
```

> See the [gitlab docs](https://docs.gitlab.com/ee/ci/yaml/includes.html) or our
[testing repo](https://gitlab.com/notno/testing/python) for more examples.
That's all!

> See the [gitlab docs](https://docs.gitlab.com/ee/ci/yaml/includes.html) for more details on how
> includes work.

## Semantic versioning and breaking changes

We tag changes automagically using [semantic-release](https://semantic-release.gitbook.io/semantic-release/). Every time a merge request is accepted, a semantic-release job produces arelease (and an associated tag).

You can import jobs and pipelines from a specific tag or branch if you desire.
If you do not specify a tag or branch, you will import what is on `master`.
If your downstream project does not work anymore because there has been a breaking 
change in `master`, use an older tag like this:
You can import jobs and pipelines from a specific tag or branch if you desire, for example if you
like the way things were before.
If you do not specify a tag or branch, you will import what is on `master`, i.e. the latest.
If your project does not work anymore because there has been a breaking change in `master`,
use an older tag like this:

```yaml
include:
  - project: 'utils/ci-templates'
    file: 'quality-assurance/python-2-stars.yml'
    ref: 'v2.1.2'
  - project: 'ci/templates'
    file: 'python/pylint.yml'
    ref: 'v3.1.2'
```

## Customize kaniko builds

Kaniko is a special job here, as it builds Docker images for you without any special requirements,
but also prepares Docker images for specific tests which require an image.

You can add variables to customize the Kaniko build. Use the following syntax to setup
a kaniko build job, and change variables where you'd like. See comments for their use.
None are required, you can just just the first 3 lines and get your builds done.

```yaml
include:
  - project: 'utils/ci-templates'
    file: 'docker/kaniko-template.yml'
  - project: 'ci/templates'
    file: 'docker/kaniko.yml'

kaniko:
  variables:
@@ -83,49 +75,35 @@ another-build:
    DOCKERFILE: "mydockerfiles/mycustom.Dockerfile"
```

## Python out-of-the-box quality pipelines
The example above now has two jobs, one is called `kaniko`, the other `another-build`.

Do you want to use the jobs from with repository but can't be bothered to import them 
one by one manually? Me too.
You can easily import one of three python pipelines with a focus on quality (inspired 
by the "Beter Leven" system) like this:
## Python out-of-the-box pipelines

1/3 stars `.gitlab-ci.yml`
```yaml
include:
  - project: 'utils/ci-templates'
    file: 'python/pipelines/stars/1.yml'
```
Do you want to use a basic set of jobs from this repository, but can't be bothered to 
import them one by one manually?
You can easily import one of three python pipelines with a focus on levels of quality like this:

2/3 stars `.gitlab-ci.yml`
#### Basic
```yaml
include:
  - project: 'utils/ci-templates'
    file: 'python/pipelines/stars/2.yml'
  - project: 'ci/templates'
    file: 'pipelines/python-basic.yml'
```

3/3 stars `.gitlab-ci.yml`
#### Advanced
```yaml
include:
  - project: 'utils/ci-templates'
    file: 'python/pipelines/stars/3.yml'
  - project: 'ci/templates'
    file: 'pipelines/python-docker-basic.yml'
```

# Contributing

Some things to know about this repo to understand how it works:

### Pipelines

We only run pipelines for Merge Requests using:

#### Pro
```yaml
include:
  - template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'
  - project: 'ci/templates'
    file: 'pipelines/python-docker-pro.yml'
```

This means that you can start testing pipelines when you create a merge request for
your branch. If you just work on a branch, any pushes will go on that branch but
will not trigger a Pipeline. When your work is ready to test, just create a Merge
Request.
# Contributing

See [`CONTRIBUTING.md`](CONTRIBUTING.md)