Tuesday, 13 December 2011

How many times have you had problems trying to make your bamboo plans prepared to run in different environments, i.e.: prod, testing, dev?

In the following example, I have a small web application that uses spring where I inject the url of the external service I want to use into a java class. I have a different url for different environments. Now I want to pass the environment I want to pass al the way from bamboo2 to java and spring. So from bamboo I will be able to define a plan for every environment so that I will be able to test every environment, deploy to every environment and so on.
I am assuming you have a good knowledge about spring, bamboo, maven and unit testing in general and the only thing you do not know is how to make it more generic.

Properties file:



So we have a file for each configuration.

Spring config file:

xsi:schemalocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
              http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
              http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

 <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" id="propertyConfigurer">
  <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE">
  <property name="location" value="classpath:configuration-${env}.properties">

 <bean class="com.miguel.app.App" id="app">  
  <property name="url" value="${app.url}">


Configure surefire plugin:


In the plan go to configure job
set the goal:
test -Denv=dev

Thursday, 24 November 2011

If hosts file does not seem to work in your browser

Given a host file with the following content: yourhost.co.uk

If your hosts file does not seem to work with yourhost.co.uk when you load that url in firefox, internet explorer, chrome and/ or safari and you get a message like this:

Network Error (dns_unresolved_hostname) 

Your requested host "yourhost.co.uk" could not be resolved by DNS.  

For assistance, contact your network support team.  

but ping can resolve the ip address,

Pinging yourhost.co.uk [] with 32 bytes of data:
Reply from bytes=32 time<1ms TTL=64
Reply from bytes=32 time<1ms TTL=64
Reply from bytes=32 time<1ms TTL=64
Reply from bytes=32 time<1ms TTL=64

Ping statistics for
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

Try to go to your internet explorer, then "internet options", then click "connections" tab, then click "LAN settings" button. Although you are accessing this internet options through explorer, it affects the other browser as well. Please untick "Automatically detect settings", at least the fixed my problem, it may fix yours.

Friday, 15 April 2011

Agile development vs development by contract

Don't get me wrong, I really enjoy working in an agile process but I am not totally sure that is fine for any situation...

What about when you are a company that creates custom-built software, you have a client and asks you for a budget to do application X? How do you give a quote? To give a figure, you need to agree on same requirements and depending on the implementation it will cost you more or less. If you want to give a realistic figure, you will need to think about the architecture, the technologies you are going to use.

Don't tell me that you have to trust, because that is not going to happen. This is real world. The client needs a guarantee, a figure and you need to limit what are planning to deliver with that figure: the list of requirements.

Basically I am talking about a pre-negotiation, a negotiation that should lead to a very detailed document, analysis, design and so on. Later on, you can be the most agile person or team in the world but this first step contradicts agile totally. You can even make your client to get involved and change the spec, attend the demos, etc but the first step is like the original sin, so you can't be truly agile.

Of course, after a while, your client may trust you and probably you can implement this agile approach from the scratch.

When somebody says why the waterfall process has lasted so much, my only answer probably is that at the beginning probably most companies did custom-built software, so they had all the requirements very clear at the beginning, so doing a design and then implement, was just natural. As nowadays many companies have the software development department inside, people are starting realizing that in this case, we can use a more agile approach.