Skip to content

Hooks

The next service we will build is our hooks service.

pre-commit.lefthook.yml

First, lets take a look at our pre-commit.lefthook.yml file.

pre-commit.lefthook.yml
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
pre-commit:
  jobs:
    # Run docker compose with the downloaded compose file
    # TODO: What is missing from the docker compose call?
    - name: run-shellcheckit-pre-commit-test
      tags:
        - test
        - docker
        - shellcheckit
      run: |
        docker compose \
          -f ".git/info/lefthook-remotes/pipelines-as-a-service-main/services/compose/compose.yml" \
          run \
            --rm \
            --remove-orphans \
          shellcheckit

Solution

pre-commit.lefthook.yml.solution
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
pre-commit:
  jobs:
    # Run docker compose with the downloaded compose file
    - name: run-shellcheckit-pre-commit-test
      tags:
        - test
        - docker
        - shellcheckit
      run: |
        docker compose \
          -f ".git/info/lefthook-remotes/pipelines-as-a-service-main/services/compose/prod.overrides.compose.yml" \
          -f ".git/info/lefthook-remotes/pipelines-as-a-service-main/services/compose/compose.yml" \
          run \
            --rm \
            --remove-orphans \
          shellcheckit

Next, we will build our pipeline service.