Skip to content

Commit

Permalink
Add a docker workflow
Browse files Browse the repository at this point in the history
- use a shared workflow for the release and development builds
- update base docker image to zabbix 7.2
- add docker build and release steps
- add reference to dockerhub

Signed-off-by: Marc Schöchlin <[email protected]>
  • Loading branch information
scoopex committed Dec 23, 2024
1 parent 67bde7e commit e93eca9
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 39 deletions.
20 changes: 4 additions & 16 deletions .github/workflows/continuous-integration-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,7 @@ on:
branches:
- '*'
jobs:
build:
name: CI
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup
run: |
sudo apt-get install ruby-dev build-essential debhelper devscripts rpm xalan wget -y
sudo gem install fpm
- name: Build Package
run: ./create_packages
- name: Test Package
run: sudo ./ci_test
CI_DEV:
uses: ./.github/workflows/shared.yml
with:
publish_steps: false
26 changes: 5 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,8 @@ on:
- '*'

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: refs/heads/main
- name: Setup
run: |
sudo apt-get install ruby-dev build-essential debhelper devscripts rpm xalan wget -y
sudo gem install fpm
- name: Build Package
run: ./create_packages
- name: Test Package
run: sudo ./ci_test
- uses: ncipollo/release-action@v1
with:
artifacts: "zabbix-agent-extensions*.deb,zabbix-agent-extensions-*.rpm"
CI_RELEASE:
uses: ./.github/workflows/shared.yml
with:
publish_steps: true

54 changes: 54 additions & 0 deletions .github/workflows/shared.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Shared Build Workflow

on:
workflow_call:
inputs:
publish_steps:
description: "Publish artefacts"
required: false
default: false
type: boolean

jobs:
build-pkg:
name: CI-PKGs
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup
run: |
sudo apt-get install ruby-dev build-essential debhelper devscripts rpm xalan wget -y
sudo gem install fpm
- name: Build Package
run: ./create_packages
- name: Test Package
run: sudo ./ci_test
- uses: ncipollo/release-action@v1
if: ${{ inputs.publish_steps }}
with:
artifacts: "zabbix-agent-extensions*.deb,zabbix-agent-extensions-*.rpm"
build-docker:
name: CI-Docker
runs-on: ubuntu-latest
environment: "Docker Upload"
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Login to Docker Hub
if: ${{ inputs.publish_steps }}
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build
run: |
./create_docker build
- name: Publish docker images
if: ${{ inputs.publish_steps }}
run: |
./create_docker publish
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FROM zabbix/zabbix-agent:ubuntu-6.4-latest
MAINTAINER [email protected]
FROM zabbix/zabbix-agent:ubuntu-7.2-latest

USER 0
ADD /docker-scripts /tmp/setup
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@ zabbix-agent-extensions
=======================

[![Build package and test](https://github.com/scoopex/zabbix-agent-extensions/actions/workflows/continuous-integration-workflow.yml/badge.svg)](https://github.com/scoopex/zabbix-agent-extensions/actions/workflows/continuous-integration-workflow.yml)
* Releases:
[![Releases](https://github.com/scoopex/zabbix-agent-extensions/actions/workflows/release.yml/badge.svg)](https://github.com/scoopex/zabbix-agent-extensions/actions/workflows/release.yml)

[Docker Images](https://hub.docker.com/repository/docker/scoopex666/zabbix-agent-with-agent-extensions/general)
```
docker run scoopex666/zabbix-agent-with-agent-extensions
```

# Overview

A set of zabbix UserParameter scripts and production ready monitoring templates for linux systems.
Expand Down Expand Up @@ -134,6 +140,20 @@ This procedure deploy zabbix agents on all worker nodes of your kubernetes clust
kubectl logs -n infra-zabbix-agent zabbix-agent-8n4ss -f
```
Test docker image
---------------------------------------------
```
docker run scoopex666/zabbix-agent-with-agent-extensions
docker run -d --rm \
-e ZBX_ACTIVESERVER=127.0.0.1 \
-e ZBX_PASSIVESERVERS=127.0.0.1 \
--name zabbix-agent-extentions-test \
scoopex666/zabbix-agent-with-agent-extensions
docker exec -ti zabbix-agent-extentions-test zabbix_get -s 127.0.0.1 -k zabbix.agent_extensions.version
docker stop zabbix-agent-extentions-test
```
How to configure the zabbix server/templates
--------------------------------------------
Expand Down

0 comments on commit e93eca9

Please sign in to comment.