Fetch the plugin catalog from latest immutable release
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
@@ -27,7 +27,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
defaultCatalogBase = "https://raw.githubusercontent.com/fluxcd/plugins/main/"
|
// defaultCatalogBase points at the latest GitHub release of fluxcd/plugins.
|
||||||
|
defaultCatalogBase = "https://github.com/fluxcd/plugins/releases/latest/download/"
|
||||||
envCatalogBase = "FLUXCD_PLUGIN_CATALOG"
|
envCatalogBase = "FLUXCD_PLUGIN_CATALOG"
|
||||||
|
|
||||||
pluginAPIVersion = "cli.fluxcd.io/v1beta1"
|
pluginAPIVersion = "cli.fluxcd.io/v1beta1"
|
||||||
@@ -111,7 +112,7 @@ func (c *CatalogClient) baseURL() string {
|
|||||||
|
|
||||||
// FetchManifest fetches a single plugin manifest from the catalog.
|
// FetchManifest fetches a single plugin manifest from the catalog.
|
||||||
func (c *CatalogClient) FetchManifest(name string) (*PluginManifest, error) {
|
func (c *CatalogClient) FetchManifest(name string) (*PluginManifest, error) {
|
||||||
url := c.baseURL() + "plugins/" + name + ".yaml"
|
url := c.baseURL() + name + ".yaml"
|
||||||
body, err := c.fetch(url)
|
body, err := c.fetch(url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("plugin %q not found in catalog", name)
|
return nil, fmt.Errorf("plugin %q not found in catalog", name)
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ versions:
|
|||||||
checksum: sha256:abc123
|
checksum: sha256:abc123
|
||||||
`
|
`
|
||||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.URL.Path == "/plugins/operator.yaml" {
|
if r.URL.Path == "/operator.yaml" {
|
||||||
w.Write([]byte(manifest))
|
w.Write([]byte(manifest))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user