77
88 v1 "github.com/devfile/api/pkg/apis/workspaces/v1alpha2"
99 "github.com/devfile/library/pkg/devfile/parser"
10+ "github.com/devfile/library/pkg/devfile/parser/data/v2/common"
1011 "github.com/devfile/library/pkg/util"
1112 buildv1 "github.com/openshift/api/build/v1"
1213 routev1 "github.com/openshift/api/route/v1"
@@ -193,11 +194,14 @@ func getDeploymentSpec(deploySpecParams deploymentSpecParams) *appsv1.Deployment
193194}
194195
195196// getServiceSpec iterates through the devfile components and returns a ServiceSpec
196- func getServiceSpec (devfileObj parser.DevfileObj , selectorLabels map [string ]string ) (* corev1.ServiceSpec , error ) {
197+ func getServiceSpec (devfileObj parser.DevfileObj , selectorLabels map [string ]string , options common. DevfileOptions ) (* corev1.ServiceSpec , error ) {
197198
198199 var containerPorts []corev1.ContainerPort
199- portExposureMap := getPortExposure (devfileObj )
200- containers , err := GetContainers (devfileObj )
200+ portExposureMap , err := getPortExposure (devfileObj , options )
201+ if err != nil {
202+ return nil , err
203+ }
204+ containers , err := GetContainers (devfileObj , options )
201205 if err != nil {
202206 return nil , err
203207 }
@@ -238,9 +242,12 @@ func getServiceSpec(devfileObj parser.DevfileObj, selectorLabels map[string]stri
238242
239243// getPortExposure iterates through all endpoints and returns the highest exposure level of all TargetPort.
240244// exposure level: public > internal > none
241- func getPortExposure (devfileObj parser.DevfileObj ) map [int ]v1.EndpointExposure {
245+ func getPortExposure (devfileObj parser.DevfileObj , options common. DevfileOptions ) ( map [int ]v1.EndpointExposure , error ) {
242246 portExposureMap := make (map [int ]v1.EndpointExposure )
243- containerComponents := devfileObj .Data .GetDevfileContainerComponents ()
247+ containerComponents , err := devfileObj .Data .GetDevfileContainerComponents (options )
248+ if err != nil {
249+ return portExposureMap , err
250+ }
244251 for _ , comp := range containerComponents {
245252 for _ , endpoint := range comp .Container .Endpoints {
246253 // if exposure=public, no need to check for existence
@@ -257,7 +264,7 @@ func getPortExposure(devfileObj parser.DevfileObj) map[int]v1.EndpointExposure {
257264 }
258265
259266 }
260- return portExposureMap
267+ return portExposureMap , nil
261268}
262269
263270// IngressSpecParams struct for function GenerateIngressSpec
@@ -375,6 +382,7 @@ type BuildConfigSpecParams struct {
375382 ImageStreamTagName string
376383 GitURL string
377384 GitRef string
385+ ContextDir string
378386 BuildStrategy buildv1.BuildStrategy
379387}
380388
@@ -394,7 +402,8 @@ func getBuildConfigSpec(buildConfigSpecParams BuildConfigSpecParams) *buildv1.Bu
394402 URI : buildConfigSpecParams .GitURL ,
395403 Ref : buildConfigSpecParams .GitRef ,
396404 },
397- Type : buildv1 .BuildSourceGit ,
405+ ContextDir : buildConfigSpecParams .ContextDir ,
406+ Type : buildv1 .BuildSourceGit ,
398407 },
399408 Strategy : buildConfigSpecParams .BuildStrategy ,
400409 },
0 commit comments