Skip to content

Commit 077d91f

Browse files
Pass VCAP_PLATFORM_OPTIONS to cnb stage action (#4539)
- This aligns with the behavior of the buildpack staging action handler Signed-off-by: Tom Kennedy <[email protected]>
1 parent 50ef1c9 commit 077d91f

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

lib/cloud_controller/diego/cnb/staging_action_builder.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def stage_action
4545
path: '/tmp/lifecycle/builder',
4646
user: 'vcap',
4747
args: args,
48-
env: env_vars
48+
env: env_vars + platform_options_env
4949
)
5050
end
5151
end

spec/unit/lib/cloud_controller/diego/cnb/staging_action_builder_spec.rb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,34 @@ module CNB
173173
let(:expected_credhub_arg) do
174174
{ 'VCAP_PLATFORM_OPTIONS' => { 'credhub-uri' => credhub_url } }
175175
end
176+
177+
context 'when credhub url is present' do
178+
context 'when the interpolation of service bindings is enabled' do
179+
before do
180+
TestConfig.override(credential_references: { interpolate_service_bindings: true })
181+
end
182+
183+
it 'sends the credhub_url in the environment variables' do
184+
result = builder.action
185+
actions = result.serial_action.actions
186+
187+
expect(actions[1].run_action.env).to eq(bbs_env + expected_platform_options)
188+
end
189+
end
190+
191+
context 'when the interpolation of service bindings is disabled' do
192+
before do
193+
TestConfig.override(credential_references: { interpolate_service_bindings: false })
194+
end
195+
196+
it 'does not send the credhub_url in the environment variables' do
197+
result = builder.action
198+
actions = result.serial_action.actions
199+
200+
expect(actions[1].run_action.env).to eq(bbs_env)
201+
end
202+
end
203+
end
176204
end
177205

178206
context 'when there is no buildpack cache' do

0 commit comments

Comments
 (0)