From 03ba095b5324c2deddadedf4715f634095bc4fda Mon Sep 17 00:00:00 2001 From: Willem Elbers Date: Thu, 28 May 2026 10:39:26 +0200 Subject: [PATCH 1/3] Removed travis ci integration and added github actions integration (reviewed but based on gemini LLM output) --- .github/workflows/ci.yml | 78 +++++++++++++++++++++++++++++++++++++++ .travis.yml | 46 ----------------------- id_travis.enc | Bin 432 -> 0 bytes 3 files changed, 78 insertions(+), 46 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml delete mode 100644 id_travis.enc diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9677ae1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,78 @@ +name: CI Build + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + runs-on: ubuntu-20.04 + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11"] + + steps: + # Step 1: Check out the repository + - name: Checkout code + uses: actions/checkout@v4 + + # Step 2: Set up the specific Python version for the matrix job + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + # Step 3: Set up SSH Agent using GitHub Secrets (Replaces openssl decryption) + - name: Install SSH Key + uses: webfactory/ssh-agent@v0.9.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + + # Step 4: Run the rest of the 'before_install' phase + - name: Update submodules + run: | + git submodule update --init conf.d/users + + # Step 5: Install dependencies and build Docker image + - name: Install dependencies & Build + run: | + pip install -r requirements.txt + pip install pycodestyle + docker build --rm -f "Dockerfile" -t icinga2-cli "." + echo "const PluginDir = \"/usr/lib/nagios/plugins\"" > $(pwd)/constants.conf + echo "const ManubulonPluginDir = \"/usr/lib/nagios/plugins\"" >> $(pwd)/constants.conf + echo "const PluginContribDir = \"/usr/lib/nagios/plugins\"" >> $(pwd)/constants.conf + echo "const NodeName = \"clarin-monitoring\"" >> $(pwd)/constants.conf + echo "const ZoneName = \"clarin-monitoring\"" >> $(pwd)/constants.conf + mkdir -p $(pwd)/features-enabled + + # Step 6: Execute testing scripts + - name: Run Tests + run: | + find . -name "*.py" -exec pycodestyle {} \; + python3 update_config.py --nopull --nosubmodule + docker run --rm -v $(pwd):/etc/icinga2/ icinga2-cli + +# +#Disabled email notifications, for now rely on github CI notifications +# +# # Step 7: Send Email Notifications (Runs always, regardless of success/failure) +# - name: Send Email Notification +# if: always() +# uses: dawidd6/action-send-mail@v3 +# with: +# # You will need to set up an SMTP server secret for this to work +# server_address: ${{ secrets.SMTP_SERVER }} +# server_port: 465 +# username: ${{ secrets.SMTP_USERNAME }} +# password: ${{ secrets.SMTP_PASSWORD }} +# subject: GitHub Actions Run ${{ job.status }} - ${{ github.repository }} +# to: bernd.schloer@gwdg.de, sysops@clarin.eu +# from: GitHub Actions +# body: | +# The build status is: ${{ job.status }} +# Repository: ${{ github.repository }} +# Commit: ${{ github.sha }} +# View logs: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 042d595..0000000 --- a/.travis.yml +++ /dev/null @@ -1,46 +0,0 @@ -os: linux -dist: focal -language: python - -services: - - docker - -python: - - "3.8" - - "3.9" - - "3.10" - - "3.11" - -git: - submodules: false - -before_install: - - openssl aes-256-cbc -K $encrypted_bda0cbd6e861_key -iv $encrypted_bda0cbd6e861_iv -in id_travis.enc -out ~/.ssh/id_travis -d - - chmod 600 ~/.ssh/* - - eval "$(ssh-agent -s)" - - ssh-add ~/.ssh/id_travis - - git submodule update --init conf.d/users - -install: - - pip install -r requirements.txt - - pip install pycodestyle - - docker build --rm -f "Dockerfile" -t icinga2-cli "." - - echo "const PluginDir = \"/usr/lib/nagios/plugins\"" > $(pwd)/constants.conf - - echo "const ManubulonPluginDir = \"/usr/lib/nagios/plugins\"" >> $(pwd)/constants.conf - - echo "const PluginContribDir = \"/usr/lib/nagios/plugins\"" >> $(pwd)/constants.conf - - echo "const NodeName = \"clarin-monitoring\"" >> $(pwd)/constants.conf - - echo "const ZoneName = \"clarin-monitoring\"" >> $(pwd)/constants.conf - - mkdir $(pwd)/features-enabled - -script: - - find . -name "*.py" -exec pycodestyle {} \; - - python3 update_config.py --nopull --nosubmodule - - docker run --rm -v $(pwd):/etc/icinga2/ icinga2-cli - -notifications: - email: - recipients: - - bernd.schloer@gwdg.de - - sysops@clarin.eu - on_success: always - on_failure: always diff --git a/id_travis.enc b/id_travis.enc deleted file mode 100644 index b537733e56e01e62931ee31be97edda3b5398e69..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 432 zcmV;h0Z;y*d8mOm={;Vqrd;jxM0+%YIMQ`FEJxZ}O>uWDVXnAC!W_!{*;utj<}b8Y z8hfi>-kM*S&f1O(S3Kb`7qB;-f~Du@O+D@6#WnbsZ#6j=fJB$6!-Qtvh z2#C4N8L)D64}Dx?mq0C}rNPYjakOy2O-l|v)wvc!uOV&^GHmAH(cXE-wECA8{}coqetQgo~w9emrkvthW|VchEQfLL^6@`UclsF z2eLf|L-UE~E2n9Pi_SSS6Ll**i@^cLKf!}*Tjqq6a@**T&610xEo#6<^7$4SZ_>@B zf_7pN`C`(mx>&)^E$1t9dPPqmZHftS#~DD7#CBc5vEJQ0A!catxC8EQrQ9-`iXXwk zj0KFsXdsL@00uOW_C3oEf4cl4LL5NipLy}%f~ANZ#W}xIeY%AWygy&%{P#K|ugR0p az<72?ys%9x3iLHI-^-WiSx}O4d69rHj^4Qd From 0aa14fa0840a929499ec5fdee9bc90cbef9416b5 Mon Sep 17 00:00:00 2001 From: Willem Elbers Date: Tue, 15 Sep 2026 09:12:03 +0200 Subject: [PATCH 2/3] Improvements to the github action --- .github/workflows/ci.yml | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9677ae1..044eb10 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,44 +14,40 @@ jobs: python-version: ["3.8", "3.9", "3.10", "3.11"] steps: - # Step 1: Check out the repository - name: Checkout code uses: actions/checkout@v4 + with: + submodules: true - # Step 2: Set up the specific Python version for the matrix job - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - # Step 3: Set up SSH Agent using GitHub Secrets (Replaces openssl decryption) + # Only load SSH key if the secret exists (avoids hard crash on unprivileged PRs) - name: Install SSH Key + if: env.SSH_KEY != '' uses: webfactory/ssh-agent@v0.9.0 + env: + SSH_KEY: ${{ secrets.SSH_PRIVATE_KEY }} with: ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - # Step 4: Run the rest of the 'before_install' phase - - name: Update submodules - run: | - git submodule update --init conf.d/users - - # Step 5: Install dependencies and build Docker image - name: Install dependencies & Build run: | pip install -r requirements.txt pip install pycodestyle docker build --rm -f "Dockerfile" -t icinga2-cli "." - echo "const PluginDir = \"/usr/lib/nagios/plugins\"" > $(pwd)/constants.conf - echo "const ManubulonPluginDir = \"/usr/lib/nagios/plugins\"" >> $(pwd)/constants.conf - echo "const PluginContribDir = \"/usr/lib/nagios/plugins\"" >> $(pwd)/constants.conf - echo "const NodeName = \"clarin-monitoring\"" >> $(pwd)/constants.conf - echo "const ZoneName = \"clarin-monitoring\"" >> $(pwd)/constants.conf - mkdir -p $(pwd)/features-enabled + echo "const PluginDir = \"/usr/lib/nagios/plugins\"" > constants.conf + echo "const ManubulonPluginDir = \"/usr/lib/nagios/plugins\"" >> constants.conf + echo "const PluginContribDir = \"/usr/lib/nagios/plugins\"" >> constants.conf + echo "const NodeName = \"clarin-monitoring\"" >> constants.conf + echo "const ZoneName = \"clarin-monitoring\"" >> constants.conf + mkdir -p features-enabled - # Step 6: Execute testing scripts - name: Run Tests run: | - find . -name "*.py" -exec pycodestyle {} \; + find . -name "*.py" -exec pycodestyle {} + python3 update_config.py --nopull --nosubmodule docker run --rm -v $(pwd):/etc/icinga2/ icinga2-cli From 8411b937fe3682b810a0b3d48921dd1f36b4ad90 Mon Sep 17 00:00:00 2001 From: Willem Elbers Date: Tue, 15 Sep 2026 09:24:14 +0200 Subject: [PATCH 3/3] Updated to ubuntu-22.04 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 044eb10..2a85e23 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ on: jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: matrix: python-version: ["3.8", "3.9", "3.10", "3.11"]