From ec7b3b61ec6004272c637e6c12dbcd281e5a397c Mon Sep 17 00:00:00 2001 From: Harri Hirvonsalo Date: Wed, 5 Dec 2018 11:55:53 +0200 Subject: [PATCH 01/14] packaging: correct license and add requirements to specfile * add requirements to RPM specfile * correct the license from GPLv3 to Apache License Signed-off-by: Harri Hirvonsalo --- nagios-plugins-eudat-b2share.spec | 48 ++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/nagios-plugins-eudat-b2share.spec b/nagios-plugins-eudat-b2share.spec index f80630a..2964a3b 100644 --- a/nagios-plugins-eudat-b2share.spec +++ b/nagios-plugins-eudat-b2share.spec @@ -1,39 +1,61 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + Name: nagios-plugins-eudat-b2share -Version: 0.5 +Version: 0.1 Release: 1%{?dist} -Summary: Nagios probe for B2SHARE -License: GPLv3+ -Packager: Themis Zamani +Summary: Nagios B2SHARE probe +License: Apache License, Version 2.0 +Packager: Themis Zamani Source: %{name}-%{version}.tar.gz BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version} + AutoReqProv: no +Requires: python +Requires: python-argparse +Requires: python-requests +Requires: python-jsonschema +Requires: python-validators + + %description -Nagios probe to check functionality of B2SHARE service +Nagios probe to check functionality of B2SHARE Service %prep %setup -q -%define _unpackaged_files_terminate_build 0 +%define _unpackaged_files_terminate_build 0 +%define probe_namespace eudat-b2share %install install -d %{buildroot}/%{_libexecdir}/argo-monitoring/probes/eudat-b2share -install -d %{buildroot}/%{_sysconfdir}/nagios/plugins/eudat-b2share install -m 755 check_b2share.py %{buildroot}/%{_libexecdir}/argo-monitoring/probes/eudat-b2share/check_b2share.py %files %dir /%{_libexecdir}/argo-monitoring %dir /%{_libexecdir}/argo-monitoring/probes/ -%dir /%{_libexecdir}/argo-monitoring/probes/eudat-b2share +%dir /%{_libexecdir}/argo-monitoring/probes/%{probe_namespace} -%attr(0755,root,root) /%{_libexecdir}/argo-monitoring/probes//eudat-b2share/check_b2share.py +%attr(0755,root,root) /%{_libexecdir}/argo-monitoring/probes/%{probe_namespace}/check_b2share.py %changelog +* Wed Dec 05 2018 Harri Hirvonsalo - 0.1-1 +- Added requirements to specfile * Tue Nov 27 2018 Themis Zamani - 0.1-1 -- Initial version of the package. -* Tue Nov 27 2018 Harri Hirvonsalo - 0.1-1 -- Initial version of the package. - +- Initial version of the package. From f72f1548634cc58cf40c58ab516cc07d4ba06741 Mon Sep 17 00:00:00 2001 From: Harri Hirvonsalo Date: Mon, 2 Sep 2019 20:05:13 +0300 Subject: [PATCH 02/14] fix KeyError given for records with no files Signed-off-by: Harri Hirvonsalo --- check_b2share.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/check_b2share.py b/check_b2share.py index a1db093..78d83b3 100755 --- a/check_b2share.py +++ b/check_b2share.py @@ -150,10 +150,7 @@ def get_dict_from_url(url, verify_tls_cert=False, verbosity=False): rec_with_files_url = None for hit in search_results['hits']['hits']: # Check if there are files in the record - if len(hit['files']) > 0: - # NTS: Could throw KeyError if there is something - # seriously wrong or B2SHARE REST API responses have - # changed. + if len(hit.get('files', "")) > 0: rec_with_files_url = hit['links']['self'] break From 96cb801135e56ae10cafe8eca57995acbd839e77 Mon Sep 17 00:00:00 2001 From: Harri Hirvonsalo Date: Mon, 2 Sep 2019 19:59:44 +0300 Subject: [PATCH 03/14] add requirements.txt * add requirements.txt for easier setup Signed-off-by: Harri Hirvonsalo --- requirements.txt | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d79b77a --- /dev/null +++ b/requirements.txt @@ -0,0 +1,28 @@ +# +# This file is part of B2SHARE Nagios monitoring plugin. +# +# Copyright (C) 2018 Harri Hirvonsalo +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +attrs==19.1.0 # from jsonschema +certifi==2019.6.16 # from requests +chardet==3.0.4 # from requests +decorator==4.4.0 # from validators +idna==2.8 # from requests +jsonschema==3.0.2 +pyrsistent==0.15.4 # from jsonschema +requests==2.22.0 +six==1.12.0 # from validators, jsonschema +urllib3==1.25.3 # from requests +validators==0.14.0 From d7fe89d7972dbf2f677f6ff6f989b26d0436a8a4 Mon Sep 17 00:00:00 2001 From: Harri Hirvonsalo Date: Mon, 2 Sep 2019 20:47:14 +0300 Subject: [PATCH 04/14] packaging: update version to 0.1.1 Signed-off-by: Harri Hirvonsalo --- nagios-plugins-eudat-b2share.spec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nagios-plugins-eudat-b2share.spec b/nagios-plugins-eudat-b2share.spec index 2964a3b..e1c2972 100644 --- a/nagios-plugins-eudat-b2share.spec +++ b/nagios-plugins-eudat-b2share.spec @@ -14,7 +14,7 @@ # limitations under the License. Name: nagios-plugins-eudat-b2share -Version: 0.1 +Version: 0.1.1 Release: 1%{?dist} Summary: Nagios B2SHARE probe License: Apache License, Version 2.0 @@ -55,6 +55,8 @@ install -m 755 check_b2share.py %{buildroot}/%{_libexecdir}/argo-monitoring/prob %attr(0755,root,root) /%{_libexecdir}/argo-monitoring/probes/%{probe_namespace}/check_b2share.py %changelog +* Mon Sep 02 2019 Harri Hirvonsalo - 0.1.1-1 +- Improved error handling to address false positive alerts. * Wed Dec 05 2018 Harri Hirvonsalo - 0.1-1 - Added requirements to specfile * Tue Nov 27 2018 Themis Zamani - 0.1-1 From 4579f70ca84964be3d56c44b57a746485eb86e38 Mon Sep 17 00:00:00 2001 From: Giacomo Furlan Date: Fri, 5 Apr 2024 10:10:06 +0300 Subject: [PATCH 05/14] Update Python version and dependencies - Update to python 3.9 - Update dependencies - Add Dockerfile - Update documentation Co-authored-by: Harri Hirvonsalo --- Dockerfile | 16 +++++++++++ README.md | 46 ++++++++++++++++++++++++++----- check_b2share.py | 21 +++++++++++--- nagios-plugins-eudat-b2share.spec | 16 ++++++----- requirements.txt | 15 ++-------- 5 files changed, 84 insertions(+), 30 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..33a1a09 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM rockylinux:9 +# eudat-docker.artifactory.ci.csc.fi/ + +LABEL maintainer Giacomo Furlan +LABEL description="Image to test nagios plugin on eudat b2share instances." + +RUN dnf update -y && \ + dnf install -y python3.9 && \ + dnf install -y python3.9-pip + +WORKDIR /root + +ADD check_b2share.py check_b2share.py +ADD requirements.txt requirements.txt + +RUN pip3 install -r requirements.txt diff --git a/README.md b/README.md index 77bd053..684aeb7 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,21 @@ # B2SHARE Monitoring probe for ARGO ## Setting up environment -This probe has been written for Python 3 and tested with Python 3.5.2 -You may need to install (using e.g. `pip`) the following Python modules as +This probe has been written for Python 3 and tested with Python 3.9 +You may need to install (using e.g. `pip3`) the following Python modules as they do not come with original distribution: - requests - jsonschema -- validators -- enum (in case lower than Python 3.4) ## Overview -The B2SHARE probe for ARGO does the following interaction +The B2SHARE probe for ARGO does the following interaction with B2SHARE REST API: - Search for records - Fetch record's metadata from search results - Fetch record's metadata schema - Validate record's metadata agains record's metadata schema -- If a record with file is available, check that a file +- If a record with file is available, check that a file should be able to be downloaded (HTTP HEAD request) B2SHARE ARGO probe: @@ -27,6 +25,30 @@ B2SHARE ARGO probe: ## Pre-requisites: - None + +## Package dependences + +Python modules "requests" and "jsonschema" have the following dependencies: + +```python +requests==2.31.0 +├── certifi [required: >=2017.4.17, installed: 2024.2.2] +├── charset-normalizer [required: >=2,<4, installed: 3.3.2] +├── idna [required: >=2.5,<4, installed: 3.6] +└── urllib3 [required: >=1.21.1,<3, installed: 2.2.1] + + +jsonschema==4.21.1 +├── attrs [required: >=22.2.0, installed: 23.2.0] +├── jsonschema-specifications [required: >=2023.03.6, installed: 2023.12.1] +│ └── referencing [required: >=0.31.0, installed: 0.34.0] +│ ├── attrs [required: >=22.2.0, installed: 23.2.0] +│ └── rpds-py [required: >=0.7.0, installed: 0.18.0] +├── referencing [required: >=0.28.4, installed: 0.34.0] +│ ├── attrs [required: >=22.2.0, installed: 23.2.0] +│ └── rpds-py [required: >=0.7.0, installed: 0.18.0] +└── rpds-py [required: >=0.7.1, installed: 0.18.0] +``` ## How it works? ``` @@ -50,7 +72,7 @@ optional arguments: Example -`$ python check_b2share.py -u https://b2share.eudat.eu:443 -t 15 -vv` +`$ python3 check_b2share.py -u https://b2share.eudat.eu:443 -t 15 -vv` ``` TLS certificate verification: OFF @@ -70,6 +92,16 @@ Fetching first file of the bucket. --------------------------- OK, records, metadata schemas and files are accessible. ``` +# How to run the code in a conatiner + +In the root folder of the project, build the container: +```bash +docker build -t : . +``` +Then run the code in the container +```bash +docker run -it --rm : python3 check_b2share.py -u https://b2share.eudat.eu:443 -t 15 -vv +``` ## Credits This code is based on [EUDAT-B2ACCESS/b2access-probe](https://github.com/EUDAT-B2ACCESS/b2access-probe) diff --git a/check_b2share.py b/check_b2share.py index 78d83b3..b6a6bf6 100755 --- a/check_b2share.py +++ b/check_b2share.py @@ -24,9 +24,8 @@ import jsonschema import requests -import requests.packages.urllib3 -import validators -from requests.exceptions import HTTPError +from requests.models import PreparedRequest +from requests.exceptions import HTTPError, MissingSchema class Verbosity(IntEnum): @@ -64,6 +63,20 @@ def get_dict_from_url(url, verify_tls_cert=False, verbosity=False): return r.json() +def validate_url(url): + """Validate if a string is an url. + Based on https://stackoverflow.com/a/34266413 + (python-validators package was not available as rpm package in Rocky Linux 9) + """ + prepared_request = PreparedRequest() + try: + prepared_request.prepare_url(url, None) + if not prepared_request.url: + return False + except MissingSchema: + return False + return True + if __name__ == '__main__': parser = argparse.ArgumentParser(description='B2SHARE Nagios probe') @@ -101,7 +114,7 @@ def get_dict_from_url(url, verify_tls_cert=False, verbosity=False): verbosity = Verbosity(param.verbose) # Validate parameters - if not validators.url(param.url): + if not validate_url(param.url): raise SyntaxError( 'CRITICAL: Invalid URL syntax {0}'.format( param.url)) diff --git a/nagios-plugins-eudat-b2share.spec b/nagios-plugins-eudat-b2share.spec index e1c2972..668f576 100644 --- a/nagios-plugins-eudat-b2share.spec +++ b/nagios-plugins-eudat-b2share.spec @@ -14,7 +14,7 @@ # limitations under the License. Name: nagios-plugins-eudat-b2share -Version: 0.1.1 +Version: 0.2.1 Release: 1%{?dist} Summary: Nagios B2SHARE probe License: Apache License, Version 2.0 @@ -26,11 +26,9 @@ BuildRoot: %{_tmppath}/%{name}-%{version} AutoReqProv: no -Requires: python -Requires: python-argparse -Requires: python-requests -Requires: python-jsonschema -Requires: python-validators +Requires: python3 +Requires: python3-requests +Requires: python3-jsonschema %description @@ -40,7 +38,7 @@ Nagios probe to check functionality of B2SHARE Service %setup -q %define _unpackaged_files_terminate_build 0 -%define probe_namespace eudat-b2share +%define probe_namespace eudat-b2share %install @@ -55,6 +53,10 @@ install -m 755 check_b2share.py %{buildroot}/%{_libexecdir}/argo-monitoring/prob %attr(0755,root,root) /%{_libexecdir}/argo-monitoring/probes/%{probe_namespace}/check_b2share.py %changelog +* Fri Apr 05 2024 Giacomo Furlan - 0.2.1 +- Update python to 3.9 +- Update requirements and dependencies +- Remove validator dependency * Mon Sep 02 2019 Harri Hirvonsalo - 0.1.1-1 - Improved error handling to address false positive alerts. * Wed Dec 05 2018 Harri Hirvonsalo - 0.1-1 diff --git a/requirements.txt b/requirements.txt index d79b77a..7292564 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ # # This file is part of B2SHARE Nagios monitoring plugin. # -# Copyright (C) 2018 Harri Hirvonsalo +# Copyright (C) 2024 Harri Hirvonsalo # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,14 +15,5 @@ # See the License for the specific language governing permissions and # limitations under the License. -attrs==19.1.0 # from jsonschema -certifi==2019.6.16 # from requests -chardet==3.0.4 # from requests -decorator==4.4.0 # from validators -idna==2.8 # from requests -jsonschema==3.0.2 -pyrsistent==0.15.4 # from jsonschema -requests==2.22.0 -six==1.12.0 # from validators, jsonschema -urllib3==1.25.3 # from requests -validators==0.14.0 +jsonschema==4.21.1 +requests==2.31.0 From 00f75fab5847fdf6ca404269a24d48e628bd0344 Mon Sep 17 00:00:00 2001 From: Kostas Evangelou Date: Mon, 6 Apr 2020 17:44:51 +0300 Subject: [PATCH 06/14] DEVOPS-91 Add Jenkinsfile --- Jenkinsfile | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..d9926ec --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,70 @@ +pipeline { + agent any + options { + checkoutToSubdirectory('b2share-nagios-plugin') + } + environment { + PROJECT_DIR="b2share-nagios-plugin" + GIT_COMMIT=sh(script: "cd ${WORKSPACE}/$PROJECT_DIR && git log -1 --format=\"%H\"",returnStdout: true).trim() + GIT_COMMIT_HASH=sh(script: "cd ${WORKSPACE}/$PROJECT_DIR && git log -1 --format=\"%H\" | cut -c1-7",returnStdout: true).trim() + GIT_COMMIT_DATE=sh(script: "date -d \"\$(cd ${WORKSPACE}/$PROJECT_DIR && git show -s --format=%ci ${GIT_COMMIT_HASH})\" \"+%Y%m%d%H%M%S\"",returnStdout: true).trim() + + } + stages { + stage ('Build'){ + parallel { + stage ('Build Centos 6') { + agent { + docker { + image 'argo.registry:5000/epel-6-ams' + args '-u jenkins:jenkins' + } + } + steps { + echo 'Building Rpm...' + withCredentials(bindings: [sshUserPrivateKey(credentialsId: 'jenkins-rpm-repo', usernameVariable: 'REPOUSER', \ + keyFileVariable: 'REPOKEY')]) { + sh "/home/jenkins/build-rpm.sh -w ${WORKSPACE} -b ${BRANCH_NAME} -d centos6 -p ${PROJECT_DIR} -s ${REPOKEY}" + } + archiveArtifacts artifacts: '**/*.rpm', fingerprint: true + } + } + stage ('Build Centos 7') { + agent { + docker { + image 'argo.registry:5000/epel-7-ams' + args '-u jenkins:jenkins' + } + } + steps { + echo 'Building Rpm...' + withCredentials(bindings: [sshUserPrivateKey(credentialsId: 'jenkins-rpm-repo', usernameVariable: 'REPOUSER', \ + keyFileVariable: 'REPOKEY')]) { + sh "/home/jenkins/build-rpm.sh -w ${WORKSPACE} -b ${BRANCH_NAME} -d centos7 -p ${PROJECT_DIR} -s ${REPOKEY}" + } + archiveArtifacts artifacts: '**/*.rpm', fingerprint: true + } + } + } + } + } + post { + always { + cleanWs() + } + success { + script{ + if ( env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'devel' ) { + slackSend( message: ":rocket: New version for !") + } + } + } + failure { + script{ + if ( env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'devel' ) { + slackSend( message: ":rain_cloud: Build Failed for . Branch: $BRANCH_NAME Job: [$JOB_NAME]") + } + } + } + } +} \ No newline at end of file From ad71465371fe57782c6a3daa57d545507216de5f Mon Sep 17 00:00:00 2001 From: kevangel79 <58726215+kevangel79@users.noreply.github.com> Date: Tue, 7 Apr 2020 13:13:18 +0300 Subject: [PATCH 07/14] Update project name to match makefile --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d9926ec..7778bc9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,10 +1,10 @@ pipeline { agent any options { - checkoutToSubdirectory('b2share-nagios-plugin') + checkoutToSubdirectory('nagios-plugins-eudat-b2share') } environment { - PROJECT_DIR="b2share-nagios-plugin" + PROJECT_DIR="nagios-plugins-eudat-b2share" GIT_COMMIT=sh(script: "cd ${WORKSPACE}/$PROJECT_DIR && git log -1 --format=\"%H\"",returnStdout: true).trim() GIT_COMMIT_HASH=sh(script: "cd ${WORKSPACE}/$PROJECT_DIR && git log -1 --format=\"%H\" | cut -c1-7",returnStdout: true).trim() GIT_COMMIT_DATE=sh(script: "date -d \"\$(cd ${WORKSPACE}/$PROJECT_DIR && git show -s --format=%ci ${GIT_COMMIT_HASH})\" \"+%Y%m%d%H%M%S\"",returnStdout: true).trim() @@ -67,4 +67,4 @@ pipeline { } } } -} \ No newline at end of file +} From 86465798c34a4115e3562ba79de4a29303d5f853 Mon Sep 17 00:00:00 2001 From: kevangel79 <58726215+kevangel79@users.noreply.github.com> Date: Tue, 7 Apr 2020 17:26:15 +0300 Subject: [PATCH 08/14] Update Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7778bc9..260ff78 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -55,14 +55,14 @@ pipeline { success { script{ if ( env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'devel' ) { - slackSend( message: ":rocket: New version for !") + slackSend( message: ":rocket: New version for <$BUILD_URL|$PROJECT_DIR>:$BRANCH_NAME Job: $JOB_NAME !") } } } failure { script{ if ( env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'devel' ) { - slackSend( message: ":rain_cloud: Build Failed for . Branch: $BRANCH_NAME Job: [$JOB_NAME]") + slackSend( message: ":rain_cloud: Build Failed for <$BUILD_URL|$PROJECT_DIR>:$BRANCH_NAME Job: $JOB_NAME") } } } From 846c881f5534fc47075f765f98c6b47b715f500a Mon Sep 17 00:00:00 2001 From: Kostas Evangelou Date: Fri, 8 May 2020 16:55:51 +0300 Subject: [PATCH 09/14] Add cleanup workspace in each stage --- Jenkinsfile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 260ff78..a4114fb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -28,6 +28,11 @@ pipeline { } archiveArtifacts artifacts: '**/*.rpm', fingerprint: true } + post { + always { + cleanWs() + } + } } stage ('Build Centos 7') { agent { @@ -44,6 +49,11 @@ pipeline { } archiveArtifacts artifacts: '**/*.rpm', fingerprint: true } + post { + always { + cleanWs() + } + } } } } From 24526711a46c9009cb6a27d48f657d424e142e32 Mon Sep 17 00:00:00 2001 From: Themis Zamani Date: Thu, 27 Jun 2024 09:03:38 +0300 Subject: [PATCH 10/14] Update Jenkinsfile --- Jenkinsfile | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a4114fb..8b848e5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,10 +1,10 @@ pipeline { agent any options { - checkoutToSubdirectory('nagios-plugins-eudat-b2share') + checkoutToSubdirectory('argo-probe-eudat-b2share') } environment { - PROJECT_DIR="nagios-plugins-eudat-b2share" + PROJECT_DIR="argo-probe-eudat-b2share" GIT_COMMIT=sh(script: "cd ${WORKSPACE}/$PROJECT_DIR && git log -1 --format=\"%H\"",returnStdout: true).trim() GIT_COMMIT_HASH=sh(script: "cd ${WORKSPACE}/$PROJECT_DIR && git log -1 --format=\"%H\" | cut -c1-7",returnStdout: true).trim() GIT_COMMIT_DATE=sh(script: "date -d \"\$(cd ${WORKSPACE}/$PROJECT_DIR && git show -s --format=%ci ${GIT_COMMIT_HASH})\" \"+%Y%m%d%H%M%S\"",returnStdout: true).trim() @@ -13,27 +13,7 @@ pipeline { stages { stage ('Build'){ parallel { - stage ('Build Centos 6') { - agent { - docker { - image 'argo.registry:5000/epel-6-ams' - args '-u jenkins:jenkins' - } - } - steps { - echo 'Building Rpm...' - withCredentials(bindings: [sshUserPrivateKey(credentialsId: 'jenkins-rpm-repo', usernameVariable: 'REPOUSER', \ - keyFileVariable: 'REPOKEY')]) { - sh "/home/jenkins/build-rpm.sh -w ${WORKSPACE} -b ${BRANCH_NAME} -d centos6 -p ${PROJECT_DIR} -s ${REPOKEY}" - } - archiveArtifacts artifacts: '**/*.rpm', fingerprint: true - } - post { - always { - cleanWs() - } - } - } + stage ('Build Centos 7') { agent { docker { From 44eb4e8cf3cb0d841ae2ccf64aafc9c6053b1e1f Mon Sep 17 00:00:00 2001 From: Themis Zamani Date: Wed, 31 Jul 2024 09:01:01 +0300 Subject: [PATCH 11/14] Update Jenkinsfile --- Jenkinsfile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8b848e5..0e94321 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,7 +13,16 @@ pipeline { stages { stage ('Build'){ parallel { - + stage ('Build Rocky 9 RPM') { + steps { + echo 'Building Rocky 9 RPM...' + withCredentials(bindings: [sshUserPrivateKey(credentialsId: 'jenkins-rpm-repo', usernameVariable: 'REPOUSER', \ + keyFileVariable: 'REPOKEY')]) { + sh "/home/jenkins/build-rpm.sh -w ${WORKSPACE} -b ${BRANCH_NAME} -d rocky9 -p ${PROJECT_DIR} -s ${REPOKEY}" + } + archiveArtifacts artifacts: '**/*.rpm', fingerprint: true + } + } stage ('Build Centos 7') { agent { docker { From 34f7b58c607ce7f7b7abdd991524cd5770d5239b Mon Sep 17 00:00:00 2001 From: Themis Zamani Date: Wed, 31 Jul 2024 09:06:22 +0300 Subject: [PATCH 12/14] Create argo-probe-eudat-b2share --- argo-probe-eudat-b2share | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 argo-probe-eudat-b2share diff --git a/argo-probe-eudat-b2share b/argo-probe-eudat-b2share new file mode 100644 index 0000000..874b858 --- /dev/null +++ b/argo-probe-eudat-b2share @@ -0,0 +1,46 @@ +Name: argo-probe-eudat-b2share +Version: 0.6 +Release: 1%{?dist} +Summary: Monitoring scripts that check the functionalities of B2SHARE +License: GPLv3+ +Packager: Themis Zamani + +Source: %{name}-%{version}.tar.gz +BuildArch: noarch +BuildRoot: %{_tmppath}/%{name}-%{version} +AutoReqProv: no +Requires: python3 +Requires: python3-requests +Requires: python-jsonschema +Requires: python-enum34 + +%description +Nagios probe to check functionality of B2SHARE service + +%prep +%setup -q + +%define _unpackaged_files_terminate_build 0 + +%install +install -d %{buildroot}/%{_libexecdir}/argo/probes/eudat-b2share +install -m 755 check_b2share.py %{buildroot}/%{_libexecdir}/argo/probes/eudat-b2share/check_b2share.py + +%files +%dir /%{_libexecdir}/argo +%dir /%{_libexecdir}/argo/probes/ +%dir /%{_libexecdir}/argo/probes/eudat-b2share + +%attr(0755,root,root) /%{_libexecdir}/argo/probes/eudat-b2share/check_b2share.py + +%changelog +* Fri Apr 05 2024 Giacomo Furlan - 0.2.1 +- Update python to 3.9 +- Update requirements and dependencies +- Remove validator dependency +* Mon Mar 14 2022 Themis Zamani - 0.5 +- Update package prerequisites based on argo monitoring. +* Tue Nov 27 2018 Themis Zamani - 0.1-1 +- Initial version of the package. +* Tue Nov 27 2018 Harri Hirvonsalo - 0.1-1 +- Initial version of the package. From 3b726b033338f510c7764aa3c01ca1a6cb4ca7bc Mon Sep 17 00:00:00 2001 From: Themis Zamani Date: Wed, 31 Jul 2024 09:07:21 +0300 Subject: [PATCH 13/14] Update Makefile --- Makefile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 782c2a7..df2a0e4 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,9 @@ -PKGNAME=nagios-plugins-eudat-b2share +PKGNAME=argo-probe-eudat-b2share SPECFILE=${PKGNAME}.spec FILES=check_b2share.py ${SPECFILE} PKGVERSION=$(shell grep -s '^Version:' $(SPECFILE) | sed -e 's/Version:\s*//') -srpm: dist - rpmbuild -ts --define='dist .el6' ${PKGNAME}-${PKGVERSION}.tar.gz - rpm: dist rpmbuild -ta ${PKGNAME}-${PKGVERSION}.tar.gz @@ -22,4 +19,4 @@ sources: dist clean: rm -rf ${PKGNAME}-${PKGVERSION}.tar.gz - rm -rf dist \ No newline at end of file + rm -rf dist From 27e28e676f15e34ea6181f1fd0659bde7cfd2e3e Mon Sep 17 00:00:00 2001 From: Themis Zamani Date: Wed, 31 Jul 2024 09:08:54 +0300 Subject: [PATCH 14/14] Update argo-probe-eudat-b2share --- argo-probe-eudat-b2share | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/argo-probe-eudat-b2share b/argo-probe-eudat-b2share index 874b858..8f8329f 100644 --- a/argo-probe-eudat-b2share +++ b/argo-probe-eudat-b2share @@ -1,5 +1,5 @@ Name: argo-probe-eudat-b2share -Version: 0.6 +Version: 0.7 Release: 1%{?dist} Summary: Monitoring scripts that check the functionalities of B2SHARE License: GPLv3+