The behaviour of global properties application to jobs is not compatible with old bosh v1
Now bosh v2 follows the principle to apply the global properties as documented in bosh.io:
https://bosh.io/docs/deployment-manifest.html#properties
Note: If you declare specific properties in a job template spec, BOSH ignores all other properties. If you do not declare any specific properties in a job template spec, BOSH applies all properties from the deployment manifest to the job.
This is not compatible with the behaviour of the old bosh v1.
We have such a use scenario: There are two jobs dummy1 and dummy2 to be deployed
The properties block defined in the deployment yaml:
properties:
dummy1:
prop1: value1
dummy2:
prop2: value2
In dummy2 job spec, it specifies
---
name: dummy2
templates:
ctl.erb: bin/dummy2_ctl
packages: []
properties:
dummy2.prop2:
description: "dummy2 prop2 for test"
In jobs/dummy2/templates/ctl.erb, it accesses properties.dummy1.prop1
<% if properties.dummy1.prop1 == 'value1' %>
echo 'yes'
<% else %>
echo 'no'
<% end %>
In old bosh v1, there is no problem with deploying the release using the deployment yaml. But in bosh v2 (we are using https://bosh.io/d/github.com/cloudfoundry/bosh?v=256.2), bosh deploy will report error during rendering templates:
Error 100: Unable to render instance groups for deployment. Errors are:
- Unable to render jobs for instance group 'dummy_z1'. Errors are:
- Unable to render templates for job 'dummy2'. Errors are:
- Error filling in template 'ctl.erb' (line 35: undefined method `prop1' for nil:NilClass)
In order to work with bosh v2, we need to specify the property dummy1.prop1 in dummy2 job spec properties section which is not needed in bosh v1.
As we have a lot of jobs similar with this use scenario, the incompatibility will cause a lot of work effort to modify the job specs.
/cc @maximilien @jianqiu @mattcui
@gu-bin what you are describing here was actually a non-deterministic bug. (Director was not properly making a deep copy of properties hash). intent was always to require listing of all properties in the job spec. if you look around most of the releases if they use a property in the erb templates, then define it in the properties section of the the release.
@cppforlife The use scenario is what we have been using in IBM Bluemix for a long time with no problem. The bosh version is Version 1.2751.0 (00000000) Maybe it's a incompatibility problem between the new bosh and bosh 1.2751.0?
@gu-bin just to clarify. it seems that you relied on buggy behavior and now that this behaviour is fixed, you will have to update your release with correct property definitions.
/cc @maximilien
I also ran into this when redeploying a manifest on director v256.2 which previously worked on director v250. Fixed it by adding the unlisted property back to the release job's spec and uploading a new release.