feat: add release notes to version file

This commit is contained in:
James Houlahan
2020-12-15 16:28:15 +01:00
parent dfbf25a9f4
commit 4514d72d70
8 changed files with 74 additions and 64 deletions

View File

@ -119,8 +119,8 @@ func (f *FrontendQt) Loop() (err error) {
func (f *FrontendQt) NotifyManualUpdate(update updater.VersionInfo, canInstall bool) { func (f *FrontendQt) NotifyManualUpdate(update updater.VersionInfo, canInstall bool) {
f.Qml.SetUpdateVersion(update.Version.String()) f.Qml.SetUpdateVersion(update.Version.String())
f.Qml.SetUpdateLandingPage(update.Landing) f.Qml.SetUpdateLandingPage(update.LandingPage)
f.Qml.SetUpdateReleaseNotesLink("https://protonmail.com/download/ie/release_notes.html") f.Qml.SetUpdateReleaseNotesLink(update.ReleaseNotesPage)
f.Qml.SetUpdateCanInstall(canInstall) f.Qml.SetUpdateCanInstall(canInstall)
f.updateInfo = update f.updateInfo = update
f.Qml.NotifyManualUpdate() f.Qml.NotifyManualUpdate()

View File

@ -180,8 +180,6 @@ func (s *GoQMLInterface) SetFrontend(f *FrontendQt) {
s.SetProgramTitle(f.programName) s.SetProgramTitle(f.programName)
s.ConnectOpenLicenseFile(f.openLicenseFile) s.ConnectOpenLicenseFile(f.openLicenseFile)
s.SetUpdateReleaseNotesLink("https://protonmail.com/download/ie/release_notes.html")
s.ConnectGetLocalVersionInfo(f.getLocalVersionInfo) s.ConnectGetLocalVersionInfo(f.getLocalVersionInfo)
s.ConnectCheckForUpdates(f.checkForUpdates) s.ConnectCheckForUpdates(f.checkForUpdates)
s.ConnectGetBackendVersion(func() string { s.ConnectGetBackendVersion(func() string {

View File

@ -164,8 +164,8 @@ func (s *FrontendQt) Loop() (err error) {
func (s *FrontendQt) NotifyManualUpdate(update updater.VersionInfo, canInstall bool) { func (s *FrontendQt) NotifyManualUpdate(update updater.VersionInfo, canInstall bool) {
s.Qml.SetUpdateVersion(update.Version.String()) s.Qml.SetUpdateVersion(update.Version.String())
s.Qml.SetUpdateLandingPage(update.Landing) s.Qml.SetUpdateLandingPage(update.LandingPage)
s.Qml.SetUpdateReleaseNotesLink("https://protonmail.com/download/bridge/release_notes.html") s.Qml.SetUpdateReleaseNotesLink(update.ReleaseNotesPage)
s.Qml.SetUpdateCanInstall(canInstall) s.Qml.SetUpdateCanInstall(canInstall)
s.updateInfo = update s.updateInfo = update
s.Qml.NotifyManualUpdate() s.Qml.NotifyManualUpdate()

View File

@ -118,7 +118,7 @@ func (u *Updater) IsUpdateApplicable(version VersionInfo) bool {
return false return false
} }
if u.settings.GetFloat64(settings.RolloutKey) > version.Rollout { if u.settings.GetFloat64(settings.RolloutKey) > version.RolloutProportion {
return false return false
} }

View File

@ -46,10 +46,10 @@ func TestCheck(t *testing.T) {
versionMap := VersionMap{ versionMap := VersionMap{
"live": VersionInfo{ "live": VersionInfo{
Version: semver.MustParse("1.5.0"), Version: semver.MustParse("1.5.0"),
MinAuto: semver.MustParse("1.4.0"), MinAuto: semver.MustParse("1.4.0"),
Package: "https://protonmail.com/download/bridge/update_1.5.0_linux.tgz", Package: "https://protonmail.com/download/bridge/update_1.5.0_linux.tgz",
Rollout: 1.0, RolloutProportion: 1.0,
}, },
} }
@ -77,16 +77,16 @@ func TestCheckEarlyAccess(t *testing.T) {
versionMap := VersionMap{ versionMap := VersionMap{
"live": VersionInfo{ "live": VersionInfo{
Version: semver.MustParse("1.5.0"), Version: semver.MustParse("1.5.0"),
MinAuto: semver.MustParse("1.0.0"), MinAuto: semver.MustParse("1.0.0"),
Package: "https://protonmail.com/download/bridge/update_1.5.0_linux.tgz", Package: "https://protonmail.com/download/bridge/update_1.5.0_linux.tgz",
Rollout: 1.0, RolloutProportion: 1.0,
}, },
"beta": VersionInfo{ "beta": VersionInfo{
Version: semver.MustParse("1.6.0"), Version: semver.MustParse("1.6.0"),
MinAuto: semver.MustParse("1.0.0"), MinAuto: semver.MustParse("1.0.0"),
Package: "https://protonmail.com/download/bridge/update_1.6.0_linux.tgz", Package: "https://protonmail.com/download/bridge/update_1.6.0_linux.tgz",
Rollout: 1.0, RolloutProportion: 1.0,
}, },
} }
@ -134,28 +134,28 @@ func TestIsUpdateApplicable(t *testing.T) {
updater := newTestUpdater(client, "1.4.0", false) updater := newTestUpdater(client, "1.4.0", false)
versionOld := VersionInfo{ versionOld := VersionInfo{
Version: semver.MustParse("1.3.0"), Version: semver.MustParse("1.3.0"),
MinAuto: semver.MustParse("1.3.0"), MinAuto: semver.MustParse("1.3.0"),
Package: "https://protonmail.com/download/bridge/update_1.3.0_linux.tgz", Package: "https://protonmail.com/download/bridge/update_1.3.0_linux.tgz",
Rollout: 1.0, RolloutProportion: 1.0,
} }
assert.Equal(t, false, updater.IsUpdateApplicable(versionOld)) assert.Equal(t, false, updater.IsUpdateApplicable(versionOld))
versionEqual := VersionInfo{ versionEqual := VersionInfo{
Version: semver.MustParse("1.4.0"), Version: semver.MustParse("1.4.0"),
MinAuto: semver.MustParse("1.3.0"), MinAuto: semver.MustParse("1.3.0"),
Package: "https://protonmail.com/download/bridge/update_1.4.0_linux.tgz", Package: "https://protonmail.com/download/bridge/update_1.4.0_linux.tgz",
Rollout: 1.0, RolloutProportion: 1.0,
} }
assert.Equal(t, false, updater.IsUpdateApplicable(versionEqual)) assert.Equal(t, false, updater.IsUpdateApplicable(versionEqual))
versionNew := VersionInfo{ versionNew := VersionInfo{
Version: semver.MustParse("1.5.0"), Version: semver.MustParse("1.5.0"),
MinAuto: semver.MustParse("1.3.0"), MinAuto: semver.MustParse("1.3.0"),
Package: "https://protonmail.com/download/bridge/update_1.5.0_linux.tgz", Package: "https://protonmail.com/download/bridge/update_1.5.0_linux.tgz",
Rollout: 1.0, RolloutProportion: 1.0,
} }
assert.Equal(t, true, updater.IsUpdateApplicable(versionNew)) assert.Equal(t, true, updater.IsUpdateApplicable(versionNew))
@ -170,19 +170,19 @@ func TestCanInstall(t *testing.T) {
updater := newTestUpdater(client, "1.4.0", false) updater := newTestUpdater(client, "1.4.0", false)
versionManual := VersionInfo{ versionManual := VersionInfo{
Version: semver.MustParse("1.5.0"), Version: semver.MustParse("1.5.0"),
MinAuto: semver.MustParse("1.5.0"), MinAuto: semver.MustParse("1.5.0"),
Package: "https://protonmail.com/download/bridge/update_1.5.0_linux.tgz", Package: "https://protonmail.com/download/bridge/update_1.5.0_linux.tgz",
Rollout: 1.0, RolloutProportion: 1.0,
} }
assert.Equal(t, false, updater.CanInstall(versionManual)) assert.Equal(t, false, updater.CanInstall(versionManual))
versionAuto := VersionInfo{ versionAuto := VersionInfo{
Version: semver.MustParse("1.5.0"), Version: semver.MustParse("1.5.0"),
MinAuto: semver.MustParse("1.3.0"), MinAuto: semver.MustParse("1.3.0"),
Package: "https://protonmail.com/download/bridge/update_1.5.0_linux.tgz", Package: "https://protonmail.com/download/bridge/update_1.5.0_linux.tgz",
Rollout: 1.0, RolloutProportion: 1.0,
} }
assert.Equal(t, true, updater.CanInstall(versionAuto)) assert.Equal(t, true, updater.CanInstall(versionAuto))
@ -197,10 +197,10 @@ func TestInstallUpdate(t *testing.T) {
updater := newTestUpdater(client, "1.4.0", false) updater := newTestUpdater(client, "1.4.0", false)
latestVersion := VersionInfo{ latestVersion := VersionInfo{
Version: semver.MustParse("1.5.0"), Version: semver.MustParse("1.5.0"),
MinAuto: semver.MustParse("1.4.0"), MinAuto: semver.MustParse("1.4.0"),
Package: "https://protonmail.com/download/bridge/update_1.5.0_linux.tgz", Package: "https://protonmail.com/download/bridge/update_1.5.0_linux.tgz",
Rollout: 1.0, RolloutProportion: 1.0,
} }
client.EXPECT().DownloadAndVerify( client.EXPECT().DownloadAndVerify(
@ -225,10 +225,10 @@ func TestInstallUpdateBadSignature(t *testing.T) {
updater := newTestUpdater(client, "1.4.0", false) updater := newTestUpdater(client, "1.4.0", false)
latestVersion := VersionInfo{ latestVersion := VersionInfo{
Version: semver.MustParse("1.5.0"), Version: semver.MustParse("1.5.0"),
MinAuto: semver.MustParse("1.4.0"), MinAuto: semver.MustParse("1.4.0"),
Package: "https://protonmail.com/download/bridge/update_1.5.0_linux.tgz", Package: "https://protonmail.com/download/bridge/update_1.5.0_linux.tgz",
Rollout: 1.0, RolloutProportion: 1.0,
} }
client.EXPECT().DownloadAndVerify( client.EXPECT().DownloadAndVerify(
@ -255,10 +255,10 @@ func TestInstallUpdateAlreadyOngoing(t *testing.T) {
updater.installer = &fakeInstaller{delay: 2 * time.Second} updater.installer = &fakeInstaller{delay: 2 * time.Second}
latestVersion := VersionInfo{ latestVersion := VersionInfo{
Version: semver.MustParse("1.5.0"), Version: semver.MustParse("1.5.0"),
MinAuto: semver.MustParse("1.4.0"), MinAuto: semver.MustParse("1.4.0"),
Package: "https://protonmail.com/download/bridge/update_1.5.0_linux.tgz", Package: "https://protonmail.com/download/bridge/update_1.5.0_linux.tgz",
Rollout: 1.0, RolloutProportion: 1.0,
} }
client.EXPECT().DownloadAndVerify( client.EXPECT().DownloadAndVerify(

View File

@ -38,11 +38,14 @@ type VersionInfo struct {
// Installers are the locations of installer files (for manual installation). // Installers are the locations of installer files (for manual installation).
Installers []string Installers []string
// Landing is the address of the app landing page on protonmail.com. // LandingPage is the address of the app landing page on protonmail.com.
Landing string LandingPage string
// Rollout is the current progress of the rollout of this release. // ReleaseNotesPage is the address of the page containing the release notes.
Rollout float64 ReleaseNotesPage string
// RolloutProportion indicates the proportion (0,1] of users that should update to this version.
RolloutProportion float64
} }
// VersionMap represents the structure of the version.json file. // VersionMap represents the structure of the version.json file.
@ -56,8 +59,9 @@ type VersionInfo struct {
// "https://protonmail.com/.../something.rpm", // "https://protonmail.com/.../something.rpm",
// "https://protonmail.com/.../PKGBUILD" // "https://protonmail.com/.../PKGBUILD"
// ], // ],
// "Landing "https://protonmail.com/bridge", // "LandingPage": "https://protonmail.com/bridge",
// "Rollout": 0.5 // "ReleaseNotesPage": "https://protonmail.com/.../release_notes.html",
// "RolloutProportion": 0.5
// }, // },
// "beta": { // "beta": {
// "Version": "2.4.0-beta", // "Version": "2.4.0-beta",
@ -67,8 +71,9 @@ type VersionInfo struct {
// "https://protonmail.com/.../something.rpm", // "https://protonmail.com/.../something.rpm",
// "https://protonmail.com/.../PKGBUILD" // "https://protonmail.com/.../PKGBUILD"
// ], // ],
// "Landing "https://protonmail.com/bridge", // "LandingPage": "https://protonmail.com/bridge",
// "Rollout": 0.5 // "ReleaseNotesPage": "https://protonmail.com/.../release_notes.html",
// "RolloutProportion": 0.5
// }, // },
// "...": { // "...": {
// ... // ...

View File

@ -6,7 +6,6 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/)
### Added ### Added
* GODT-906 Handle RFC2047-encoded content transfer encoding values. * GODT-906 Handle RFC2047-encoded content transfer encoding values.
* GODT-875 Added GUI dialog on force update. * GODT-875 Added GUI dialog on force update.
* GODT-820 Added GUI notification on impossibility of update installation (both silent and manual). * GODT-820 Added GUI notification on impossibility of update installation (both silent and manual).
* GODT-870 Added GUI notification on error during silent update. * GODT-870 Added GUI notification on error during silent update.

View File

@ -88,9 +88,13 @@ func createApp() *cli.App { // nolint[funlen]
Usage: "An installer that can be used to manually install the app (can be specified multiple times)", Usage: "An installer that can be used to manually install the app (can be specified multiple times)",
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "landing", Name: "landing-page",
Usage: "The landing page", Usage: "The landing page",
}, },
&cli.StringFlag{
Name: "release-notes-page",
Usage: "The release notes page",
},
&cli.Float64Flag{ &cli.Float64Flag{
Name: "rollout", Name: "rollout",
Usage: "What proportion of users should receive this update", Usage: "What proportion of users should receive this update",
@ -129,12 +133,16 @@ func update(c *cli.Context) error {
version.Installers = c.StringSlice("installer") version.Installers = c.StringSlice("installer")
} }
if c.IsSet("landing") { if c.IsSet("landing-page") {
version.Landing = c.String("landing") version.LandingPage = c.String("landing-page")
}
if c.IsSet("release-notes-page") {
version.ReleaseNotesPage = c.String("release-notes-page")
} }
if c.IsSet("rollout") { if c.IsSet("rollout") {
version.Rollout = c.Float64("rollout") version.RolloutProportion = c.Float64("rollout")
} }
if c.IsSet("commit") { if c.IsSet("commit") {