@@ -11,6 +11,7 @@ angular.module('openshiftConsole')
11
11
$filter ,
12
12
$routeParams ,
13
13
AlertMessageService ,
14
+ APIService ,
14
15
BuildsService ,
15
16
DataService ,
16
17
LabelFilter ,
@@ -23,6 +24,7 @@ angular.module('openshiftConsole')
23
24
$scope . alerts = { } ;
24
25
$scope . breadcrumbs = [ ] ;
25
26
$scope . forms = { } ;
27
+ $scope . expand = { imageEnv : false } ;
26
28
27
29
if ( $routeParams . isPipeline ) {
28
30
$scope . breadcrumbs . push ( {
@@ -99,6 +101,8 @@ angular.module('openshiftConsole')
99
101
$scope . forms . bcEnvVars . $setPristine ( ) ;
100
102
} ;
101
103
104
+ var lastLoadedBuildFromImageKey ;
105
+
102
106
var buildConfigResolved = function ( buildConfig , action ) {
103
107
$scope . loaded = true ;
104
108
$scope . buildConfig = buildConfig ;
@@ -110,6 +114,28 @@ angular.module('openshiftConsole')
110
114
$scope . imageSourcesPaths . push ( $filter ( 'destinationSourcePair' ) ( imageSource . paths ) ) ;
111
115
} ) ;
112
116
}
117
+ var buildFrom = _ . get ( buildStrategy ( buildConfig ) , 'from' , { } ) ;
118
+ // We don't want to reload the image every time the BC updates, only load again if the from changes
119
+ var buildFromImageKey = buildFrom . kind + "/" + buildFrom . name + "/" + ( buildFrom . namespace || $scope . projectName ) ;
120
+ if ( lastLoadedBuildFromImageKey !== buildFromImageKey ) {
121
+ if ( _ . includes ( [ "ImageStreamTag" , "ImageStreamImage" ] , buildFrom . kind ) ) {
122
+ lastLoadedBuildFromImageKey = buildFromImageKey ;
123
+ DataService . get ( APIService . kindToResource ( buildFrom . kind ) , buildFrom . name , { namespace : buildFrom . namespace || $scope . projectName } ) . then ( function ( imageStreamImage ) {
124
+ $scope . BCEnvVarsFromImage = _ . map ( _ . get ( imageStreamImage , 'image.dockerImageMetadata.Config.Env' ) ,
125
+ function ( entry ) {
126
+ var pair = entry . split ( '=' ) ;
127
+ return {
128
+ name : _ . head ( pair ) ,
129
+ value :_ . last ( pair )
130
+ } ;
131
+ }
132
+ ) ;
133
+ } ) ;
134
+ }
135
+ else {
136
+ $scope . BCEnvVarsFromImage = [ ] ;
137
+ }
138
+ }
113
139
copyBuildConfigAndEnsureEnv ( buildConfig ) ;
114
140
if ( action === "DELETED" ) {
115
141
$scope . alerts [ "deleted" ] = {
0 commit comments