@@ -59,7 +59,7 @@ def publish_release(source, config, target):
5959 image ['id' ] = _new_id ()
6060 config ['DEIS_APP' ] = target_image
6161 config ['DEIS_RELEASE' ] = target_tag
62- image ['config' ]['Env' ] = _construct_env (config )
62+ image ['config' ]['Env' ] = _construct_env (image [ 'config' ][ 'Env' ], config )
6363 # update and tag the new image
6464 _commit (target_image , image , _empty_tar_archive (), target_tag )
6565
@@ -72,8 +72,6 @@ def _commit(repository_path, image, layer, tag):
7272 cookies = _put_layer (image ['id' ], layer )
7373 _put_checksum (image , cookies )
7474 _put_tag (image ['id' ], repository_path , tag )
75- # point latest to the new tag
76- _put_tag (image ['id' ], repository_path , 'latest' )
7775
7876
7977def _put_first_image (repository_path ):
@@ -162,10 +160,17 @@ def _put_tag(image_id, repository_path, tag):
162160
163161# utility functions
164162
165- def _construct_env (config ):
163+ def _construct_env (env , config ):
166164 "Update current environment with latest config"
167165 new_env = []
168- # add config ENV items
166+ # see if we need to update existing ENV vars
167+ for e in env :
168+ k , v = e .split ('=' , 1 )
169+ if k in config :
170+ # update values defined by config
171+ v = config .pop (k )
172+ new_env .append ("{}={}" .format (encode (k ), encode (v )))
173+ # add other config ENV items
169174 for k , v in config .items ():
170175 new_env .append ("{}={}" .format (encode (k ), encode (v )))
171176 return new_env
0 commit comments