Skip to content

Commit

Permalink
! replace linting by separated docker and script with explicit versions
Browse files Browse the repository at this point in the history
  • Loading branch information
langchr86 committed Mar 19, 2024
1 parent 1950650 commit 577853f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 33 deletions.
25 changes: 5 additions & 20 deletions .github/workflows/ansible_lint.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,13 @@
name: ansible_lint
name: ansible-lint

on: [push, pull_request]

jobs:
ansible_lint:
runs-on: ubuntu-20.04
ansible-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: System information
run: |
uname -a
lsb_release -a
sudo docker --version
- name: Prepare and run container
run: |
sudo ./testing/1_create.sh linter
sudo ./testing/2_run.sh linter
- uses: actions/checkout@v3

- name: Lint ansible
run: |
sudo docker exec test-container /etc/ansible/roles/git-tools/testing/lint.sh
- name: Cleanup
run: |
sudo ./testing/5_remove.sh
sudo linting/lint.sh
13 changes: 6 additions & 7 deletions testing/Dockerfile.linter → linting/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM ubuntu:20.04
# ubuntu:22.04
FROM ubuntu@sha256:2fdb1cf4995abb74c035e5f520c0f3a46f12b3377a59e86ecca66d8606ad64f9

# make dpkg noninteractive
ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true
Expand All @@ -8,14 +9,12 @@ RUN apt-get update \
software-properties-common \
git \
python3-pip \
&& apt-get clean \
&& apt-get autoclean \
&& apt-get autoremove \
&& rm -rf /var/lib/apt/lists/*

RUN pip3 install \
ansible \
ansible-lint \
yamllint
ansible_lint==6.14.0 \
passlib \
yamllint==1.32.0

ENTRYPOINT ["/bin/systemd"]
WORKDIR /ansible
13 changes: 13 additions & 0 deletions linting/lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#! /bin/bash -e

SCRIPT_DIR="$( cd "$(dirname "$0")" ; pwd -P )"
cd ${SCRIPT_DIR}

docker build --rm --tag=ansible-lint .

docker run \
--rm \
-v ${SCRIPT_DIR}/../testing:/testing:ro \
ansible-lint \
ansible-lint --exclude /root/.cache \
/testing/playbook.yml
6 changes: 0 additions & 6 deletions testing/lint.sh

This file was deleted.

0 comments on commit 577853f

Please sign in to comment.