⚡ add check version script using framagit's api
This commit is contained in:
parent
643b638206
commit
80eefdfb61
74
.gitignore
vendored
Normal file
74
.gitignore
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
# Created by .ignore support plugin (hsz.mobi)
|
||||
### JetBrains template
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
|
||||
# Generated files
|
||||
.idea/**/contentModel.xml
|
||||
|
||||
# Sensitive or high-churn files
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
|
||||
# Gradle
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# Gradle and Maven with auto-import
|
||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||
# since they will be recreated, and may cause churn. Uncomment if using
|
||||
# auto-import.
|
||||
# .idea/artifacts
|
||||
# .idea/compiler.xml
|
||||
# .idea/jarRepositories.xml
|
||||
# .idea/modules.xml
|
||||
# .idea/*.iml
|
||||
# .idea/modules
|
||||
# *.iml
|
||||
# *.ipr
|
||||
|
||||
# CMake
|
||||
cmake-build-*/
|
||||
|
||||
# Mongo Explorer plugin
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
# File-based project format
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Editor-based Rest Client
|
||||
.idea/httpRequests
|
||||
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
|
39
monitoring/check_version.sh
Normal file
39
monitoring/check_version.sh
Normal file
@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Nagios plugin to check mobilizon's version
|
||||
#
|
||||
|
||||
# program return value
|
||||
# 0 : OK
|
||||
# 1 : CRITICAL
|
||||
# 2 : WARNING new version available
|
||||
# 3 : UNKNOWN github or local repo not probable
|
||||
|
||||
# project api for gitlab https://docs.gitlab.com/ee/api/tags.html
|
||||
# upgrade documentation https://docs.joinmobilizon.org/administration/upgrading/
|
||||
LOCAL_REPO=/srv/mobilizon.chapril.org/live
|
||||
FRAMAGIT_PROJECT_ID=20125
|
||||
|
||||
|
||||
function usage() {
|
||||
echo "Usage : $0"
|
||||
}
|
||||
|
||||
#
|
||||
if [ "$#" -ne 0 ]; then
|
||||
usage
|
||||
else
|
||||
lastVersion=$(curl -s https://framagit.org/api/v4/projects/$FRAMAGIT_PROJECT_ID/releases | jshon -a -e name|cut -d '"' -f2|grep -v '[\^\(alpha\)]'|head -n 1)
|
||||
currentVersion=$(cd $LOCAL_REPO && git branch | grep '*'|cut -c 11-100 )
|
||||
|
||||
echo "current version: $currentVersion"
|
||||
echo "last version: $lastVersion"
|
||||
if [ $currentVersion = $lastVersion ]; then
|
||||
echo "OK"
|
||||
result=0
|
||||
else
|
||||
echo "WARNING : new version available, current is $currentVersion, last is $lastVersion."
|
||||
result=1
|
||||
fi
|
||||
fi
|
||||
exit $result
|
Loading…
Reference in New Issue
Block a user