From 243484c29d7a16320b44314dc4db934946961d86 Mon Sep 17 00:00:00 2001 From: Oleg Kainov Date: Sun, 17 May 2020 18:11:14 +0200 Subject: [PATCH] ci: enable pre-commit checks --- .dockerignore | 2 +- .github/workflows/main.yml | 6 ++---- .pre-commit-config.yaml | 11 +++++++++++ README.md | 9 +++++---- config_inc.php | 2 +- docker-compose.yaml | 2 +- 6 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.dockerignore b/.dockerignore index ecd6395..362666d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,4 +2,4 @@ * !mantis-entrypoint* -!config_inc.php \ No newline at end of file +!config_inc.php diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 38a1ab5..6c9715f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,9 +21,7 @@ jobs: steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 - - # Runs a single command using the runners shell - - name: Run a one-line script - run: echo Hello, world! + - name: pre-commit + uses: pre-commit/action@v1.1.0 - name: Hadolint Action uses: brpaz/hadolint-action@v1.1.0 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..22a68b3 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,11 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.3.0 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + - id: check-case-conflict + # Useful, but so far is broken on Windows +# - id: check-executables-have-shebangs + - id: check-merge-conflict diff --git a/README.md b/README.md index 42d4a4f..5362155 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Docker image for Mantis Bug Tracker https://www.mantisbt.org/ # Why this image? -There are some other alternative images exist already such as [vimagick/mantisbt](https://hub.docker.com/r/vimagick/mantisbt/), [xlrl/docker-mantisbt](https://github.com/xlrl/docker-mantisbt) and others. Why do we need yet another image? +There are some other alternative images exist already such as [vimagick/mantisbt](https://hub.docker.com/r/vimagick/mantisbt/), [xlrl/docker-mantisbt](https://github.com/xlrl/docker-mantisbt) and a few others. Why do we need yet another image? The reason is to combine all the nice features each of them have and add some missing features. To list some: @@ -16,7 +16,8 @@ The reason is to combine all the nice features each of them have and add some mi - Allows to easily configure presence of `admin` service folder - Comes with built-in integration with Gitlab and Github [source plugins](https://github.com/mantisbt-plugins/source-integration) - Example `docker-compose.yml` file provided for getting started in one click! -- Easy customization of the config files and custom plugins without destroying data from base image. +- Easy customization of the config files and custom plugins without destroying data from base image +- Consistent Dockerfile style following all best practices (ensured by Dockerfile lint) # Quick start @@ -28,7 +29,7 @@ https://www.mantisbt.org/docs/master/en-US/Admin_Guide/html-desktop/#admin.confi - Open browser at `localhost:8989/admin/install.php` and follow installation instructions, default out-of-the-box values are good to use. -- Ignore `Config File Exists but Database does not` warning and proceed installation - Log in as `administrator`/`root` (default credentials) and confugre whatever you need (typically you want to create your own Admin user and disable built-in "administrator" first) -- Check MantisBT own's checks at `localhost:8989/admin/`. Note: several warnings are expected to be "WARN" due to issues in MantisBT, such as magic quotes warning ([#26964](https://www.mantisbt.org/bugs/view.php?id=26964) and "folder outside of web root" warnings ([#21584](https://mantisbt.org/bugs/view.php?id=21584))) +- Check MantisBT own's checks at `localhost:8989/admin/`. Note: several warnings are expected to be "WARN" due to issues in MantisBT, such as magic quotes warning ([#26964](https://www.mantisbt.org/bugs/view.php?id=26964)) and "folder outside of web root" warnings ([#21584](https://mantisbt.org/bugs/view.php?id=21584))) - When ready to move to production, either remove `MANTIS_ENABLE_ADMIN` env variable or set it to 0 - this will remove "admin" folder from the installation. For further details refer to [official documentation](https://www.mantisbt.org/docs/master/en-US/Admin_Guide/html-desktop/#admin.install.new) @@ -75,4 +76,4 @@ More details are available in [official documentation](https://www.mantisbt.org/ ## Custom plugins -In order to add your own custom plugins into the image, either create your own Dockerfile and copy extra plugins to `/var/www/html/plugins/` or add volume in docker-compose to mount extra plugin directly inside existing image `./custom_plugin/:/var/www/html/plugins/custom_plugin/` \ No newline at end of file +In order to add your own custom plugins into the image, either create your own Dockerfile and copy extra plugins to `/var/www/html/plugins/` or add volume in docker-compose to mount extra plugin directly inside existing image `./custom_plugin/:/var/www/html/plugins/custom_plugin/` diff --git a/config_inc.php b/config_inc.php index 3421cda..94d6cbd 100644 --- a/config_inc.php +++ b/config_inc.php @@ -20,4 +20,4 @@ $g_webmaster_email = getenv('EMAIL_WEBMASTER') !== false ? getenv('EMAI $g_from_email = getenv('EMAIL_FROM') !== false ? getenv('EMAIL_FROM') : null; $g_return_path_email = getenv('EMAIL_RETURN_PATH') !== false ? getenv('EMAIL_RETURN_PATH') : null; -include 'config_inc_addon.php'; \ No newline at end of file +include 'config_inc_addon.php'; diff --git a/docker-compose.yaml b/docker-compose.yaml index b2d7d7d..41fffea 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -41,4 +41,4 @@ services: - MYSQL_USER=mantis - MYSQL_PASSWORD=mantis # Set default collation so Mantis does not complain about latin1 - command: ['mysqld', '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci'] \ No newline at end of file + command: ['mysqld', '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci']