From 92797ed6d2c9484ad902ab6c39b564a2b593240a Mon Sep 17 00:00:00 2001 From: Simon Cornet Date: Fri, 6 Jun 2025 13:40:54 +0200 Subject: [PATCH] feat(ci): added yamllint --- .gitlab/deployment.yaml | 19 +++++++++++-------- .gitlab/linting.yaml | 20 +++++++++++++++++--- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/.gitlab/deployment.yaml b/.gitlab/deployment.yaml index 4f1c6ad..eab31d5 100644 --- a/.gitlab/deployment.yaml +++ b/.gitlab/deployment.yaml @@ -13,17 +13,20 @@ deployment: # prepare ssh before_script: + # prepare ssh - | - # prepare ssh - mkdir -p ~/.ssh - chmod 700 ~/.ssh - echo "$SSH_CONFIG" > ~/.ssh/config - echo "$SSH_DEPLOYMENT_KEY" > ~/.ssh/id_ed25519 - chmod 600 ~/.ssh/id_ed25519 + # prepare ssh + mkdir -p ~/.ssh + chmod 700 ~/.ssh + echo "$SSH_CONFIG" > ~/.ssh/config + echo "$SSH_DEPLOYMENT_KEY" > ~/.ssh/id_ed25519 + chmod 600 ~/.ssh/id_ed25519 # deployment commands script: + - | - # install ansible roles dependancies - ssh $SSH_DEPLOYMENT_USER@$ANSIBLE_SERVER "sudo /usr/local/bin/ansible-galaxy install -r /etc/ansible/roles/requirements.yaml --force" + # install ansible roles dependancies + ssh $SSH_DEPLOYMENT_USER@$ANSIBLE_SERVER \ + "sudo /usr/local/bin/ansible-galaxy install -r /etc/ansible/roles/requirements.yaml --force" diff --git a/.gitlab/linting.yaml b/.gitlab/linting.yaml index 3c10990..5361ac6 100644 --- a/.gitlab/linting.yaml +++ b/.gitlab/linting.yaml @@ -1,10 +1,9 @@ --- # linting -linting: +ansible-lint: stage: "linting" - image: - name: "docker.io/pipelinecomponents/ansible-lint:0.79.0" + image: "docker.io/pipelinecomponents/ansible-lint:0.79.0" rules: # run only on push to default branch @@ -14,3 +13,18 @@ linting: # start linting script: - "ansible-lint -c .ansible-lint ." + +# yamllint +yamllint: + stage: "linting" + image: "registry.gitlab.com/pipeline-components/yamllint:0.35.0" + rules: + + # run only on push to default branch + - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' + - when: "never" + + script: + + # run yamllint + - "yamllint ."