File tree Expand file tree Collapse file tree
test/updaters/fixtures/helm Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11exports [ 'ChartYaml updateContent updates version in Chart.yaml 1' ] = `
2+ # Copyright 2021 Google LLC
3+ #
4+ # Licensed under the Apache License, Version 2.0 (the "License");
5+ # you may not use this file except in compliance with the License.
6+ # You may obtain a copy of the License at
7+ #
8+ # https://www.apache.org/licenses/LICENSE-2.0
9+ #
10+ # Unless required by applicable law or agreed to in writing, software
11+ # distributed under the License is distributed on an "AS IS" BASIS,
12+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ # See the License for the specific language governing permissions and
14+ # limitations under the License.
15+
216name: helm-test-repo
317version: 1.1.0
418apiVersion: v2
19+ # renovate: image=imageName
520appVersion: 2.0.0
621dependencies:
722 - name: another-repo
823 version: 0.15.3
9- repository: linkToHelmChartRepo
24+ repository: " linkToHelmChartRepo"
1025maintainers:
1126 - Abhinav Khanna
1227
Original file line number Diff line number Diff line change 100100 "unist-util-visit" : " ^2.0.3" ,
101101 "unist-util-visit-parents" : " ^3.1.1" ,
102102 "xpath" : " ^0.0.32" ,
103+ "yaml" : " ^2.2.2" ,
103104 "yargs" : " ^17.0.0"
104105 },
105106 "engines" : {
Original file line number Diff line number Diff line change 1212// See the License for the specific language governing permissions and
1313// limitations under the License.
1414
15- import * as yaml from 'js- yaml' ;
15+ import * as yaml from 'yaml' ;
1616import { logger as defaultLogger , Logger } from '../../util/logger' ;
1717import { DefaultUpdater } from '../default' ;
1818
@@ -26,13 +26,13 @@ export class ChartYaml extends DefaultUpdater {
2626 * @returns {string } The updated content
2727 */
2828 updateContent ( content : string , logger : Logger = defaultLogger ) : string {
29- const data = yaml . load ( content , { json : true } ) ;
30- if ( data === null || data === undefined ) {
29+ const chart = yaml . parseDocument ( content ) ;
30+ if ( chart === null || chart === undefined ) {
3131 return '' ;
3232 }
33- const parsed = JSON . parse ( JSON . stringify ( data ) ) ;
34- logger . info ( `updating from ${ parsed . version } to ${ this . version } ` ) ;
35- parsed . version = this . version . toString ( ) ;
36- return yaml . dump ( parsed ) ;
33+ const oldVersion = chart . get ( 'version' ) ;
34+ logger . info ( `updating from ${ oldVersion } to ${ this . version } ` ) ;
35+ chart . set ( ' version' , this . version . toString ( ) ) ;
36+ return chart . toString ( ) ;
3737 }
3838}
Original file line number Diff line number Diff line change 1515name : helm-test-repo
1616version : 1.0.0
1717apiVersion : v2
18+ # renovate: image=imageName
1819appVersion : 2.0.0
1920dependencies :
2021 - name : another-repo
You can’t perform that action at this time.
0 commit comments