-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from ARGOeu-Metrics/devel
Version 0.9.0
- Loading branch information
Showing
5 changed files
with
190 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
pipeline { | ||
agent any | ||
options { | ||
checkoutToSubdirectory('argo-probe-perun') | ||
} | ||
environment { | ||
PROJECT_DIR="argo-probe-perun" | ||
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 Rocky 9'){ | ||
agent { | ||
docker { | ||
image 'argo.registry:5000/epel-9-ams' | ||
alwaysPull true | ||
args '-u jenkins:jenkins' | ||
} | ||
} | ||
stages { | ||
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 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
post { | ||
always { | ||
cleanWs() | ||
} | ||
success { | ||
script{ | ||
if ( env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'devel' ) { | ||
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 <$BUILD_URL|$PROJECT_DIR>:$BRANCH_NAME Job: $JOB_NAME") | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
PKGNAME=argo-probe-perun | ||
SPECFILE=${PKGNAME}.spec | ||
FILES=Makefile ${SPECFILE} src/* | ||
|
||
PKGVERSION=$(shell grep -s '^Version:' $(SPECFILE) | sed -e 's/Version: *//') | ||
|
||
dist: | ||
rm -rf dist | ||
mkdir -p dist/${PKGNAME}-${PKGVERSION} | ||
cp -pr ${FILES} dist/${PKGNAME}-${PKGVERSION}/. | ||
cd dist ; tar cfz ../${PKGNAME}-${PKGVERSION}.tar.gz ${PKGNAME}-${PKGVERSION} | ||
rm -rf dist | ||
|
||
sources: dist | ||
|
||
clean: | ||
rm -rf ${PKGNAME}-${PKGVERSION}.tar.gz | ||
rm -rf dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,12 @@ | ||
# argo-probe-perun | ||
# argo-probe-perun | ||
|
||
The simple probe that checks if Perun service is up and running. It takes three required arguments: hostname, certificate file and certificate key file. | ||
|
||
## Usage | ||
|
||
Example execution of the probe: | ||
|
||
``` | ||
$ /usr/libexec/argo/probes/perun/check_perun -H "perun.egi.eu" -C /etc/nagios/globus/robotcert.pem -K /etc/nagios/globus/robotkey.pem | ||
OK - Version of PerunDB: 3.2.20 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
%define dir /usr/libexec/argo/probes/perun | ||
|
||
Summary: ARGO probe for EGI Perun service | ||
Name: argo-probe-perun | ||
Version: 0.9.0 | ||
Release: 1%{?dist} | ||
License: ASL 2.0 | ||
Group: Network/Monitoring | ||
Source0: %{name}-%{version}.tar.gz | ||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root | ||
BuildArch: noarch | ||
|
||
|
||
%description | ||
Package contains probe check_perun that checks Perun service | ||
|
||
|
||
%prep | ||
%setup -q | ||
|
||
|
||
%install | ||
rm -rf $RPM_BUILD_ROOT | ||
install --directory ${RPM_BUILD_ROOT}%{dir} | ||
install --mode 755 ./check_perun ${RPM_BUILD_ROOT}%{dir} | ||
|
||
|
||
%clean | ||
rm -rf $RPM_BUILD_ROOT | ||
|
||
|
||
%files | ||
%defattr(-,root,root,-) | ||
%{dir} | ||
|
||
|
||
%changelog | ||
* Thu Jun 27 2024 Katarina Zailac <kzailac@srce.hr> - 0.9.0-1%{?dist} | ||
- AO-977 Move check_perun probe to separate package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/bin/sh | ||
|
||
########################################################################## | ||
# 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. | ||
########################################################################## | ||
|
||
usage() | ||
{ | ||
printf "Usage: %s -H <hostname> -C <cert_path> -K <key_path> \n" $(basename $0) >&2 | ||
printf " [-H] - hostname\n" >&2 | ||
printf " [-C] - path to certificate file\n" >&2 | ||
printf " [-K] - path to certificate key file\n" >&2 | ||
exit 2 | ||
} | ||
|
||
if [[ $# == 0 ]] | ||
then | ||
usage | ||
fi | ||
|
||
while getopts 'H:C:K:h' OPTION | ||
do | ||
case $OPTION in | ||
H) HOSTNAME=$OPTARG | ||
;; | ||
C) CERT_PATH=$OPTARG | ||
;; | ||
K) KEY_PATH=$OPTARG | ||
;; | ||
h) usage | ||
;; | ||
?) usage | ||
;; | ||
esac | ||
done | ||
|
||
|
||
# Variables | ||
CURL=/usr/bin/curl | ||
PERUN_URL_BASE="https://"$HOSTNAME"/cert/rpc/" | ||
|
||
# Query Perun RPC | ||
RET=`$CURL -s -4 -u nobody:nopass --cert $CERT_PATH --key $KEY_PATH ${PERUN_URL_BASE}json/utils/getPerunStatus` | ||
|
||
# Get PerunDB version | ||
VERSION=$(echo $RET | sed 's/.*"Version of PerunDB: \([^"]*\).*/\1/') | ||
|
||
# Evaluate the result | ||
if [ $(echo $VERSION | grep -E "^[[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*$" | wc -l) -eq 1 ]; then | ||
echo "OK - Version of PerunDB: $VERSION" | ||
exit 0 | ||
else | ||
echo "CRITICAL - Returned: $RET" | ||
exit 2 | ||
fi | ||
|