1616
1717import { shouldUseNativeHelm , createHelmContainer } from '../helm' ;
1818import { determineChartType , constructHelmCommand , ChartType , constructHelmCustomValues } from '../utils' ;
19+ import { RegistryAuthConfig } from '../registryAuth' ;
1920import Deploy from 'server/models/Deploy' ;
2021import GlobalConfigService from 'server/services/globalConfig' ;
2122
@@ -145,7 +146,7 @@ describe('Native Helm', () => {
145146 const deploy = {
146147 deployable : {
147148 helm : {
148- chart : { name : 'bitnami/postgresql ' } ,
149+ chart : { name : 'prometheus-community/prometheus ' } ,
149150 } ,
150151 } ,
151152 } as Deploy ;
@@ -374,10 +375,12 @@ describe('Native Helm', () => {
374375 [ 'values.yaml' ] ,
375376 ChartType . PUBLIC ,
376377 undefined ,
377- 'oci://registry-1.docker. io/bitnamicharts/postgresql '
378+ 'oci://ghcr. io/prometheus-community/helm-charts/prometheus '
378379 ) ;
379380
380- expect ( result ) . toContain ( 'helm upgrade --install my-release oci://registry-1.docker.io/bitnamicharts/postgresql' ) ;
381+ expect ( result ) . toContain (
382+ 'helm upgrade --install my-release oci://ghcr.io/prometheus-community/helm-charts/prometheus'
383+ ) ;
381384 expect ( result ) . toContain ( '--namespace my-namespace' ) ;
382385 expect ( result ) . toContain ( '--set "key=value"' ) ;
383386 expect ( result ) . toContain ( '-f values.yaml' ) ;
@@ -409,22 +412,22 @@ describe('Native Helm', () => {
409412 it ( 'should add chart version for PUBLIC charts when version is specified' , ( ) => {
410413 const result = constructHelmCommand (
411414 'upgrade --install' ,
412- 'bitnami/postgresql ' ,
415+ 'prometheus-community/prometheus ' ,
413416 'my-release' ,
414417 'my-namespace' ,
415- [ 'auth.username=postgres_user ' ] ,
418+ [ 'server.replicaCount=2 ' ] ,
416419 [ ] ,
417420 ChartType . PUBLIC ,
418421 undefined ,
419- 'https://charts.bitnami.com/bitnami ' ,
422+ 'https://prometheus-community.github.io/helm-charts ' ,
420423 undefined ,
421- '12.9 .0'
424+ '25.11 .0'
422425 ) ;
423426
424- expect ( result ) . toContain ( 'helm upgrade --install my-release bitnami/postgresql ' ) ;
427+ expect ( result ) . toContain ( 'helm upgrade --install my-release prometheus-community/prometheus ' ) ;
425428 expect ( result ) . toContain ( '--namespace my-namespace' ) ;
426- expect ( result ) . toContain ( '--version 12.9 .0' ) ;
427- expect ( result ) . toContain ( '--set "auth.username=postgres_user "' ) ;
429+ expect ( result ) . toContain ( '--version 25.11 .0' ) ;
430+ expect ( result ) . toContain ( '--set "server.replicaCount=2 "' ) ;
428431 } ) ;
429432
430433 it ( 'should not add chart version for LOCAL charts even when version is specified' , ( ) => {
@@ -450,17 +453,17 @@ describe('Native Helm', () => {
450453 it ( 'should not add chart version for PUBLIC charts when version is not specified' , ( ) => {
451454 const result = constructHelmCommand (
452455 'upgrade --install' ,
453- 'bitnami/postgresql ' ,
456+ 'prometheus-community/prometheus ' ,
454457 'my-release' ,
455458 'my-namespace' ,
456459 [ ] ,
457460 [ ] ,
458461 ChartType . PUBLIC ,
459462 undefined ,
460- 'https://charts.bitnami.com/bitnami '
463+ 'https://prometheus-community.github.io/helm-charts '
461464 ) ;
462465
463- expect ( result ) . toContain ( 'helm upgrade --install my-release bitnami/postgresql ' ) ;
466+ expect ( result ) . toContain ( 'helm upgrade --install my-release prometheus-community/prometheus ' ) ;
464467 expect ( result ) . toContain ( '--namespace my-namespace' ) ;
465468 expect ( result ) . not . toContain ( '--version' ) ;
466469 } ) ;
@@ -527,6 +530,7 @@ describe('Native Helm', () => {
527530 expect ( result . env ) . toEqual ( [
528531 { name : 'HELM_CACHE_HOME' , value : '/workspace/.helm/cache' } ,
529532 { name : 'HELM_CONFIG_HOME' , value : '/workspace/.helm/config' } ,
533+ { name : 'HELM_EXPERIMENTAL_OCI' , value : '1' } ,
530534 ] ) ;
531535 expect ( result . command ) . toEqual ( [ '/bin/sh' , '-c' ] ) ;
532536 expect ( result . args ) . toHaveLength ( 1 ) ;
@@ -756,37 +760,86 @@ describe('Native Helm', () => {
756760 } ) ;
757761 } ) ;
758762
763+ describe ( 'createHelmContainer with ECR registry auth' , ( ) => {
764+ it ( 'should prepend registry login script for ECR OCI charts' , async ( ) => {
765+ const registryAuth : RegistryAuthConfig = {
766+ type : 'ecr' ,
767+ registry : '123456789012.dkr.ecr.us-west-2.amazonaws.com' ,
768+ region : 'us-west-2' ,
769+ } ;
770+
771+ const result = await createHelmContainer (
772+ 'no-repo' ,
773+ 'my-chart' ,
774+ 'my-release' ,
775+ 'my-namespace' ,
776+ '3.12.0' ,
777+ [ ] ,
778+ [ ] ,
779+ ChartType . PUBLIC ,
780+ undefined ,
781+ 'oci://123456789012.dkr.ecr.us-west-2.amazonaws.com/my-chart' ,
782+ undefined ,
783+ undefined ,
784+ registryAuth
785+ ) ;
786+
787+ expect ( result . args [ 0 ] ) . toContain (
788+ 'cat /workspace/.helm/ecr-token | helm registry login "123456789012.dkr.ecr.us-west-2.amazonaws.com" --username AWS --password-stdin'
789+ ) ;
790+ expect ( result . args [ 0 ] ) . toContain ( 'helm upgrade --install' ) ;
791+ } ) ;
792+
793+ it ( 'should not include registry login script when registryAuth is absent' , async ( ) => {
794+ const result = await createHelmContainer (
795+ 'no-repo' ,
796+ 'my-chart' ,
797+ 'my-release' ,
798+ 'my-namespace' ,
799+ '3.12.0' ,
800+ [ ] ,
801+ [ ] ,
802+ ChartType . PUBLIC ,
803+ undefined ,
804+ 'oci://ghcr.io/prometheus-community/helm-charts/prometheus'
805+ ) ;
806+
807+ expect ( result . args [ 0 ] ) . not . toContain ( 'helm registry login' ) ;
808+ expect ( result . args [ 0 ] ) . toContain ( 'helm upgrade --install' ) ;
809+ } ) ;
810+ } ) ;
811+
759812 describe ( 'Chart Version Integration' , ( ) => {
760813 it ( 'should include chart version from global config for PUBLIC charts' , async ( ) => {
761814 mockGetAllConfigs . mockResolvedValue ( {
762- postgresql : {
815+ prometheus : {
763816 version : '3.7.2' ,
764817 chart : {
765- name : 'postgresql ' ,
766- repoUrl : 'https://charts.bitnami.com/bitnami ' ,
767- version : '12.9 .0' ,
768- values : [ 'auth.username=postgres_user ' ] ,
818+ name : 'prometheus ' ,
819+ repoUrl : 'https://prometheus-community.github.io/helm-charts ' ,
820+ version : '25.11 .0' ,
821+ values : [ 'server.replicaCount=2 ' ] ,
769822 } ,
770823 } ,
771824 } ) ;
772825
773826 const result = await createHelmContainer (
774827 'no-repo' ,
775- 'postgresql ' ,
828+ 'prometheus ' ,
776829 'test-release' ,
777830 'test-namespace' ,
778831 '3.12.0' ,
779- [ 'auth.username=postgres_user ' ] ,
832+ [ 'server.replicaCount=2 ' ] ,
780833 [ ] ,
781834 ChartType . PUBLIC ,
782835 undefined ,
783- 'https://charts.bitnami.com/bitnami ' ,
836+ 'https://prometheus-community.github.io/helm-charts ' ,
784837 undefined ,
785- '12.9 .0'
838+ '25.11 .0'
786839 ) ;
787840
788- expect ( result . args [ 0 ] ) . toContain ( '--version 12.9 .0' ) ;
789- expect ( result . args [ 0 ] ) . toContain ( 'bitnami/postgresql ' ) ;
841+ expect ( result . args [ 0 ] ) . toContain ( '--version 25.11 .0' ) ;
842+ expect ( result . args [ 0 ] ) . toContain ( 'helm-charts/prometheus ' ) ;
790843 } ) ;
791844
792845 it ( 'should include chart version from global config for ORG_CHART' , async ( ) => {
0 commit comments