#!/bin/bash
#default to snapshot
maven_repo="nectar-nexus-repo-snapshot"
# if we can't find -SNAPSHOT in app.version then reset maven repo to release
grep 'app\.version' application.properties | grep -q "\-SNAPSHOT$"
if [ "$?" = "1" ]; then maven_repo="nectar-nexus-repo-release"; fi
echo $maven_repo
##Beware of grails maven publisher/release plugin misleading error messages Basically the real error/problem/cause (examples of real errors are something like: wrong password or username, an attempt to redeploy into a repository that is configured with redeploy=false, etc) is completely hidden behind layers and layers of crap...
###Examples
####example 00
bash-3.2$ grails prod maven-deploy --repository=nectar-nexus-repo-test
...
[ala-hub] No external configuration file defined.
[ala-hub] (*) grails.config.locations = []
| Done creating WAR target/ala-hub-1.4-SNAPSHOT.war
| Using configured username and password from grails.project.repos.nectar-nexus-repo-test....
| Error Error deploying artifact: Error deploying artifact 'au.org.ala:ala-hub:war': Error deploying artifact: Failed to transfer file: http://130.56.249.242/nexus/content/repositories/releases/au/org/ala/ala-hub/1.4-SNAPSHOT/ala-hub-1.4-20140918.033423-1.war. Return code is: 400
| Error Have you specified a configured repository to deploy to (--repository argument) or specified distributionManagement in your POM?
####example 01
| Done creating WAR target/dashboard-0.2-SNAPSHOT.war
POM generated: /Users/hor22n/src/dashboard_mbohun.git/target/pom.xml
Error deploying artifact: Error deploying artifact 'au.org.ala:dashboard:war': Error deploying artifact: Failed to transfer file: http://130.56.249.242/nexus/content/repositories/snapshots/au/org/ala/dashboard/0.2-SNAPSHOT/dashboard-0.2-20140924.050741-1.war. Return code is: 401
Have you specified a configured repository to deploy to (--repository argument) or specified distributionManagement in your POM?
Maven deploy complete.
grails.project.dependency.distribution = {
remoteRepository(id:"nectar-nexus-repo-snapshot", url:"http://130.56.249.242/nexus/content/repositories/snapshots") {
authentication username: System.getenv("TRAVIS_DEPLOY_USERNAME"), password: System.getenv("TRAVIS_DEPLOY_PASSWORD")
}
remoteRepository(id:"nectar-nexus-repo-release", url:"http://130.56.249.242/nexus/content/repositories/releases") {
authentication username: System.getenv("TRAVIS_DEPLOY_USERNAME"), password: System.getenv("TRAVIS_DEPLOY_PASSWORD")
}
}
(instead of the newer format used by grails 2.3 and higher (>=2.3)):
grails.project.repos.'nectar-nexus-repo-snapshot'.url = "http://130.56.249.242/nexus/content/repositories/snapshots/"
grails.project.repos.'nectar-nexus-repo-snapshot'.username = System.getenv("TRAVIS_DEPLOY_USERNAME")
grails.project.repos.'nectar-nexus-repo-snapshot'.password = System.getenv("TRAVIS_DEPLOY_PASSWORD")
grails.project.repos.'nectar-nexus-repo-release'.url = "http://130.56.249.242/nexus/content/repositories/releases/"
grails.project.repos.'nectar-nexus-repo-release'.username = System.getenv("TRAVIS_DEPLOY_USERNAME")
grails.project.repos.'nectar-nexus-repo-release'.password = System.getenv("TRAVIS_DEPLOY_PASSWORD")
NOTE: maven release plugin with grails 2.4 and higher (>=2.4) accepts and works with BOTH (old AND new) ~/.grails/settings.groovy
file formats.
####example-02 HTTP error 500 (Internal Server Error) reported when sonatype nexus run out of disk space
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..eb6421c
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,25 @@
+language: groovy
+
+jdk:
+ - oraclejdk7
+
+branches:
+ only:
+ - master
+
+before_install:
+- rm -rf ~/.gvm
+- curl -s get.gvmtool.net > ~/install_gvm.sh
+- chmod 775 ~/install_gvm.sh
+- ~/install_gvm.sh
+- echo "gvm_auto_answer=true" > ~/.gvm/etc/config
+- source ~/.gvm/bin/gvm-init.sh
+- gvm install grails $GRAILS_VERSION || true
+
+script: "grails clean && grails upgrade --non-interactive && grails refresh-dependencies --non-interactive && grails prod maven-deploy --repository=nectar-nexus-repo-snapshot"
+
+env:
+ global:
+ - GRAILS_VERSION=2.3.11
+ - secure: "zq9ESeT28Bd9uMYzPXvIaF4dP5C4iHKfvco/GGBWIZUMFJi559LJ61Ddaln10GxuUTWy9s4Xm18KIj6t7u9S6ly+dJ2PgKOavxilTQ3rCF9bCPQ0ylRMqce+ecFoP2T2S8KjHbMUA0+mC+7SCHEHmJZxuwyeCzE8nMpkJkPaQLU="
+ - secure: "v0vb6dKg4CMEeLzlY33wXt+xgHUW4C9E5peHiEQxswUtgGTh95c2xW4OiAJ+dDUjvuu5mKMqLInX66JlLEYq++X1jMY2lSsN/uufCHTn72Jk6wBFZZMNlpa1U5KRcc4OXDGc7dlA/JApjlwlT53Fe9ItPma/VCSlXJd8Ea+hmmQ="
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..8b9b172
--- /dev/null
+++ b/README.md
@@ -0,0 +1,3 @@
+#### ala-hub
+
+ALA version of the hub app [![Build Status](https://travis-ci.org/mbohun/ala-hub.svg?branch=master)](https://travis-ci.org/mbohun/ala-hub)
diff --git a/grails-app/conf/BuildConfig.groovy b/grails-app/conf/BuildConfig.groovy
index 64dcec4..8d6ea65 100644
--- a/grails-app/conf/BuildConfig.groovy
+++ b/grails-app/conf/BuildConfig.groovy
@@ -67,3 +67,11 @@ grails.project.dependency.resolution = {
runtime ":ala-web-theme:0.8.1"
}
}
+
+grails.project.repos.'nectar-nexus-repo-snapshot'.url = "http://130.56.249.242/nexus/content/repositories/snapshots/"
+grails.project.repos.'nectar-nexus-repo-snapshot'.username = System.getenv("TRAVIS_DEPLOY_USERNAME")
+grails.project.repos.'nectar-nexus-repo-snapshot'.password = System.getenv("TRAVIS_DEPLOY_PASSWORD")
+
+grails.project.repos.'nectar-nexus-repo-release'.url = "http://130.56.249.242/nexus/content/repositories/releases/"
+grails.project.repos.'nectar-nexus-repo-release'.username = System.getenv("TRAVIS_DEPLOY_USERNAME")
+grails.project.repos.'nectar-nexus-repo-release'.password = System.getenv("TRAVIS_DEPLOY_PASSWORD")
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..0f5872f
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,25 @@
+language: groovy
+
+jdk:
+- oraclejdk7
+
+branches:
+ only:
+ - master
+
+before_install:
+- rm -rf ~/.gvm
+- curl -s get.gvmtool.net > ~/install_gvm.sh
+- chmod 775 ~/install_gvm.sh
+- ~/install_gvm.sh
+- echo "gvm_auto_answer=true" > ~/.gvm/etc/config
+- source ~/.gvm/bin/gvm-init.sh
+- gvm install grails $GRAILS_VERSION || true
+
+script: mkdir -p ~/.grails; cp travis_grails_settings.groovy ~/.grails/settings.groovy; maven_repo="nectar-nexus-repo-snapshot"; grep 'app\.version' application.properties | grep -q "\-SNAPSHOT$"; if [ "$?" = "1" ]; then maven_repo="nectar-nexus-repo-release"; fi; grails clean && grails upgrade --non-interactive && grails refresh-dependencies --non-interactive && grails prod maven-deploy --repository=$maven_repo
+
+env:
+ global:
+ - GRAILS_VERSION=2.3.8
+ - secure: "QAEefhMWV/lKTPcIHq8AY52DWlEXLp4DxIApP0w1RGYDHf+UA0A/v6z32rRdTE+kuw63MAxzS+Vxi+WRJIm+zCm+ZVteT/MrrEfzDkNRy+Fzc7ej7fkeGmPD7lF7yZgBrGj+eLUAIAkKzIQElI6O2RmMBIuc2Tn0FskPTJZceZE="
+ - secure: "CPvVyaFjhPoeFe+JhiC+3vWNYxfdwW0dGhvhIbf2F+PUcFbmddjpe4gjp9U4l9prE3yNh0yXmn4hP+UTzRSl+/mucyk+CF1xdJ3ZR7rFJud3eRj7sfdQ/wjhYHzaCBWVvEqvP85D0Ur0BMkXu6dCrSldvs0h3tGRRHNa3ZrfBbU="
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..a504a86
--- /dev/null
+++ b/README.md
@@ -0,0 +1,3 @@
+#### alerts
+
+[![Build Status](https://travis-ci.org/mbohun/alerts.svg)](https://travis-ci.org/mbohun/alerts)
diff --git a/travis_grails_settings.groovy b/travis_grails_settings.groovy
new file mode 100644
index 0000000..ae14bb7
--- /dev/null
+++ b/travis_grails_settings.groovy
@@ -0,0 +1,7 @@
+grails.project.repos.'nectar-nexus-repo-snapshot'.url = "http://130.56.249.242/nexus/content/repositories/snapshots/"
+grails.project.repos.'nectar-nexus-repo-snapshot'.username = System.getenv("TRAVIS_DEPLOY_USERNAME")
+grails.project.repos.'nectar-nexus-repo-snapshot'.password = System.getenv("TRAVIS_DEPLOY_PASSWORD")
+
+grails.project.repos.'nectar-nexus-repo-release'.url = "http://130.56.249.242/nexus/content/repositories/releases/"
+grails.project.repos.'nectar-nexus-repo-release'.username = System.getenv("TRAVIS_DEPLOY_USERNAME")
+grails.project.repos.'nectar-nexus-repo-release'.password = System.getenv("TRAVIS_DEPLOY_PASSWORD")
##Intro The ALA applications/components can be divided into 3 diff groups/types according to the build system they use:
jenkins-mvn
/maven
- maven project, build with maven, deployed into a maven repo using hudons/jenkins maven plugingrails-mvn
- grails project, build with grails, deployed into a maven repo using grails maven pluginjenkins-scp
- grails project, build with grails, resulting .war scp into a maven repo using hudson/jenkins scp pluginjenkins-mvn/maven | grails-mvn | jenkins-scp |
---|---|---|
ala-cas | ala-downloads | ala-expert |
ala-cas-client | ala-hub | apikey |
ala-fieldguide | ala-soils2sat | bhl-demo-app :warning: |
ala-logger | ala-web-theme | bie-webapp2 |
ala-logger-service | alerts | dashboard |
ala-name-matching | amrin-hub | ecodata |
ala-names-generator | appd-hub | fieldcapture |
analysis-service | asbp-hub | fieldcapture-hubs |
bie-profile | avh-hub | fielddata |
bie-service | bhl-ftindex-manage | ozatlas-proxy |
biocache-jms | biocache-hubs | regions :warning: |
biocache-store | collectory | sandbox |
layer-ingestion | fielddata-proxy | sds-webapp2 |
layers-service | generic-hub | sightings |
layers-store | image-service | specimenbrowser |
sensitive-species | images-client-plugin | tviewer |
spatial-portal | obis-hub | userdetails |
ozcam-hub | volunteer-portal | |
specieslist-webapp | webapi | |
tepapa-hub |
NOTE: :warning: uses grails < 2.1 (as in no maven support before grails 2.1)
##What needs to be done? In order to add support for travis-ci.org we need to adjust the projects/component as follows:
###common steps
This has to be done for each ALA project we want to add travis-ci.org support to. The order of these steps is important (as in you won't be able to encrypt/generate usernames/passwords for atlasoflivingaustralia/alerts
before you enabled the project atlasoflivingaustralia/alerts
in travis-ci.org)
atlasoflivingaustralia
admin/owner) profile, and enable the project/component you want add travis support for, for example atlasoflivingaustralia/alerts
sudo gem install travis
; this is required to encrypt env variables, files, etc. We want to encrypt our maven repo username/password for deployment from travis-ci.org into our maven repo-s, example:git clone git@github.com:AtlasOfLivingAustralia/alerts.git alerts.git
cd alerts.git
travis2.0 encrypt -r AtlasOfLivingAustralia/alerts "TRAVIS_DEPLOY_USERNAME=someusername"
Please add the following to your .travis.yml file:
secure: "DxzC7mcfOxW6xfV7kUi2qc1kSS/7RCqWw+YFqVxWGJsxPiHiGobKf6PlGDqo8KJgCzQR0apqgvr0bKO9CcRbuqfWNuSsRVf6odHcuvktqIiCznMs7tzbCk8xcu0suXBKrz1sgHphtze/Nt2idTFeLtX6rZ+svKs21kxb9yT2Ik="
travis2.0 encrypt -r AtlasOfLivingAustralia/alerts "TRAVIS_DEPLOY_PASSWORD=somepassword"
Please add the following to your .travis.yml file:
secure: "XIODXD7cct/ruQ/bQ7i/gjhZbUhh8T/y7jZ8xkzQjuwggXm7DQhsWwfpONDjK+R1c2aSTFgBZVR6dSVoo/OIrTZhvmqfcfkYqalNxpqW+YGr/uy723srO0N0RYXJW+3AT2JnoT10SgktyKZMbBvJcGLvSkzr/sfhzDScA5vsoJY="
add the encrypted strings to your .travis.yml
file env: section as described bellow.
The rest of these steps is specific, depending on what type of project (jenkins-mvn, grails-mvn, jenkins-scp).
###jenkins-mvn/maven These projects/components are "ready to go". All that needs to be done, is the basic/standard support for travis:
travis-maven-settings.xml
file (same file format and purpose like ~/.m2/settings.xml
) TODO: OR wget from a fileserver<distributionManagement>
to your pom.xml
file TODO: IF there is some other way to provide this info our life is going to be easier.travis
file to the github project repo, see https://github.com/mbohun/ala-cas for a working exampleworking examples:
###grails-mvn These projects are "ready to go". All that needs to be done, is the basic/standard support for travis:
.travis
file (TODO: agree with Dave which is the best template/approach to use)1.1 make sure to set the correct GRAILS_VERSION
, for example: GRAILS_VERSION=2.3.11
(why we bother with this manually? can't i simply sed it out of application.properties
file?)
grails.project.groupId = "au.org.ala"
, this can be well hidden either in:grails-app/conf/Config.groovy
, orgrails-app/conf/BuildConfig.groovy
, orapplication.properties
working examples:
###jenkins-scp
These projects needs to be 'mavenized' first in order to become the same as grails-mvn
. grails supports maven since grails version 2.1
.
BuildConfig.groovy
grails-mvn
steps to finish (TODO: naivite - in theory this should be the end, BUT)working examples:
##Summary table
module | build sys | jenkins build targets | deployment |
---|---|---|---|
ala-cas | Maven 3.2.1 | clean install -DskipTests=true -e | jenkins-mvn |
ala-cas-client | Maven 3.2.1 | clean install -DskipTests=true -e | jenkins-mvn |
ala-downloads | Grails 2.3.8 | clean-all refresh-dependencies maven-install maven-deploy | grails-mvn |
ala-expert | Grails 2.2.2 | "prod war target/expert.war" | jenkins-scp |
ala-fieldguide | Maven 3.2.1 | clean install -DskipTests=true | jenkins-mvn |
ala-hub | Grails 2.3.11 | refresh-dependencies "prod maven-install" "prod maven-deploy" | grails-mvn |
ala-logger | Maven 3.2.1 | clean install -DskipTests=true | jenkins-mvn |
ala-logger-service | Maven 3.2.1 | clean install -DskipTests=true | jenkins-mvn |
ala-name-matching | Maven 3.2.1 | clean install | jenkins-mvn |
ala-names-generator | Maven 3.2.1 | clean install | jenkins-mvn |
ala-soils2sat | Grails 2.2.3 | ? | grails-mvn ? |
ala-web-theme | Grails 2.3.11 | clean refresh-dependencies maven-deploy | grails-mvn |
alerts | Grails 2.3.8 | refresh-dependencies "prod maven-install" "prod maven-deploy" | grails-mvn |
amrin-hub | Grails 2.3.7 | refresh-dependencies "prod maven-install" "prod maven-deploy" | grails-mvn |
analysis-service | Maven 3.2.1 | clean install -DskipTests=true | jenkins-mvn |
apikey | Grails 2.2.0 | "prod war target/apikey.war" --non-interactive" | jenkins-scp |
appd-hub | Grails 2.3.7 | refresh-dependencies "prod maven-install" "prod maven-deploy" | grails-mvn |
asbp-hub | Grails 2.3.7 | refresh-dependencies "prod maven-install" "prod maven-deploy" | grails-mvn |
avh-hub | Grails 2.3.11 | refresh-dependencies "prod maven-install" "prod maven-deploy" | grails-mvn |
bhl-demo-app | Grails 2.0.1 | ? | jenkins-scp |
bhl-ftindex-manage | Grails 2.2.3 | ? | grails-mvn ? |
bhl-ftindexer | Maven 3.2.1 | ? | maven |
bhl-solr-plugin | Maven 3.2.1 | ? | maven |
bie-profile | Maven 3.2.1 | clean install -DskipTests=true | jenkins-mvn |
bie-service | Maven 3.2.1 | clean install -DskipTests=true | jenkins-mvn |
bie-webapp2 | Grails 2.3.11 | "prod war target/bie-webapp2.war" BROKEN with grails publisher/release plugin, pom.xml creation fails | jenkins-scp |
biocache-hubs | Grails 2.3.8 | clean refresh-dependencies "prod maven-deploy" "prod maven-install" | grails-mvn |
biocache-jms | Maven 3.2.1 | clean install -DskipTests=true | jenkins-mvn |
biocache-service | Maven 3.2.1 | -e clean deploy | maven |
biocache-store | Maven 3.2.1 | clean deploy -e -DskipTests=true DUPLICATE deploy? | maven ,jenkins-mvn |
collectory | Grails 2.3.8 | refresh-dependencies "prod maven-install" "prod maven-deploy" | grails-mvn |
dashboard | Grails 2.2.4 | "prod war target/dashboard.war" | jenkins-scp |
ecodata | Grails 2.2.1 | "prod war target/ecodata.war" | jenkins-scp |
fieldcapture | Grails 2.2.1 | clean "prod war target/fieldcapture.war" | jenkins-scp |
fieldcapture-hubs | Grails 2.4.3 | clean refresh-dependencies "prod war target/fieldcapture-hub.war" | jenkins-scp |
fieldcapture-mobile | android, ios | TODO android/gradle? | gradle? |
fielddata | Grails 2.1.1 | "prod war target/fielddata.war" | jenkins-scp |
fielddata-android | android | TODO android/gradle? | gradle ? |
fielddata-mobile | android, ios | TODO | ? |
fielddata-proxy | Grails 2.2.0 | ? | grails-mvn |
generic-hub | Grails 2.3.8 | refresh-dependencies "prod maven-install" "prod maven-deploy" | grails-mvn |
image-loader | Maven 3.2.1 | ? | maven |
image-service | Grails 2.3.11 | ? | grails-mvn ? |
image-tiling-agent | Maven 3.2.1 | ? | maven |
image-utils | Maven 3.2.1 | ? | maven |
images-client-plugin | Grails 2.3.11 | ? | grails-mvn ? |
layer-ingestion | Maven 3.2.1 | clean install -DskipTests=true | jenkins-mvn |
layers-service | Maven 3.2.1 | clean install -DskipTests=true | jenkins-mvn |
layers-store | Maven 3.2.1 | clean install -DskipTests=true | jenkins-mvn |
obis-hub | Grails 2.3.7 | refresh-dependencies "prod maven-install" "prod maven-deploy" | grails-mvn |
ozatlas | android | android/phonegap | ? |
ozatlas-android | android | TODO | TODO |
ozatlas-proxy | Grails-2.2.4 | "prod war target/mobileauth.war" | jenkins-scp |
ozcam-hub | Grails 2.3.7 | refresh-dependencies "prod maven-install" "prod maven-deploy" | grails-mvn |
regions | Grails 1.3.7 | "prod war target/regions.war" | jenkins-scp |
sandbox | Grails 2.2.4 | "prod war target/datacheck.war" | jenkins-scp |
sds-webapp2 | Grails 2.3.7 | "prod war target/sds-webapp2.war" | jenkins-scp |
sensitive-species | Maven 3.2.1 | clean install -DskipTests=true | jenkins-mvn |
sightings | Grails 2.1.1 | "prod war target/sightings.war" | jenkins-scp |
spatial-logger | Maven 3.2.1 | ? | maven ? |
spatial-portal | Maven 3.2.1 | clean install | jenkins-mvn |
specieslist-webapp | Grails 2.3.8 | refresh-dependencies "prod maven-install" "prod maven-deploy" | grails-mvn |
specimenbrowser | Grails 2.2.2 | ? | jenkins-scp ? |
tepapa-hub | Grails 2.3.7 | refresh-dependencies "prod maven-install" "prod maven-deploy" | grails-mvn |
tviewer | Grails 2.1.2 | "prod war target/tviewer.war" | jenkins-scp |
userdetails | Grails 2.2.4 | "prod war target/userdetails.war" | jenkins-scp |
volunteer-portal | Grails 2.3.11 | "prod war target/volunteer-portal.war" | jenkins-scp |
webapi | Grails 2.3.8 | "prod war target/webapi.war" --non-interactive" | jenkins-scp |