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

This commit is contained in:
Ben Schumacher 2020-01-28 19:33:21 +01:00 committed by GitHub
parent 5f888bd4fc
commit cb49d560ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 62 additions and 45 deletions

View file

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

View file

@ -534,9 +534,10 @@ func (a *App) mergePrepackagedPlugins(remoteMarketplacePlugins map[string]*model
prepackagedMarketplace := &model.MarketplacePlugin{
BaseMarketplacePlugin: &model.BaseMarketplacePlugin{
HomepageURL: prepackaged.Manifest.HomepageURL,
IconData: prepackaged.IconData,
Manifest: prepackaged.Manifest,
HomepageURL: prepackaged.Manifest.HomepageURL,
IconData: prepackaged.IconData,
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{
BaseMarketplacePlugin: &model.BaseMarketplacePlugin{
IconData: iconData,
HomepageURL: plugin.Manifest.HomepageURL,
Labels: labels,
Manifest: plugin.Manifest,
HomepageURL: plugin.Manifest.HomepageURL,
IconData: iconData,
ReleaseNotesURL: plugin.Manifest.ReleaseNotesURL,
Labels: labels,
Manifest: plugin.Manifest,
},
InstalledVersion: plugin.Manifest.Version,
}

View file

@ -154,6 +154,9 @@ type Manifest struct {
// SupportURL is an optional URL where plugin issues can be reported.
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.
// 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"`
@ -330,6 +333,10 @@ func (m *Manifest) IsValid() error {
return errors.New("invalid SupportURL")
}
if m.ReleaseNotesURL != "" && !IsValidHttpUrl(m.ReleaseNotesURL) {
return errors.New("invalid SupportURL")
}
_, err := semver.Parse(m.Version)
if err != nil {
return errors.Wrap(err, "failed to parse Version")

View file

@ -25,7 +25,8 @@ func TestIsValid(t *testing.T) {
}{
{"Invalid Id", &Manifest{Id: "some id"}, 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 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{
@ -37,6 +38,7 @@ func TestIsValid(t *testing.T) {
Description: "thedescription",
HomepageURL: "http://someurl.com",
SupportURL: "http://someotherurl.com",
ReleaseNotesURL: "http://someotherurl.com/releases/v0.0.1",
Version: "0.0.1",
MinServerVersion: "5.6.0",
Server: &ManifestServer{

View file

@ -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 --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 --armor testplugin2.tar.gz
Finally, include the updates bundles and signatures in your commit.

Binary file not shown.

View file

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

Binary file not shown.

Binary file not shown.

View file

@ -1,14 +1,14 @@
-----BEGIN PGP SIGNATURE-----
iQGzBAABCAAdFiEE8/rOReDeZCyL1qjmTHxlYsGSzB8FAl4fca4ACgkQTHxlYsGS
zB8qkgv/cTe71xkIHALB0HAvnd2HD6NqA3/AdOWIvZtmtU8une2s6Int28sPMkt9
HNmVsBpiDnsmB+jfkrf4NXpCVn3to/gB1qWSmudPWb+b54XGdD8SGOpmCT9Fd2qN
EGHjgvmHJ/2F5PQ5B+FazLflyFn0JcA+BCikBcJfmTvDdBgEwR5QEsowDy5mLb3v
AxKZR9PnmOkAt0/fs2geyqPZ1s+NTlsIHRP0Hvtkxq7BvQJWoTmcJb5mFbBvAz24
nsXzGpAFKpBjx9v9WErcq8Fy2Ad3Iqu7mKgTQxPrpreCRZceWJg327fFr8A2YVCU
Zo2cC/+By2GUmnotHVD4abead0J8t3eVyexg0CwOstQCeIEKfYtuU8UuyJtqhO6t
cKkE1oiBOo7TtYdWRQyR/9zlim7Wlj94WvquJLemCfazoQdq68hyvGa6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