Skip to content
This repository was archived by the owner on Jun 2, 2021. It is now read-only.

Commit 3502b17

Browse files
committed
Add environment variables to kpack image CR
1 parent 7ef926a commit 3502b17

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

lib/cloud_controller/kpack/stager.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ def image_resource(staging_details)
7575
blob: {
7676
url: blobstore_url_generator.package_download_url(staging_details.package),
7777
}
78+
},
79+
build: {
80+
env: staging_details.environment_variables.to_a.
81+
select{ | key, value | key =~ /^BP[A-Z]{0,1}_/ }.
82+
map{ | key , value | {name: key, value: value.to_s() } }
7883
}
7984
}
8085
})

spec/unit/lib/cloud_controller/kpack/stager_spec.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module Kpack
1111
)
1212
}
1313
let(:package) { VCAP::CloudController::PackageModel.make }
14-
let(:environment_variables) { { 'nightshade_vegetable' => 'potato' } }
14+
let(:environment_variables) { { 'BP_JAVA_VERSION' => '8.*', 'JAVA_OPTS' => 'invalid', 'BPL_HEAD_ROOM' => 0} }
1515
let(:staging_memory_in_mb) { 1024 }
1616
let(:staging_disk_in_mb) { 1024 }
1717
let(:blobstore_url_generator) do
@@ -77,6 +77,9 @@ module Kpack
7777
blob: {
7878
url: 'package-download-url',
7979
}
80+
},
81+
build: {
82+
env: [ {name: "BP_JAVA_VERSION", value: "8.*"} , {name: "BPL_HEAD_ROOM", value: "0"}]
8083
}
8184
}
8285
}))
@@ -132,8 +135,7 @@ module Kpack
132135
blob: {
133136
url: 'old-package-url',
134137
}
135-
}
136-
}
138+
} }
137139
})
138140
end
139141

0 commit comments

Comments
 (0)