FAQ | This is a LIVE service | Changelog

Skip to content
Commits on Source (2)
  • Dr Rich Wareham's avatar
    feat(pre-commit): add support for Docker · 300b5bab
    Dr Rich Wareham authored
    Add a docker service to the pre-commit job and appropriate variables to
    allow pre-commit jobs to use docker images should they desire.
    
    Since this change involves adding a `before_script`, future-proof
    ourselves against jobs wanting to customise the `before_script` section
    of the config by making `pre-commit` into a template job. This means
    that jobs can *extend* `before_script` using `!reference` tags.
    
    Closes #62
    300b5bab
  • Ryan Kowalewski's avatar
    Merge branch 'issue-63-pre-commit-docker-support' into 'master' · 2eed187c
    Ryan Kowalewski authored
    feat(pre-commit): add support for Docker
    
    Closes #62
    
    See merge request !71
    2eed187c
......@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [3.6.0] - 2024-01-16
### Changed
- `pre-commit.yml` now allows hooks to use docker images.
- `pre-commit.yml` defines the `pre-commit` job as an extension of the
`.pre-commit` template to allow for customisation.
## [3.5.0] - 2024-01-16
- `python-tox.yml` allows specifying a precise version of `tox` to use.
......
......@@ -11,8 +11,15 @@
# file: '/auto-devops/pre-commit.yml'
# ref: v2.1.2
pre-commit:
.pre-commit:
services:
- docker:24-dind
image: registry.gitlab.developers.cam.ac.uk/uis/devops/infra/dockerimages/pre-commit:3.3
before_script:
- until docker info > /dev/null 2>&1; do sleep 1; done
script:
- pre-commit run --all-files
......@@ -23,7 +30,18 @@ pre-commit:
stage: test
rules:
- if: $PRE_COMMIT_DISABLED
when: never
- exists:
- .pre-commit-config.yaml
variables:
DOCKER_HOST: tcp://docker:2375
# By having the pre-commit job extend .pre-commit, downstream jobs can customise, e.g., the before scripts by including
# !reference[.pre-commit, before_script] to inherit any before_script commands.
pre-commit:
extends: .pre-commit
rules:
- if: $PRE_COMMIT_DISABLED
when: never
- !reference [.pre-commit, rules]