@@ -59,28 +59,31 @@ export async function tryConfigureIngressUsingDockerfile(context: IngressContext
5959 return ;
6060 }
6161
62- if ( ! context . dockerfileExposePorts ) {
63- context . enableIngress = false ;
64- context . enableExternal = false ;
65- } else if ( context . dockerfileExposePorts ) {
62+ if ( context . dockerfileExposePorts ) {
6663 context . enableIngress = true ;
6764 context . enableExternal = true ;
6865 context . targetPort = getDefaultPort ( context ) ;
66+ } else {
67+ context . enableIngress = false ;
68+ context . enableExternal = false ;
6969 }
7070
71- // If a container app already exists, activity children will be added automatically in later execute steps
72- if ( ! context . containerApp ) {
73- context . activityChildren ?. push (
74- new GenericTreeItem ( undefined , {
75- contextValue : createUniversallyUniqueContextValue ( [ 'ingressPromptStepSuccessItem' , activitySuccessContext ] ) ,
76- label : context . enableIngress ?
77- localize ( 'ingressEnableLabel' , 'Enable ingress on port {0} (from Dockerfile configuration)' , context . targetPort ) :
78- localize ( 'ingressDisableLabel' , 'Disable ingress (from Dockerfile configuration)' ) ,
79- iconPath : activitySuccessIcon
80- } )
81- ) ;
71+ const currentExternalEnabled : boolean | undefined = context . containerApp ?. configuration ?. ingress ?. external ;
72+ const currentTargetPort : number | undefined = context . containerApp ?. configuration ?. ingress ?. targetPort ;
73+ if ( currentExternalEnabled === context . enableExternal && currentTargetPort === context . targetPort ) {
74+ return ;
8275 }
8376
77+ context . activityChildren ?. push (
78+ new GenericTreeItem ( undefined , {
79+ contextValue : createUniversallyUniqueContextValue ( [ 'ingressPromptStepSuccessItem' , activitySuccessContext ] ) ,
80+ label : context . enableIngress ?
81+ localize ( 'ingressEnableLabel' , 'Enable ingress on port {0} (from Dockerfile configuration)' , context . targetPort ) :
82+ localize ( 'ingressDisableLabel' , 'Disable ingress (from Dockerfile configuration)' ) ,
83+ iconPath : activitySuccessIcon
84+ } )
85+ ) ;
86+
8487 ext . outputChannel . appendLog ( context . enableIngress ?
8588 localize ( 'ingressEnabledLabel' , 'Detected ingress on port {0} using Dockerfile configuration.' , context . targetPort ) :
8689 localize ( 'ingressDisabledLabel' , 'Detected no ingress using Dockerfile configuration.' )
0 commit comments