Skip to content

Commit

Permalink
harden update worker for empty zoslight version (#2477)
Browse files Browse the repository at this point in the history
Signed-off-by: Ashraf Fouda <[email protected]>
  • Loading branch information
ashraffouda authored Nov 6, 2024
1 parent 1f696a3 commit f3dade9
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions tools/zos-update-worker/internal/update_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,20 +134,23 @@ func (w *Worker) updateZosVersion(network Network, manager client.Manager) error
//zos
zosCurrent := fmt.Sprintf("%v/.tag-%v", w.src, chainVersion.Version)
zosLatest := fmt.Sprintf("%v/%v", w.dst, network)

// zos light
zosLightCurrent := fmt.Sprintf("%v/.tag-%v", w.src, chainVersion.VersionLight)
zosLightLatest := fmt.Sprintf("%v/%v-v4", w.dst, network)
if chainVersion.VersionLight != "" {
zosLightCurrent := fmt.Sprintf("%v/.tag-%v", w.src, chainVersion.VersionLight)
zosLightLatest := fmt.Sprintf("%v/%v-v4", w.dst, network)
zosLightLink := fmt.Sprintf("%v/.tag-%v", path, chainVersion.VersionLight)
if err = w.updateLink(zosLightCurrent, zosLightLatest, zosLightLink); err != nil {
return err
}
}
// the link is like zosCurrent but it has the path relative from the symlink
// point of view (so relative to the symlink, how to reach zosCurrent)
// hence the link is instead used in all calls to symlink
zosLink := fmt.Sprintf("%v/.tag-%v", path, chainVersion.Version)
zosLightLink := fmt.Sprintf("%v/.tag-%v", path, chainVersion.VersionLight)

// update links for both zos and zoslight
if err = w.updateLink(zosCurrent, zosLatest, zosLink); err != nil {
return err
}
return w.updateLink(zosLightCurrent, zosLightLatest, zosLightLink)
// update links zos
return w.updateLink(zosCurrent, zosLatest, zosLink)
}

func (w *Worker) updateLink(current string, latest string, link string) error {
Expand Down

0 comments on commit f3dade9

Please sign in to comment.