Skip to content

Commit

Permalink
supports zoslight version in update_worker (#2462)
Browse files Browse the repository at this point in the history
Signed-off-by: Ashraf Fouda <[email protected]>
  • Loading branch information
ashraffouda authored Nov 3, 2024
1 parent fef77d5 commit 9998be1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tools/zos-update-worker/internal/update_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,15 @@ func (w *Worker) updateZosVersion(network Network, manager client.Manager) error
type ChainVersion struct {
SafeToUpgrade bool `json:"safe_to_upgrade"`
Version string `json:"version"`
VersionLight string `json:"version_light"`
}

var chainVersion ChainVersion
err = json.Unmarshal([]byte(currentZosVersion), &chainVersion)
if err != nil {
log.Debug().Err(err).Msg("failed to unmarshal chain version")
chainVersion.Version = currentZosVersion
chainVersion.VersionLight = currentZosVersion
}

log.Debug().Msgf("getting substrate version %v for network %v", chainVersion.Version, network)
Expand All @@ -133,13 +135,14 @@ func (w *Worker) updateZosVersion(network Network, manager client.Manager) error
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.Version)
// to handle the environments that aren't updated yet (mainnet)
zosLightCurrent := fmt.Sprintf("%v/.tag-%v", w.src, chainVersion.VersionLight)
zosLightLatest := fmt.Sprintf("%v/%v-v4", w.dst, network)
// 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.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 {
Expand Down

0 comments on commit 9998be1

Please sign in to comment.