Allow plugins to specify a ReleaseNotesURL via manifest (#13677)

Этот коммит содержится в:
Ben Schumacher
2020-01-28 19:33:21 +01:00
коммит произвёл GitHub
родитель 5f888bd4fc
Коммит cb49d560ab
11 изменённых файлов: 62 добавлений и 45 удалений

Просмотреть файл

@@ -614,9 +614,10 @@ func TestGetInstalledMarketplacePlugins(t *testing.T) {
expectedPlugins := append(samplePlugins, &model.MarketplacePlugin{ expectedPlugins := append(samplePlugins, &model.MarketplacePlugin{
BaseMarketplacePlugin: &model.BaseMarketplacePlugin{ BaseMarketplacePlugin: &model.BaseMarketplacePlugin{
HomepageURL: "https://example.com/homepage", HomepageURL: "https://example.com/homepage",
IconData: testIconData, IconData: testIconData,
DownloadURL: "", DownloadURL: "",
ReleaseNotesURL: "https://example.com/releases/v0.0.1",
Labels: []model.MarketplaceLabel{{ Labels: []model.MarketplaceLabel{{
Name: "Local", Name: "Local",
Description: "This plugin is not listed in the marketplace", Description: "This plugin is not listed in the marketplace",
@@ -754,9 +755,10 @@ func TestSearchGetMarketplacePlugins(t *testing.T) {
plugin1 := &model.MarketplacePlugin{ plugin1 := &model.MarketplacePlugin{
BaseMarketplacePlugin: &model.BaseMarketplacePlugin{ BaseMarketplacePlugin: &model.BaseMarketplacePlugin{
HomepageURL: "https://example.com/homepage", HomepageURL: "https://example.com/homepage",
IconData: testIconData, IconData: testIconData,
DownloadURL: "", DownloadURL: "",
ReleaseNotesURL: "https://example.com/releases/v0.0.1",
Labels: []model.MarketplaceLabel{{ Labels: []model.MarketplaceLabel{{
Name: "Local", Name: "Local",
Description: "This plugin is not listed in the marketplace", Description: "This plugin is not listed in the marketplace",
@@ -772,9 +774,10 @@ func TestSearchGetMarketplacePlugins(t *testing.T) {
plugin2 := &model.MarketplacePlugin{ plugin2 := &model.MarketplacePlugin{
BaseMarketplacePlugin: &model.BaseMarketplacePlugin{ BaseMarketplacePlugin: &model.BaseMarketplacePlugin{
IconData: testIconData, IconData: testIconData,
HomepageURL: "https://example.com/homepage", HomepageURL: "https://example.com/homepage",
DownloadURL: "", DownloadURL: "",
ReleaseNotesURL: "https://example.com/releases/v1.2.3",
Labels: []model.MarketplaceLabel{{ Labels: []model.MarketplaceLabel{{
Name: "Local", Name: "Local",
Description: "This plugin is not listed in the marketplace", Description: "This plugin is not listed in the marketplace",
@@ -919,9 +922,10 @@ func TestGetLocalPluginInMarketplace(t *testing.T) {
newPlugin := &model.MarketplacePlugin{ newPlugin := &model.MarketplacePlugin{
BaseMarketplacePlugin: &model.BaseMarketplacePlugin{ BaseMarketplacePlugin: &model.BaseMarketplacePlugin{
IconData: testIconData, IconData: testIconData,
HomepageURL: "https://example.com/homepage", HomepageURL: "https://example.com/homepage",
Manifest: manifest, ReleaseNotesURL: "https://example.com/releases/v0.0.1",
Manifest: manifest,
}, },
InstalledVersion: manifest.Version, InstalledVersion: manifest.Version,
} }
@@ -959,9 +963,10 @@ func TestGetLocalPluginInMarketplace(t *testing.T) {
newPlugin := &model.MarketplacePlugin{ newPlugin := &model.MarketplacePlugin{
BaseMarketplacePlugin: &model.BaseMarketplacePlugin{ BaseMarketplacePlugin: &model.BaseMarketplacePlugin{
Manifest: manifest, Manifest: manifest,
IconData: testIconData, IconData: testIconData,
HomepageURL: "https://example.com/homepage", HomepageURL: "https://example.com/homepage",
ReleaseNotesURL: "https://example.com/releases/v0.0.1",
Labels: []model.MarketplaceLabel{{ Labels: []model.MarketplaceLabel{{
Name: "Local", Name: "Local",
Description: "This plugin is not listed in the marketplace", Description: "This plugin is not listed in the marketplace",

Просмотреть файл

@@ -534,9 +534,10 @@ func (a *App) mergePrepackagedPlugins(remoteMarketplacePlugins map[string]*model
prepackagedMarketplace := &model.MarketplacePlugin{ prepackagedMarketplace := &model.MarketplacePlugin{
BaseMarketplacePlugin: &model.BaseMarketplacePlugin{ BaseMarketplacePlugin: &model.BaseMarketplacePlugin{
HomepageURL: prepackaged.Manifest.HomepageURL, HomepageURL: prepackaged.Manifest.HomepageURL,
IconData: prepackaged.IconData, IconData: prepackaged.IconData,
Manifest: prepackaged.Manifest, ReleaseNotesURL: prepackaged.Manifest.ReleaseNotesURL,
Manifest: prepackaged.Manifest,
}, },
} }
@@ -608,10 +609,11 @@ func (a *App) mergeLocalPlugins(remoteMarketplacePlugins map[string]*model.Marke
remoteMarketplacePlugins[plugin.Manifest.Id] = &model.MarketplacePlugin{ remoteMarketplacePlugins[plugin.Manifest.Id] = &model.MarketplacePlugin{
BaseMarketplacePlugin: &model.BaseMarketplacePlugin{ BaseMarketplacePlugin: &model.BaseMarketplacePlugin{
IconData: iconData, HomepageURL: plugin.Manifest.HomepageURL,
HomepageURL: plugin.Manifest.HomepageURL, IconData: iconData,
Labels: labels, ReleaseNotesURL: plugin.Manifest.ReleaseNotesURL,
Manifest: plugin.Manifest, Labels: labels,
Manifest: plugin.Manifest,
}, },
InstalledVersion: plugin.Manifest.Version, InstalledVersion: plugin.Manifest.Version,
} }

Просмотреть файл

@@ -154,6 +154,9 @@ type Manifest struct {
// SupportURL is an optional URL where plugin issues can be reported. // SupportURL is an optional URL where plugin issues can be reported.
SupportURL string `json:"support_url,omitempty" yaml:"support_url,omitempty"` SupportURL string `json:"support_url,omitempty" yaml:"support_url,omitempty"`
// ReleaseNotesURL is an optional URL where a changelog for the release can be found.
ReleaseNotesURL string `json:"release_notes_url,omitempty" yaml:"release_notes_url,omitempty"`
// A relative file path in the bundle that points to the plugins svg icon for use with the Plugin Marketplace. // A relative file path in the bundle that points to the plugins svg icon for use with the Plugin Marketplace.
// This should be relative to the root of your bundle and the location of the manifest file. Bitmap image formats are not supported. // This should be relative to the root of your bundle and the location of the manifest file. Bitmap image formats are not supported.
IconPath string `json:"icon_path,omitempty" yaml:"icon_path,omitempty"` IconPath string `json:"icon_path,omitempty" yaml:"icon_path,omitempty"`
@@ -330,6 +333,10 @@ func (m *Manifest) IsValid() error {
return errors.New("invalid SupportURL") return errors.New("invalid SupportURL")
} }
if m.ReleaseNotesURL != "" && !IsValidHttpUrl(m.ReleaseNotesURL) {
return errors.New("invalid SupportURL")
}
_, err := semver.Parse(m.Version) _, err := semver.Parse(m.Version)
if err != nil { if err != nil {
return errors.Wrap(err, "failed to parse Version") return errors.Wrap(err, "failed to parse Version")

Просмотреть файл

@@ -25,7 +25,8 @@ func TestIsValid(t *testing.T) {
}{ }{
{"Invalid Id", &Manifest{Id: "some id"}, true}, {"Invalid Id", &Manifest{Id: "some id"}, true},
{"Invalid homePageURL", &Manifest{Id: "com.company.test", HomepageURL: "some url"}, true}, {"Invalid homePageURL", &Manifest{Id: "com.company.test", HomepageURL: "some url"}, true},
{"Invalid supportURL", &Manifest{Id: "com.company.test", HomepageURL: "http://someurl.com", SupportURL: "some url"}, true}, {"Invalid supportURL", &Manifest{Id: "com.company.test", SupportURL: "some url"}, true},
{"Invalid ReleaseNotesURL", &Manifest{Id: "com.company.test", ReleaseNotesURL: "some url"}, true},
{"Invalid version", &Manifest{Id: "com.company.test", HomepageURL: "http://someurl.com", SupportURL: "http://someotherurl.com", Version: "version"}, true}, {"Invalid version", &Manifest{Id: "com.company.test", HomepageURL: "http://someurl.com", SupportURL: "http://someotherurl.com", Version: "version"}, true},
{"Invalid min version", &Manifest{Id: "com.company.test", HomepageURL: "http://someurl.com", SupportURL: "http://someotherurl.com", Version: "5.10.0", MinServerVersion: "version"}, true}, {"Invalid min version", &Manifest{Id: "com.company.test", HomepageURL: "http://someurl.com", SupportURL: "http://someotherurl.com", Version: "5.10.0", MinServerVersion: "version"}, true},
{"SettingSchema error", &Manifest{Id: "com.company.test", HomepageURL: "http://someurl.com", SupportURL: "http://someotherurl.com", Version: "5.10.0", MinServerVersion: "5.10.8", SettingsSchema: &PluginSettingsSchema{ {"SettingSchema error", &Manifest{Id: "com.company.test", HomepageURL: "http://someurl.com", SupportURL: "http://someotherurl.com", Version: "5.10.0", MinServerVersion: "5.10.8", SettingsSchema: &PluginSettingsSchema{
@@ -37,6 +38,7 @@ func TestIsValid(t *testing.T) {
Description: "thedescription", Description: "thedescription",
HomepageURL: "http://someurl.com", HomepageURL: "http://someurl.com",
SupportURL: "http://someotherurl.com", SupportURL: "http://someotherurl.com",
ReleaseNotesURL: "http://someotherurl.com/releases/v0.0.1",
Version: "0.0.1", Version: "0.0.1",
MinServerVersion: "5.6.0", MinServerVersion: "5.6.0",
Server: &ManifestServer{ Server: &ManifestServer{

Просмотреть файл

@@ -34,5 +34,6 @@ Then update the sigantures:
$ gpg -u F3FACE45E0DE642C8BD6A8E64C7C6562C192CC1F --verbose --personal-digest-preferences SHA256 --detach-sign testplugin.tar.gz $ gpg -u F3FACE45E0DE642C8BD6A8E64C7C6562C192CC1F --verbose --personal-digest-preferences SHA256 --detach-sign testplugin.tar.gz
$ gpg -u F3FACE45E0DE642C8BD6A8E64C7C6562C192CC1F --verbose --personal-digest-preferences SHA256 --detach-sign --armor testplugin.tar.gz $ gpg -u F3FACE45E0DE642C8BD6A8E64C7C6562C192CC1F --verbose --personal-digest-preferences SHA256 --detach-sign --armor testplugin.tar.gz
$ gpg -u F3FACE45E0DE642C8BD6A8E64C7C6562C192CC1F --verbose --personal-digest-preferences SHA256 --detach-sign testplugin2.tar.gz $ gpg -u F3FACE45E0DE642C8BD6A8E64C7C6562C192CC1F --verbose --personal-digest-preferences SHA256 --detach-sign testplugin2.tar.gz
$ gpg -u F3FACE45E0DE642C8BD6A8E64C7C6562C192CC1F --verbose --personal-digest-preferences SHA256 --detach-sign --armor testplugin2.tar.gz
Finally, include the updates bundles and signatures in your commit. Finally, include the updates bundles and signatures in your commit.

Двоичные данные
tests/testplugin.tar.gz

Двоичный файл не отображается.

Просмотреть файл

@@ -1,14 +1,14 @@
-----BEGIN PGP SIGNATURE----- -----BEGIN PGP SIGNATURE-----
iQGzBAABCAAdFiEE8/rOReDeZCyL1qjmTHxlYsGSzB8FAl4hzNEACgkQTHxlYsGS iQGzBAABCAAdFiEE8/rOReDeZCyL1qjmTHxlYsGSzB8FAl4sogwACgkQTHxlYsGS
zB9+oQv+LoGzdDKmJu1J021S5lw6fIoUtEB0AUFHXZyij9bSLhMxey8LbW5l6JnG zB+CiwwAqNhwq6PQeKCQyJ4F1kZBpSkHrlbaT+V89tcj5BomhxFin30XukW2tiov
0Op0SEDU4c97eQMwFvfrLnJDepziFrlSZmt60v/6LxEraB4CfCQ/D6M2/dkcERnG +U4cfeKI+NAu9uPUxN6f4r6khQOGQK0bvun3YDemhbVozaPneNoxs+ugkBLMrwvp
c7AUsbObiS6eYpkw5isLz6dP8LoHZBSl4Sw2aSujQL1IvPC3tAzkBDZ7HlxRK4Py v3Vbi241bTWsi6NxlwJDSM+LEYWkFXZKCjQFjX2UWEM86uocKZnjHHqqke4ZkXWm
x9ekBj26mrkwY+1A6to3GofK1fSo8NZtstuJ2408r4crGplOXahLrW2hW5f++4pJ Sal1mOvfZtx/R0+8aKt7FEbdUy4s15gRcVfnp017PD9VDwfiXSMVrdaYr3HqD2Q/
L0c4945emSO5XkHXMlz46WcRNvgEAeaLMZwmKxfVH5gDR9kbzrrEgDQibSZtn+mF WMMmZ9lW4Y0I6qtv+1Ud9YZAXPr8OzsgU13FXU1GcUG+L/W8jSb9XY/4EIFpb4O6
mfMk22vlJ4wZUGnvWnbpEKUWllwmJcCXUkHc/Xw8s8vB+qcToAWZYFzIxydiUdVm tQGRBBtjq0EofVq8S9V6/LMPH3/CPgHufK7TWl12mnyGUOac4YmFlGtStkovIHZJ
oUzDvh/QcG2G4I6q+Qp2YqZs8QVCSJIQN50AAXKnNEh1D0M9EiK/3e/GfHvNnPwQ +nxcMsV5xU3UhdM+/uBJnC5EH8sH2hQpkJugZIFruswfHNSiNKUpiHjupepfsV7v
uWjNw0bXKBIduDl/dZp7DSSRmtkFAmwu+tAZZbzaqb+qRzL1GuWneZbcgyCpze1C jzKCEgh7Rv99QBSSBtZSuBitnzEWAE3X9UsEYx5qCQJvBBVLiugFHFv6MtkePRNd
KXSi4aDJ ElLLqMat
=1iVn =KHZP
-----END PGP SIGNATURE----- -----END PGP SIGNATURE-----

Двоичные данные
tests/testplugin.tar.gz.sig

Двоичный файл не отображается.

Двоичные данные
tests/testplugin2.tar.gz

Двоичный файл не отображается.

Просмотреть файл

@@ -1,14 +1,14 @@
-----BEGIN PGP SIGNATURE----- -----BEGIN PGP SIGNATURE-----
iQGzBAABCAAdFiEE8/rOReDeZCyL1qjmTHxlYsGSzB8FAl4fca4ACgkQTHxlYsGS iQGzBAABCAAdFiEE8/rOReDeZCyL1qjmTHxlYsGSzB8FAl4soo8ACgkQTHxlYsGS
zB8qkgv/cTe71xkIHALB0HAvnd2HD6NqA3/AdOWIvZtmtU8une2s6Int28sPMkt9 zB+7RwwAmwLH64J1G9LUQRD1rJFlvlIGgEE6leaJO4bKkOACD4QQs70q+rLzNazA
HNmVsBpiDnsmB+jfkrf4NXpCVn3to/gB1qWSmudPWb+b54XGdD8SGOpmCT9Fd2qN maVKjOddKq5fslIsQxHHlIeIMfuTioQ12ZOU6pVY1o1gw5RPolCopLdgac1lA0Fg
EGHjgvmHJ/2F5PQ5B+FazLflyFn0JcA+BCikBcJfmTvDdBgEwR5QEsowDy5mLb3v dDMCtB62iRJqcsnUWFJwhf9fBCwNVGjG6+fPnLyHOXNmDGWDnxxPLNevSEya/Yzg
AxKZR9PnmOkAt0/fs2geyqPZ1s+NTlsIHRP0Hvtkxq7BvQJWoTmcJb5mFbBvAz24 68C1ervBJ4AV6x6Wyc4ejaAliHOBMzv1Z8NclWisKYllaigUUtWauctiM00Ga7kM
nsXzGpAFKpBjx9v9WErcq8Fy2Ad3Iqu7mKgTQxPrpreCRZceWJg327fFr8A2YVCU ADOMVBljI8QauV7E39mxr89Z9ULo8moI2dIPwyrC2vWaW0RnK1XXO2+pDugrlSN7
Zo2cC/+By2GUmnotHVD4abead0J8t3eVyexg0CwOstQCeIEKfYtuU8UuyJtqhO6t ZLGFMdcD6kjnwaZXfSNXeXh2PeERjhRk8Zw5mvrg51VgUaqv2pZjP4g2hA5D1D0U
cKkE1oiBOo7TtYdWRQyR/9zlim7Wlj94WvquJLemCfazoQdq68hyvGa6C2lakZx3 BGgPLVrlkqEV9my8MNLMhBmj1WfBzDNMEcUu4UbeVpnkj3Px0cnWAAFQgSAMniON
iSzYw00V6U+aEXffadzXnmbQiJKcOu7gIyumBbGIDLOfM5ypACvnCNHxQ/mlYHjD c8ng0VEuEHo2z3kiQcBT//mHgFuzaX47OYgPsBPZzMpIAlQ+giryHT8byXcOLcfc
+HOR5g+1 KuwzQRZj
=FsxQ =Z3mM
-----END PGP SIGNATURE----- -----END PGP SIGNATURE-----

Двоичные данные
tests/testplugin2.tar.gz.sig

Двоичный файл не отображается.