Skip to content

Commit 0b3e6cb

Browse files
feat(cf-common): upd image.tpl for backward compatibility (#5)
* feat(cf-common): upd image.tpl for backward compatibility * clean up
1 parent 59dcd5c commit 0b3e6cb

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

charts/cf-common-test/tests/deployment/container_test.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,3 +221,16 @@ tests:
221221
- equal:
222222
path: spec.template.spec.containers[0].image
223223
value: someprivatregistry.local/codefresh/cf-api:master
224+
225+
# For backward compatibility (onprem with private docker registry)
226+
- it: Test main container with private docker registry prefix
227+
values:
228+
- values.yaml
229+
set:
230+
global:
231+
privateRegistry: true
232+
dockerRegistry: myregistry.io/ # / suffix is intentional here
233+
asserts:
234+
- equal:
235+
path: spec.template.spec.containers[0].image
236+
value: myregistry.io/codefresh/cf-api:master

charts/cf-common/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
appVersion: v0.0.0
33
description: Codefresh library chart
44
name: cf-common
5-
version: 0.0.4
5+
version: 0.0.5
66
type: library
77
keywords:
88
- codefresh

charts/cf-common/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Codefresh library chart
44

5-
![Version: 0.0.4](https://img.shields.io/badge/Version-0.0.4-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) ![AppVersion: v0.0.0](https://img.shields.io/badge/AppVersion-v0.0.0-informational?style=flat-square)
5+
![Version: 0.0.5](https://img.shields.io/badge/Version-0.0.5-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) ![AppVersion: v0.0.0](https://img.shields.io/badge/AppVersion-v0.0.0-informational?style=flat-square)
66

77
## Installing the Chart
88

@@ -18,7 +18,7 @@ Include this chart as a dependency in your `Chart.yaml` e.g.
1818
# Chart.yaml
1919
dependencies:
2020
- name: cf-common
21-
version: 0.0.4
21+
version: 0.0.5
2222
repository: https://chartmuseum.codefresh.io/cf-common
2323
```
2424

charts/cf-common/templates/container/_image.tpl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ Usage:
1818
{{- end -}}
1919
{{- end -}}
2020

21+
{{- /*
22+
For backward compatibility (onprem with private docker registry)
23+
*/}}
24+
{{- if $.Values.global -}}
25+
{{- if and $.Values.global.privateRegistry $.Values.global.dockerRegistry -}}
26+
{{ $registryName = $.Values.global.dockerRegistry | trimSuffix "/" }}
27+
{{- end -}}
28+
{{- end -}}
29+
2130
{{- printf "%s/%s:%s" $registryName $repositoryName $imageTag -}}
2231

2332
{{- end -}}

0 commit comments

Comments
 (0)