Skip to content

Commit

Permalink
Merge pull request #62 from telefonicaid/hardening/packages
Browse files Browse the repository at this point in the history
Add automatic changelog generation in packaging
  • Loading branch information
jframos committed Nov 30, 2015
2 parents f98d8bc + 3a2c381 commit 9f78a39
Show file tree
Hide file tree
Showing 16 changed files with 469 additions and 318 deletions.
114 changes: 0 additions & 114 deletions .bumpversion.sh

This file was deleted.

9 changes: 9 additions & 0 deletions ngsi_adapter/.bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[bumpversion]
current_version = 1.3.0
commit = True
tag = False

[bumpversion:file:package.json]
search = "version": "{current_version}"
replace = "version": "{new_version}"

45 changes: 3 additions & 42 deletions ngsi_adapter/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,49 +22,10 @@ Please refer to `this document </README.rst#running>`_ for details.
Changelog
=========

Version 1.3.0
Please refer to `FIWARE Monitoring releases changelog`__.

- Add option to set maximum number of simultaneous outgoing requests
- Add an option to specify a list of directories to look for parsers
- Add support to UDP requests

Version 1.2.4

- Add service configuration file

Version 1.2.3

- Fix problems when uninstalling package

Version 1.2.2

- Add .rpm package generation
- Minor bugs resolved

Version 1.2.1

- Minor bugs resolved

Version 1.2.0

- Add new log format (issue #25)

Version 1.1.1

- Add .deb package generation (issue #16)

Version 1.1.0

- Add timestamp to entity attributes (issue #4)

Version 1.0.1

- NGSI9 and NGSI10 decoupled in update requests by using append action
- Bugfixing: solved errors in update requests

Version 1.0.0

- Only Nagios probes (plugins) are supported
__ `changelog`_
.. _changelog: https://github.com/telefonicaid/fiware-monitoring/releases


License
Expand Down
4 changes: 4 additions & 0 deletions ngsi_adapter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
"type": "git",
"url": "https://github.com/telefonicaid/fiware-monitoring.git"
},
"artifacts": {
"url": "http://repositories.testbed.fiware.org/repo"
},
"readmeFilename": "README.rst",
"main": "lib/adapter.js",
"scripts": {
"start": "adapter",
Expand Down
20 changes: 10 additions & 10 deletions ngsi_adapter/tools/build/files/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
fiware-monitoring-ngsi-adapter (1.3.0) precise; urgency=low
fiware-monitoring-ngsi-adapter (1.3.0-1) precise; urgency=low
* Add option to set maximum number of simultaneous outgoing requests
* Add an option to specify a list of directories to look for parsers
* Add support to UDP requests

-- Telefónica I+D <opensource@tid.es> Tue, 24 Nov 2015 18:00:00 +0200

fiware-monitoring-ngsi-adapter (1.2.4) precise; urgency=low
fiware-monitoring-ngsi-adapter (1.2.4-1) precise; urgency=low

* Add service configuration file

-- Telefónica I+D <opensource@tid.es> Fri, 14 Aug 2015 15:00:00 +0200

fiware-monitoring-ngsi-adapter (1.2.3) precise; urgency=low
fiware-monitoring-ngsi-adapter (1.2.3-1) precise; urgency=low

* Fix problems when uninstalling package

-- Telefónica I+D <opensource@tid.es> Fri, 27 Mar 2015 15:00:00 +0200

fiware-monitoring-ngsi-adapter (1.2.2) precise; urgency=low
fiware-monitoring-ngsi-adapter (1.2.2-1) precise; urgency=low

* Add .rpm package generation
* Minor bugs resolved

-- Telefónica I+D <opensource@tid.es> Fri, 27 Feb 2015 15:00:00 +0200

fiware-monitoring-ngsi-adapter (1.2.1) precise; urgency=low
fiware-monitoring-ngsi-adapter (1.2.1-1) precise; urgency=low

* Minor bugs resolved

-- Telefónica I+D <opensource@tid.es> Fri, 30 Jan 2015 15:00:00 +0200

fiware-monitoring-ngsi-adapter (1.2.0) precise; urgency=low
fiware-monitoring-ngsi-adapter (1.2.0-1) precise; urgency=low

* Included new log format (issue #25)

-- Telefónica I+D <opensource@tid.es> Tue, 28 Oct 2014 11:45:00 +0200

fiware-monitoring-ngsi-adapter (1.1.1) precise; urgency=low
fiware-monitoring-ngsi-adapter (1.1.1-1) precise; urgency=low

* Included Debian package generation (issue #16)

-- Telefónica I+D <opensource@tid.es> Thu, 28 Aug 2014 15:00:00 +0200

fiware-monitoring-ngsi-adapter (1.1.0) precise; urgency=low
fiware-monitoring-ngsi-adapter (1.1.0-1) precise; urgency=low

* Added timestamp to entity attributes (issue #4)

-- Telefónica I+D <opensource@tid.es> Mon, 14 Jul 2014 10:00:00 +0200

fiware-monitoring-ngsi-adapter (1.0.1) precise; urgency=low
fiware-monitoring-ngsi-adapter (1.0.1-1) precise; urgency=low

* NGSI9 and NGSI10 decoupled in update requests by using append action
* Bugfixing: solved errors in update requests

-- Telefónica I+D <opensource@tid.es> Wed, 05 Feb 2014 19:41:35 +0200

fiware-monitoring-ngsi-adapter (1.0.0) precise; urgency=low
fiware-monitoring-ngsi-adapter (1.0.0-1) precise; urgency=low

* Initial release of the adapter

Expand Down
2 changes: 1 addition & 1 deletion ngsi_adapter/tools/build/files/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ DH_ADAPTER_USR:=$(DH_FIWARE_USR)
DH_ADAPTER_GRP:=$(DH_FIWARE_GRP)
DH_ADAPTER_DIR:=$(DH_FIWARE_DIR)/$(DH_ADAPTER_SRV)
DH_LOGGING_DIR:=/var/log/$(DH_ADAPTER_SRV)
DH_NODE_REQ_VERSION:=$(shell awk '/"node":/ {split($$0,v,/["~=<>]/); print v[6]}' src/package.json)
DH_NODE_REQ_VERSION:=$(shell awk '/"node":/ {split($$0,v,/["~=<>]/); print v[6]}' package.json)

# Function to substitute variable $(1) in file $(2)
dh_var_subst = $(shell sed -i 's:\#$(1)\#:$(value $(1)):' $(2))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ Summary: Adapter to transform data from monitoring probes to NGSI context attrib
URL: https://github.com/telefonicaid/fiware-monitoring/tree/master/ngsi_adapter
Name: %{_name}
Version: %{_version}
Release: %{_release}
Release: %{_release}%{?dist}
License: Apache
Group: Applications/Engineering
Vendor: Telefónica I+D
Packager: Telefónica I+D <opensource@tid.es>
BuildArch: noarch
# Requires: nodejs (see %pre)

Expand All @@ -37,7 +38,7 @@ rm -rf $RPM_BUILD_ROOT

%install
mkdir -p $RPM_BUILD_ROOT/%{_adapter_dir}; set +x
INCLUDE='lib|config|package.json|LICENSE|README.*|adapter$'
INCLUDE='lib|config|package.json|.npmrc|LICENSE|README.*|adapter$'
PATTERN='* .npmrc'
FILES=$(cd %{_basedir}; for i in $PATTERN; do echo $i; done | egrep "$INCLUDE")
for I in $FILES; do cp -R %{_basedir}/$I $RPM_BUILD_ROOT/%{_adapter_dir}; done
Expand Down
36 changes: 21 additions & 15 deletions ngsi_adapter/tools/build/jenkins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@
#

OPTS='h(help)'
NAME=$(basename $0)
PROG=$(basename $0)

# Command line options
ACTION=

# Process command line
# Command line processing
OPTERR=
OPTSTR=$(echo :-:$OPTS | sed 's/([a-zA-Z0-9]*)//g')
OPTHLP=$(sed -n '20,/^$/ { s/$0/'$NAME'/; s/^#[ ]\?//p }' $0)
OPTHLP=$(sed -n '20,/^$/ { s/$0/'$PROG'/; s/^#[ ]\?//p }' $0)
while getopts $OPTSTR OPT; do while [ -z "$OPTERR" ]; do
case $OPT in
'h') OPTERR="$OPTHLP";;
Expand All @@ -66,10 +66,13 @@ ACTION=$(expr "$1" : "^\(build\|package\)$") && shift
[ -z "$OPTERR" -a -z "$ACTION" ] && OPTERR="Valid action required as argument"
[ -z "$OPTERR" -a -n "$*" ] && OPTERR="Too many arguments"
[ -n "$OPTERR" ] && {
[ "$OPTERR" != "$OPTHLP" ] && OPTERR="${OPTERR}\nTry \`$NAME --help'"
TAB=4; LEN=$(echo "$OPTERR" | awk -F'\t' '/ .+\t/ {print $1}' | wc -L)
TABSTOPS=$TAB,$(((2+LEN/TAB)*TAB)); WIDTH=${COLUMNS:-$(tput cols)}
printf "$OPTERR" | tr -s '\t' | expand -t$TABSTOPS | fmt -$WIDTH -s 1>&2
PREAMBLE=$(printf "$OPTHLP" | sed -n '0,/^Usage:/ p' | head -n -1)
USAGE="Usage:\n"$(printf "$OPTHLP" | sed '0,/^Usage:/ d')"\n\n"
TAB=4; LEN=$(echo "$USAGE" | awk -F'\t' '/ .+\t/ {print $1}' | wc -L)
TABSTOPS=$TAB,$(((LEN/TAB+1)*TAB)); WIDTH=${COLUMNS:-$(tput cols)}
[ "$OPTERR" != "$OPTHLP" ] && PREAMBLE="ERROR: $OPTERR"
printf "$PREAMBLE\n\n" | fmt -$WIDTH 1>&2
printf "$USAGE" | tr -s '\t' | expand -t$TABSTOPS | fmt -$WIDTH -s 1>&2
exit 1
}

Expand All @@ -88,13 +91,14 @@ TEST_REPORT_DIR=$PROJECT_DIR/report/test
COVERAGE_REPORT_DIR=$PROJECT_DIR/report/coverage

# Properties
PRODUCT_INFO=$(awk '/"product"/,/\}/' $PROJECT_DIR/package.json)
CFGFILE=$PROJECT_DIR/package.json
PRODUCT_INFO=$(awk '/"product"/,/\}/' $CFGFILE)
PRODUCT_AREA=$(echo "$PRODUCT_INFO" | sed -n '/"area"/ {s/.*:.*"\(.*\)".*/\1/; p; q}')
PRODUCT_NAME=$(echo "$PRODUCT_INFO" | sed -n '/"name"/ {s/.*:.*"\(.*\)".*/\1/; p; q}')
PRODUCT_RELEASE=$(echo "$PRODUCT_INFO" | sed -n '/"release"/ {s/.*:.*"\(.*\)".*/\1/; p; q}')
PROJECT_NAME=$(sed -n '/"name"/ {s/.*:.*"\(.*\)".*/\1/; p; q}' $PROJECT_DIR/package.json)
PROJECT_DESC=$(sed -n '/"description"/ {s/.*:.*"\(.*\)".*/\1/; p; q}' $PROJECT_DIR/package.json)
PROJECT_VERSION=$(sed -n '/"version"/ {s/.*:.*"\(.*\)".*/\1/; p; q}' $PROJECT_DIR/package.json)
PROJECT_NAME=$(sed -n '/"name"/ {s/.*:.*"\(.*\)".*/\1/; p; q}' $CFGFILE)
PROJECT_DESC=$(sed -n '/"description"/ {s/.*:.*"\(.*\)".*/\1/; p; q}' $CFGFILE)
PROJECT_VERSION=$(sed -n '/"version"/ {s/.*:.*"\(.*\)".*/\1/; p; q}' $CFGFILE)
SONAR_PROJECT_NAME="Monitoring NGSI Adapter"
SONAR_PROJECT_KEY=com.telefonica.iot:monitoring-ngsi-adapter

Expand All @@ -118,7 +122,7 @@ build)
SONAR_COVERAGE_REPORT_RELATIVE_PATH=${COVERAGE_REPORT_DIR#$PROJECT_DIR/}/cobertura-coverage.xml
SONAR_LCOV_REPORT_RELATIVE_PATH=${COVERAGE_REPORT_DIR#$PROJECT_DIR/}/lcov.info

# Prepare properties file for SonarQube (awk to remove leading spaces)
# Prepare properties file for SonarQube (workaround: awk to remove leading spaces)
awk '$1=$1' > $PROJECT_DIR/sonar-project.properties <<-EOF
product.area.name=$PRODUCT_AREA
product.name=$PRODUCT_NAME
Expand All @@ -143,14 +147,16 @@ build)
;;

package)
# install development dependencies
# Install development dependencies
if test -r /etc/redhat-release; then
sudo yum -y -q install rpm-build redhat-rpm-config
# CentOS
sudo yum -y -q install rpm-build rpmdevtools redhat-rpm-config
else
# Ubuntu
sudo apt-get -y -q install dpkg-dev debhelper devscripts
fi

# Generate package
$PROJECT_DIR/tools/build/package.sh -v $PROJECT_VERSION
$PROJECT_DIR/tools/build/package.sh
;;
esac
Loading

0 comments on commit 9f78a39

Please sign in to comment.