This repository was archived by the owner on May 10, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +23
-8
lines changed
Expand file tree Collapse file tree 2 files changed +23
-8
lines changed Original file line number Diff line number Diff line change @@ -122,13 +122,8 @@ def decrypted_config
122122 normalize_config ( self . config ) . deep_dup . tap do |config |
123123 config [ :env ] = process_env ( config [ :env ] ) { |env | decrypt_env ( env ) } if config [ :env ]
124124 config [ :global_env ] = process_env ( config [ :global_env ] ) { |env | decrypt_env ( env ) } if config [ :global_env ]
125- if config [ :addons ]
126- if addons_enabled?
127- config [ :addons ] = decrypt_addons ( config [ :addons ] )
128- else
129- delete_addons ( config )
130- end
131- end
125+ delete_addons ( config ) if config [ :addons ] && !addons_enabled?
126+ config [ :addons ] = decrypt_addons ( config [ :addons ] ) if config [ :addons ]
132127 end
133128 rescue => e
134129 logger . warn "[job id:#{ id } ] Config could not be decrypted due to #{ e . message } "
@@ -155,7 +150,7 @@ def result
155150 private
156151
157152 def whitelisted_addons
158- [ :firefox , :hosts , :postgresql ]
153+ [ :firefox , :hosts , :postgresql , :jwt ]
159154 end
160155
161156 def delete_addons ( config )
Original file line number Diff line number Diff line change 348348 }
349349 }
350350 end
351+
352+ it 'decrypts whitelisted addons' , :only => true do
353+ config = { rvm : '1.8.7' ,
354+ addons : {
355+ jwt : {
356+ secret : job . repository . key . secure . encrypt ( 'ABC=foobar' )
357+ }
358+ }
359+ }
360+ job . config = config
361+
362+ job . decrypted_config . should == {
363+ rvm : '1.8.7' ,
364+ addons : {
365+ jwt : {
366+ secret : 'ABC=foobar'
367+ }
368+ }
369+ }
370+ end
351371 end
352372
353373 context 'when job has secure env enabled' do
You can’t perform that action at this time.
0 commit comments