@@ -85,25 +85,24 @@ func addRequiredAnnotations(csv map[string]interface{}){
8585 fmt .Println ("Added required annotations" )
8686}
8787
88- func replaceVersion (version string , csv map [string ]interface {}) {
88+ func replaceVersion (oldVersion , newVersion string , csv map [string ]interface {}) {
8989 spec , ok := csv ["spec" ].(map [string ]interface {})
9090 metadata , ok := csv ["metadata" ].(map [string ]interface {})
9191 if ! ok {
9292 log .Fatal ("Error: 'spec' does not exist in the CSV content" )
9393 }
9494
95- manifestVersion := spec ["version" ].(string )
96- fmt .Println (fmt .Sprintf ("Updating version references from %s to %s" , manifestVersion , version ))
95+ fmt .Println (fmt .Sprintf ("Updating version references from %s to %s" , oldVersion , newVersion ))
9796
98- spec ["version" ] = version
99- spec ["replaces" ] = "file-integrity-operator.v" + manifestVersion
97+ spec ["version" ] = newVersion
98+ spec ["replaces" ] = "file-integrity-operator.v" + oldVersion
10099
101- metadata ["name" ] = strings .Replace (metadata ["name" ].(string ), manifestVersion , version , 1 )
100+ metadata ["name" ] = strings .Replace (metadata ["name" ].(string ), oldVersion , newVersion , 1 )
102101
103102 annotations := metadata ["annotations" ].(map [string ]interface {})
104- annotations ["olm.skipRange" ] = strings .Replace (annotations ["olm.skipRange" ].(string ), manifestVersion , version , 1 )
103+ annotations ["olm.skipRange" ] = strings .Replace (annotations ["olm.skipRange" ].(string ), oldVersion , newVersion , 1 )
105104
106- fmt .Println (fmt .Sprintf ("Updated version references from %s to %s" , manifestVersion , version ))
105+ fmt .Println (fmt .Sprintf ("Updated version references from %s to %s" , oldVersion , newVersion ))
107106}
108107
109108func replaceIcon (csv map [string ]interface {}) {
@@ -170,20 +169,21 @@ func main() {
170169 var csv map [string ]interface {}
171170
172171 manifestsDir := os .Args [1 ]
173- version := os .Args [2 ]
172+ oldVersion := os .Args [2 ]
173+ newVersion := os .Args [3 ]
174174
175175 csvFilename := getInputCSVFilePath (manifestsDir )
176176 fmt .Println (fmt .Sprintf ("Found manifest in %s" , csvFilename ))
177177
178178 readCSV (csvFilename , & csv )
179179
180180 addRequiredAnnotations (csv )
181- replaceVersion (version , csv )
181+ replaceVersion (oldVersion , newVersion , csv )
182182 replaceIcon (csv )
183183 replaceImages (csv )
184184 removeRelated (csv )
185185
186- outputCSVFilename := getOutputCSVFilePath (manifestsDir , version )
186+ outputCSVFilename := getOutputCSVFilePath (manifestsDir , newVersion )
187187 replaceCSV (csvFilename , outputCSVFilename , csv )
188- fmt .Println (fmt .Sprintf ("Replaced CSV manifest for %s" , version ))
188+ fmt .Println (fmt .Sprintf ("Replaced CSV manifest for %s" , newVersion ))
189189}
0 commit comments