Commit 02c83d96 authored by FulcrandG's avatar FulcrandG
Browse files

Testing documentation builder

parent ceeb15ea
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ job_changelog_dir = "versions"
job_description_file = "README.md"
job_license_file = "LICENSE"

mk_changelog_wrapper = "\n## Changelog\n\n* **[latest]**(<LATEST_RELEASE>)\n"
mk_changelog_wrapper = "\n## Changelog\n\n* **[latest]**(current -> `<LATEST_RELEASE>`) : `<TAG_URL>`\n"
mk_license_wrapper = "??? License\n"

mkdocs_job_content = ""
@@ -62,7 +62,7 @@ def add_changelog(job_path, job_name):
  for release in listdir(job_path + "/" + job_changelog_dir)[::-1]:
    with open(job_path + "/" + job_changelog_dir + "/" + release) as file:
      mkdocs_job_content += file.read()
      # TODO replace> <include tag by the link to the release
      # TODO replace <include tag by the link to the release
  # Adding a new line for consistency
  mkdocs_job_content += "\n"

@@ -96,7 +96,7 @@ if __name__ == "__main__":
  # Iterate over every directories in jobs directory to create their job.md for the documentation
  ### TO EDIT
  # for job in listdir(jobs_dir):
  job = "python_test"
  for job in ["python_test", "trivy_image"]:
  ###
    create_job_doc(job)

docs/jobs/index.md

deleted100644 → 0
+0 −37
Original line number Diff line number Diff line
# 🗂 Index

Jobs index. They are sorted using the [HUB default stages](/getting-started#stages).

## 🔎 Static tests

| Name | Description |
| ---- | ----------- |
| 🐨 [Coala](/jobs/static_tests/coala) | Check code quality using Coala |

## 📦 Build

| Name | Description |
| ---- | ----------- |
| 📒 [ApiDoc](/jobs/build/apidoc) | Creates a HTML documentation from API annotations in source code |
| 🐳 [Docker](/jobs/build/docker) | Build and publish Docker image using Kaniko |
| 📃 [Mkdocs](/jobs/build/mkdocs) | Build documentation from markdown to HTML using Mkdocs|

## 🛡 Dynamic tests

| Name | Description |
| ---- | ----------- |
| 🧱 [Trivy image analysis](/jobs/dynamic_tests/trivy_image) | Run a security analysis on docker image using Trivy |

## 🙋 Review

| Name | Description |
| ---- | ----------- |
| ☸️ [Helm](/jobs/deployment/helm) | Deploy a review environment on Kubernetes using a Helm chart |

## 🚀 Deployment

| Name | Description |
| ---- | ----------- |
| ☸️ [Helm](/jobs/deployment/helm) | Deploy on Kubernetes using a Helm chart |
| 🦊 [Pages](/jobs/deployment/pages) | Build and publish Docker image using Kaniko |

docs/jobs/index.md.old

deleted100644 → 0
+0 −37
Original line number Diff line number Diff line
# 🗂 Index

Jobs index. They are sorted using the [HUB default stages](/getting-started#stages).

## 🔎 Static tests

| Name | Description |
| ---- | ----------- |
| 🐨 [Coala](/jobs/static_tests/coala) | Check code quality using Coala |

## 📦 Build

| Name | Description |
| ---- | ----------- |
| 📒 [ApiDoc](/jobs/build/apidoc) | Creates a HTML documentation from API annotations in source code |
| 🐳 [Docker](/jobs/build/docker) | Build and publish Docker image using Kaniko |
| 📃 [Mkdocs](/jobs/build/mkdocs) | Build documentation from markdown to HTML using Mkdocs|

## 🛡 Dynamic tests

| Name | Description |
| ---- | ----------- |
| 🧱 [Trivy image analysis](/jobs/dynamic_tests/trivy_image) | Run a security analysis on docker image using Trivy |

## 🙋 Review

| Name | Description |
| ---- | ----------- |
| ☸️ [Helm](/jobs/deployment/helm) | Deploy a review environment on Kubernetes using a Helm chart |

## 🚀 Deployment

| Name | Description |
| ---- | ----------- |
| ☸️ [Helm](/jobs/deployment/helm) | Deploy on Kubernetes using a Helm chart |
| 🦊 [Pages](/jobs/deployment/pages) | Build and publish Docker image using Kaniko |

jobs/python_test/Description.md

deleted100644 → 0
+0 −53
Original line number Diff line number Diff line
# 🐍 Python Testing

## Description

Allow you to launch unit tests from your python project. The default variables will use `pipenv` and `pytest` to launch the tests, but you're welcome to override them as you want.

## How to use it

1. Prepare your project with unit tests to run in a separate directory: [pytest usage](https://docs.pytest.org/en/2.8.7/usage.html)
2. Prepare a Pipfile for pipenv to install any python dependencies your project may have: [Pipfile for pipenv](https://pipenv-fork.readthedocs.io/en/latest/basics.html), including your test framework which is chosen by the `TEST_FRAMEWORK` [variable](#Variables)
3. Add the corresponding URL to your `.gitlab-ci.yml` file (see [Getting
   started](/getting-started)). Example:

    ```yaml
    include:
      - remote: 'https://jobs.go2scale.io/python_test.yml'
    ```

4. If you need to customize the job (stage, variables, ...) 👉 check the [jobs
   customization](/getting-started/#jobs-customization)
5. Well done, your job is ready to work ! 😀

## Job details

* Job name: `python_test`
* Docker image:
[`python:3.7`](https://hub.docker.com/r/_/python)
* Default stage: `static_tests`
* When: `always`

!!! note
    We are not using an [alpine linux](https://alpinelinux.org/) docker image in order to improve speed over ressource efficiency. Alpine linux is using musl-libc and not glibc, so it can't use the python [wheels](https://pythonwheels.com/) with pip to get compiled dependencies while setting up your environment, and have to download and compile from source those libraries. As speed is the real issue that CI can have when building complex systems, we decided to use the general docker image of `python:3.7` based on Debian. You can see the explanation at this [link](https://pythonspeed.com/articles/alpine-docker-python/#:~:text=Don't%20use%20Alpine%20Linux,choosing%20a%20good%20base%20image).

### Variables

| Name | Description | Default |
| ---- | ----------- | ------- |
| `APT_PACKAGES` | Packages that need to be installed | ` ` |
| `PYTHON_SETUP` | Bash commands to setup your python environment | `pip install pipenv; pipenv --bare install --dev` |
| `VENV` | Command to launch your testing environment | `pipenv run` |
| `TEST_FRAMEWORK` | Command to launch your testing framework | `pytest` |
| `OPTIONS` | Options to add to your testing framework | ` ` |
| `TEST_PATH` | Path to test folder | `/tests/unit` |

#### Changing the test framework

If you want for example to change your test framework from pytest to nosetests, you just have to override the `TEST_FRAMEWORK` variable as such in your `gitlab-ci.yml`, after including the job:

```yaml
python_tests:
  variables:
    TEST_FRAMEWORK: "nosetests"
```
+4 −0
Original line number Diff line number Diff line
name: python_test
description: A ready-to-use pipenv+pytest environment to launch your unit tests
default_stage: static_tests
icon: 🐍
 No newline at end of file
Loading