From 61a07a3715158b37f95064093a8a8dc83d591bd5 Mon Sep 17 00:00:00 2001 From: shaver007 Date: Tue, 18 Nov 2025 18:40:47 +0200 Subject: [PATCH 1/4] Create docker-image.yml --- .github/workflows/docker-image.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 00000000..3f53646d --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,18 @@ +name: Docker Image CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Build the Docker image + run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) From 6a01db273f2dad28a14eeec79dcf2035e77256a8 Mon Sep 17 00:00:00 2001 From: shaver007 Date: Tue, 18 Nov 2025 22:39:35 +0200 Subject: [PATCH 2/4] Create pylint.yml --- .github/workflows/pylint.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/pylint.yml diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml new file mode 100644 index 00000000..c73e032c --- /dev/null +++ b/.github/workflows/pylint.yml @@ -0,0 +1,23 @@ +name: Pylint + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pylint + - name: Analysing the code with pylint + run: | + pylint $(git ls-files '*.py') From 6c6452057d56cec4f2bb39d6a87eefb6a5d6ebdb Mon Sep 17 00:00:00 2001 From: shaver007 Date: Wed, 3 Dec 2025 22:32:54 +0200 Subject: [PATCH 3/4] ci:change workflow trigger on pull requests only --- .github/workflows/docker-image.yml | 18 ------ .github/workflows/learn-github-actions.yml | 13 ----- .../workflows/workflow-on-specific-files.yaml | 55 +++++++++++++++++++ 3 files changed, 55 insertions(+), 31 deletions(-) delete mode 100644 .github/workflows/docker-image.yml delete mode 100644 .github/workflows/learn-github-actions.yml create mode 100644 .github/workflows/workflow-on-specific-files.yaml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml deleted file mode 100644 index 3f53646d..00000000 --- a/.github/workflows/docker-image.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Docker Image CI - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Build the Docker image - run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) diff --git a/.github/workflows/learn-github-actions.yml b/.github/workflows/learn-github-actions.yml deleted file mode 100644 index fa42c6d2..00000000 --- a/.github/workflows/learn-github-actions.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: learn-github-actions -run-name: ${{ github.actor }} is learning GitHub Actions -on: [push] -jobs: - check-bats-version: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v5 - - uses: actions/setup-node@v4 - with: - node-version: '20' - - run: npm install -g bats - - run: bats -v \ No newline at end of file diff --git a/.github/workflows/workflow-on-specific-files.yaml b/.github/workflows/workflow-on-specific-files.yaml new file mode 100644 index 00000000..a9f000db --- /dev/null +++ b/.github/workflows/workflow-on-specific-files.yaml @@ -0,0 +1,55 @@ +name: Lint (Python, Ansible, Docker, Kubernetes) + +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Python linting (flake8) + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install Python linters + run: | + pip install flake8 + + - name: Run flake8 + run: flake8 . + + # Ansible linting + - name: Install ansible-lint + run: | + pip install ansible ansible-lint + + - name: Run ansible-lint + run: ansible-lint . + + # Dockerfile linting (hadolint) + - name: Install hadolint + run: | + sudo wget -qO /usr/local/bin/hadolint https://github.com/hadolint/hadolint/releases/latest/download/hadolint-Linux-x86_64 + sudo chmod +x /usr/local/bin/hadolint + + - name: Run hadolint + run: | + find . -type f -iname "Dockerfile*" -exec hadolint {} \; || true + + # Kubernetes manifest linting (kubeval) + - name: Install kubeval + run: | + wget -q https://github.com/instrumenta/kubeval/releases/latest/download/kubeval-linux-amd64.tar.gz + tar xf kubeval-linux-amd64.tar.gz + sudo mv kubeval /usr/local/bin/ + + - name: Run kubeval + run: | + find k8s -name "*.yaml" -o -name "*.yml" -exec kubeval {} \; || true From 6f403aa9700c53fafec79b425919fde3b8d33263 Mon Sep 17 00:00:00 2001 From: shaver007 Date: Wed, 3 Dec 2025 22:53:08 +0200 Subject: [PATCH 4/4] ci:remove separate pylint workflow --- .github/workflows/pylint.yml | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 .github/workflows/pylint.yml diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml deleted file mode 100644 index c73e032c..00000000 --- a/.github/workflows/pylint.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Pylint - -on: [push] - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.8", "3.9", "3.10"] - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pylint - - name: Analysing the code with pylint - run: | - pylint $(git ls-files '*.py')