@@ -85,25 +85,24 @@ func addRequiredAnnotations(csv map[string]interface{}){
85
85
fmt .Println ("Added required annotations" )
86
86
}
87
87
88
- func replaceVersion (version string , csv map [string ]interface {}) {
88
+ func replaceVersion (oldVersion , newVersion string , csv map [string ]interface {}) {
89
89
spec , ok := csv ["spec" ].(map [string ]interface {})
90
90
metadata , ok := csv ["metadata" ].(map [string ]interface {})
91
91
if ! ok {
92
92
log .Fatal ("Error: 'spec' does not exist in the CSV content" )
93
93
}
94
94
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 ))
97
96
98
- spec ["version" ] = version
99
- spec ["replaces" ] = "file-integrity-operator.v" + manifestVersion
97
+ spec ["version" ] = newVersion
98
+ spec ["replaces" ] = "file-integrity-operator.v" + oldVersion
100
99
101
- metadata ["name" ] = strings .Replace (metadata ["name" ].(string ), manifestVersion , version , 1 )
100
+ metadata ["name" ] = strings .Replace (metadata ["name" ].(string ), oldVersion , newVersion , 1 )
102
101
103
102
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 )
105
104
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 ))
107
106
}
108
107
109
108
func replaceIcon (csv map [string ]interface {}) {
@@ -170,20 +169,21 @@ func main() {
170
169
var csv map [string ]interface {}
171
170
172
171
manifestsDir := os .Args [1 ]
173
- version := os .Args [2 ]
172
+ oldVersion := os .Args [2 ]
173
+ newVersion := os .Args [3 ]
174
174
175
175
csvFilename := getInputCSVFilePath (manifestsDir )
176
176
fmt .Println (fmt .Sprintf ("Found manifest in %s" , csvFilename ))
177
177
178
178
readCSV (csvFilename , & csv )
179
179
180
180
addRequiredAnnotations (csv )
181
- replaceVersion (version , csv )
181
+ replaceVersion (oldVersion , newVersion , csv )
182
182
replaceIcon (csv )
183
183
replaceImages (csv )
184
184
removeRelated (csv )
185
185
186
- outputCSVFilename := getOutputCSVFilePath (manifestsDir , version )
186
+ outputCSVFilename := getOutputCSVFilePath (manifestsDir , newVersion )
187
187
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 ))
189
189
}
0 commit comments