Commit a2798cb5 authored by Simon Cornet's avatar Simon Cornet
Browse files

[ci] feat: add linting stage

parent f71a91bd
Loading
Loading
Loading
Loading
Loading
+9 −25
Original line number Diff line number Diff line
---

variables:
  DOCKER_DRIVER: "overlay2"
  DOCKER_HOST: "tcp://localhost:2375/"
  DOCKER_TLS_CERTDIR: ""

# gitLab ci stages
stages:
  - "build"

build image:
  stage: "build"
  image: "docker:27.3.1"
  services:
    - name: "docker:27.3.1-dind"
      command: ["--tls=false"]
  script:

    # login to container registry
    - echo "$CR_PASSWORD" | docker login $CR_HOSTNAME -u $CR_USERNAME --password-stdin

    # build observium-pe image
    - "docker build -t simoncor-net -f Dockerfile.linux.amd64 ."
  # stages
  - "linting"
  - "build"

    # add tags to image
    - "docker image tag simoncor-net cr.simoncor.net/siempie/simoncor-net:latest"

    # push image to dockerhub.
    - "docker push --all-tags cr.simoncor.net/siempie/simoncor-net"
# include jobs
include:

    # logout from container registry
    - "docker logout $CR_HOSTNAME"
  # deployment
  - local: ".gitlab/linting.yaml"
  - local: ".gitlab/build.yaml"

.gitlab/build.yaml

0 → 100644
+32 −0
Original line number Diff line number Diff line
---

variables:
  DOCKER_DRIVER: "overlay2"
  DOCKER_HOST: "tcp://localhost:2375/"
  DOCKER_TLS_CERTDIR: ""

stages:
  - "build"

build image:
  stage: "build"
  image: "docker:27.3.1"
  services:
    - name: "docker:27.3.1-dind"
      command: ["--tls=false"]
  script:

    # login to container registry
    - "echo $CR_PASSWORD | docker login $CR_HOSTNAME -u $CR_USERNAME --password-stdin"

    # build observium-pe image
    - "docker build -t simoncor-net -f Dockerfile.linux.amd64 ."

    # add tags to image
    - "docker image tag simoncor-net cr.simoncor.net/siempie/simoncor-net:latest"

    # push image to dockerhub.
    - "docker push --all-tags cr.simoncor.net/siempie/simoncor-net"

    # logout from container registry
    - "docker logout $CR_HOSTNAME"

.gitlab/linting.yaml

0 → 100644
+12 −0
Original line number Diff line number Diff line
---

# linting
linting:
  stage: "linting"
  image:
    name: "cr.simoncor.net/siempie/ansible-deployment:latest"
    entrypoint: ["/bin/sh", "-c"]

  # start linting
  script:
    - "yamllint ."

.yamllint

0 → 100644
+30 −0
Original line number Diff line number Diff line
---
extends: 'default'

rules:
  braces:
    max-spaces-inside: 1
    forbid: true
  comments:
    min-spaces-from-content: 1
  comments-indentation: false
  empty-lines:
    max: 2
  indentation:
    spaces: 2
    check-multi-line-strings: true
  line-length:
    max: 130
    allow-non-breakable-words: true
    allow-non-breakable-inline-mappings: true
  new-line-at-end-of-file: 'enable'
  octal-values:
    forbid-implicit-octal: true
    forbid-explicit-octal: true
  truthy:
    allowed-values:
      - 'true'
      - 'false'
  quoted-strings:
    quote-type: 'any'
    required: true