mirror of https://github.com/harness/drone.git
[feat]: [AH-1033]: nuget implmentation (#3570)
* [AH-1033]: [feat]: pr check * [feat]: [AH-1033]: pr check * [feat]: [AH-1033]: pr check * [feat]: [AH-1033]: pr check * [feat]: [AH-1033]: pr check * [feat]: [AH-1033]: pr check * [feat]: [AH-1033]: upload flow * [feat]: [AH-1033]: resolve conflicts * [AH-1033]: [feat]: nuget service endpoint api * [AH-1036]: [feat]: added routes and apis for nuget * [AH-1033]: nuget implmentation * [AH-993]: Updated local file * [AH-993]: Added support for local and created arch to support different package types * Merge branch 'main' of https://git0.harness.io/l7B_kbSEQD2wjrM7PShm5w/PROD/Harness_Commons/gitness into AH-993-upstream-implementation * [AH-993]: temp commit * [AH-993]: Merge commit: * [AH-993]: temp updatemain
parent
e518dc7f41
commit
a6985a55ad
|
@ -415,3 +415,5 @@ issues:
|
|||
linters: [ goheader ]
|
||||
- path: "^registry/app/storage/blobStore.go"
|
||||
linters: [ gosec ]
|
||||
- path: "^registry/app/metadata/nuget/metadata.go"
|
||||
linters: [ tagliatelle, lll ]
|
||||
|
|
|
@ -124,6 +124,7 @@ import (
|
|||
"github.com/harness/gitness/lock"
|
||||
"github.com/harness/gitness/pubsub"
|
||||
api2 "github.com/harness/gitness/registry/app/api"
|
||||
nuget2 "github.com/harness/gitness/registry/app/api/controller/pkg/nuget"
|
||||
python2 "github.com/harness/gitness/registry/app/api/controller/pkg/python"
|
||||
"github.com/harness/gitness/registry/app/api/router"
|
||||
events10 "github.com/harness/gitness/registry/app/events"
|
||||
|
@ -133,6 +134,7 @@ import (
|
|||
"github.com/harness/gitness/registry/app/pkg/filemanager"
|
||||
"github.com/harness/gitness/registry/app/pkg/generic"
|
||||
"github.com/harness/gitness/registry/app/pkg/maven"
|
||||
"github.com/harness/gitness/registry/app/pkg/nuget"
|
||||
"github.com/harness/gitness/registry/app/pkg/python"
|
||||
database2 "github.com/harness/gitness/registry/app/store/database"
|
||||
"github.com/harness/gitness/registry/gc"
|
||||
|
@ -523,7 +525,10 @@ func initSystem(ctx context.Context, config *types.Config) (*server.System, erro
|
|||
proxy := python.ProxyProvider(upstreamProxyConfigRepository, registryRepository, imageRepository, artifactRepository, fileManager, transactor, provider, spaceFinder, secretService, localRegistryHelper)
|
||||
pythonController := python2.ControllerProvider(upstreamProxyConfigRepository, registryRepository, imageRepository, artifactRepository, fileManager, transactor, provider, pythonLocalRegistry, proxy)
|
||||
pythonHandler := api2.NewPythonHandlerProvider(pythonController, packagesHandler)
|
||||
handler4 := router.PackageHandlerProvider(packagesHandler, mavenHandler, genericHandler, pythonHandler)
|
||||
nugetLocalRegistry := nuget.LocalRegistryProvider(localBase, fileManager, upstreamProxyConfigRepository, transactor, registryRepository, imageRepository, artifactRepository, provider)
|
||||
nugetController := nuget2.ControllerProvider(upstreamProxyConfigRepository, registryRepository, imageRepository, artifactRepository, fileManager, transactor, provider, nugetLocalRegistry)
|
||||
nugetHandler := api2.NewNugetHandlerProvider(nugetController, packagesHandler)
|
||||
handler4 := router.PackageHandlerProvider(packagesHandler, mavenHandler, genericHandler, pythonHandler, nugetHandler)
|
||||
appRouter := router.AppRouterProvider(registryOCIHandler, apiHandler, handler2, handler3, handler4)
|
||||
sender := usage.ProvideMediator(ctx, config, spaceFinder, usageMetricStore)
|
||||
remoteauthService := remoteauth.ProvideRemoteAuth(tokenStore, principalStore)
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
// Copyright 2023 Harness, Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package nuget
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
|
||||
urlprovider "github.com/harness/gitness/app/url"
|
||||
"github.com/harness/gitness/registry/app/pkg/filemanager"
|
||||
"github.com/harness/gitness/registry/app/pkg/nuget"
|
||||
nugettype "github.com/harness/gitness/registry/app/pkg/types/nuget"
|
||||
"github.com/harness/gitness/registry/app/store"
|
||||
"github.com/harness/gitness/store/database/dbtx"
|
||||
)
|
||||
|
||||
type Controller interface {
|
||||
UploadPackage(
|
||||
ctx context.Context,
|
||||
info nugettype.ArtifactInfo,
|
||||
fileReader io.ReadCloser,
|
||||
) *PutArtifactResponse
|
||||
|
||||
DownloadPackage(ctx context.Context, info nugettype.ArtifactInfo) *GetArtifactResponse
|
||||
|
||||
GetServiceEndpoint(ctx context.Context,
|
||||
info nugettype.ArtifactInfo) *GetServiceEndpointResponse
|
||||
}
|
||||
|
||||
// Controller handles Python package operations.
|
||||
type controller struct {
|
||||
fileManager filemanager.FileManager
|
||||
proxyStore store.UpstreamProxyConfigRepository
|
||||
tx dbtx.Transactor
|
||||
registryDao store.RegistryRepository
|
||||
imageDao store.ImageRepository
|
||||
artifactDao store.ArtifactRepository
|
||||
urlProvider urlprovider.Provider
|
||||
local nuget.LocalRegistry
|
||||
}
|
||||
|
||||
// NewController creates a new Python controller.
|
||||
func NewController(
|
||||
proxyStore store.UpstreamProxyConfigRepository,
|
||||
registryDao store.RegistryRepository,
|
||||
imageDao store.ImageRepository,
|
||||
artifactDao store.ArtifactRepository,
|
||||
fileManager filemanager.FileManager,
|
||||
tx dbtx.Transactor,
|
||||
urlProvider urlprovider.Provider,
|
||||
local nuget.LocalRegistry,
|
||||
) Controller {
|
||||
return &controller{
|
||||
proxyStore: proxyStore,
|
||||
registryDao: registryDao,
|
||||
imageDao: imageDao,
|
||||
artifactDao: artifactDao,
|
||||
fileManager: fileManager,
|
||||
tx: tx,
|
||||
urlProvider: urlProvider,
|
||||
local: local,
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
// Copyright 2023 Harness, Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package nuget
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/harness/gitness/registry/app/pkg"
|
||||
"github.com/harness/gitness/registry/app/pkg/base"
|
||||
"github.com/harness/gitness/registry/app/pkg/nuget"
|
||||
"github.com/harness/gitness/registry/app/pkg/response"
|
||||
nugettype "github.com/harness/gitness/registry/app/pkg/types/nuget"
|
||||
registrytypes "github.com/harness/gitness/registry/types"
|
||||
)
|
||||
|
||||
func (c *controller) DownloadPackage(
|
||||
ctx context.Context,
|
||||
info nugettype.ArtifactInfo,
|
||||
) *GetArtifactResponse {
|
||||
f := func(registry registrytypes.Registry, a pkg.Artifact) response.Response {
|
||||
info.RegIdentifier = registry.Name
|
||||
info.RegistryID = registry.ID
|
||||
nugetRegistry, ok := a.(nuget.Registry)
|
||||
if !ok {
|
||||
return &GetArtifactResponse{
|
||||
BaseResponse{
|
||||
fmt.Errorf("invalid registry type: expected nuget.Registry"),
|
||||
nil,
|
||||
},
|
||||
"", nil, nil,
|
||||
}
|
||||
}
|
||||
headers, fileReader, redirectURL, err := nugetRegistry.DownloadPackage(ctx, info)
|
||||
return &GetArtifactResponse{
|
||||
BaseResponse{
|
||||
err,
|
||||
headers,
|
||||
},
|
||||
redirectURL, fileReader, nil,
|
||||
}
|
||||
}
|
||||
|
||||
result, err := base.ProxyWrapper(ctx, c.registryDao, f, info)
|
||||
if err != nil {
|
||||
return &GetArtifactResponse{
|
||||
BaseResponse{
|
||||
err,
|
||||
nil,
|
||||
},
|
||||
"", nil, nil,
|
||||
}
|
||||
}
|
||||
getResponse, ok := result.(*GetArtifactResponse)
|
||||
if !ok {
|
||||
return &GetArtifactResponse{
|
||||
BaseResponse{
|
||||
fmt.Errorf("invalid registry type: expected nuget.Registry"),
|
||||
nil,
|
||||
}, "", nil, nil,
|
||||
}
|
||||
}
|
||||
return getResponse
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
// Copyright 2023 Harness, Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package nuget
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/harness/gitness/registry/app/pkg/commons"
|
||||
"github.com/harness/gitness/registry/app/pkg/response"
|
||||
"github.com/harness/gitness/registry/app/pkg/types/nuget"
|
||||
"github.com/harness/gitness/registry/app/storage"
|
||||
)
|
||||
|
||||
var _ response.Response = (*GetServiceEndpointResponse)(nil)
|
||||
var _ response.Response = (*GetArtifactResponse)(nil)
|
||||
var _ response.Response = (*PutArtifactResponse)(nil)
|
||||
|
||||
type BaseResponse struct {
|
||||
Error error
|
||||
ResponseHeaders *commons.ResponseHeaders
|
||||
}
|
||||
|
||||
func (r BaseResponse) GetError() error {
|
||||
return r.Error
|
||||
}
|
||||
|
||||
type GetServiceEndpointResponse struct {
|
||||
BaseResponse
|
||||
ServiceEndpoint *nuget.ServiceEndpoint
|
||||
}
|
||||
|
||||
type GetArtifactResponse struct {
|
||||
BaseResponse
|
||||
RedirectURL string
|
||||
Body *storage.FileReader
|
||||
ReadCloser io.ReadCloser
|
||||
}
|
||||
type PutArtifactResponse struct {
|
||||
BaseResponse
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
// Copyright 2023 Harness, Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package nuget
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/harness/gitness/registry/app/pkg"
|
||||
"github.com/harness/gitness/registry/app/pkg/base"
|
||||
"github.com/harness/gitness/registry/app/pkg/nuget"
|
||||
"github.com/harness/gitness/registry/app/pkg/response"
|
||||
nugettype "github.com/harness/gitness/registry/app/pkg/types/nuget"
|
||||
registrytypes "github.com/harness/gitness/registry/types"
|
||||
)
|
||||
|
||||
func (c *controller) GetServiceEndpoint(
|
||||
ctx context.Context,
|
||||
info nugettype.ArtifactInfo,
|
||||
) *GetServiceEndpointResponse {
|
||||
f := func(registry registrytypes.Registry, a pkg.Artifact) response.Response {
|
||||
info.RegIdentifier = registry.Name
|
||||
info.RegistryID = registry.ID
|
||||
nugetRegistry, ok := a.(nuget.Registry)
|
||||
if !ok {
|
||||
return &GetServiceEndpointResponse{
|
||||
BaseResponse{
|
||||
fmt.Errorf("invalid registry type: expected nuget.Registry"),
|
||||
nil,
|
||||
}, nil,
|
||||
}
|
||||
}
|
||||
serviceEndpoint := nugetRegistry.GetServiceEndpoint(ctx, info)
|
||||
return &GetServiceEndpointResponse{
|
||||
BaseResponse{
|
||||
nil,
|
||||
nil,
|
||||
}, serviceEndpoint,
|
||||
}
|
||||
}
|
||||
|
||||
result, err := base.NoProxyWrapper(ctx, c.registryDao, f, info)
|
||||
|
||||
if err != nil {
|
||||
return &GetServiceEndpointResponse{
|
||||
BaseResponse{
|
||||
err,
|
||||
nil,
|
||||
}, nil,
|
||||
}
|
||||
}
|
||||
serviceEndpointResponse, ok := result.(*GetServiceEndpointResponse)
|
||||
if !ok {
|
||||
return &GetServiceEndpointResponse{
|
||||
BaseResponse{
|
||||
fmt.Errorf("invalid registry type: expected nuget.Registry"),
|
||||
nil,
|
||||
}, nil,
|
||||
}
|
||||
}
|
||||
return serviceEndpointResponse
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
// Copyright 2023 Harness, Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package nuget
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/harness/gitness/registry/app/pkg"
|
||||
"github.com/harness/gitness/registry/app/pkg/base"
|
||||
"github.com/harness/gitness/registry/app/pkg/nuget"
|
||||
"github.com/harness/gitness/registry/app/pkg/response"
|
||||
nugettype "github.com/harness/gitness/registry/app/pkg/types/nuget"
|
||||
registrytypes "github.com/harness/gitness/registry/types"
|
||||
)
|
||||
|
||||
func (c *controller) UploadPackage(
|
||||
ctx context.Context,
|
||||
info nugettype.ArtifactInfo,
|
||||
fileReader io.ReadCloser,
|
||||
) *PutArtifactResponse {
|
||||
f := func(registry registrytypes.Registry, a pkg.Artifact) response.Response {
|
||||
info.RegIdentifier = registry.Name
|
||||
info.RegistryID = registry.ID
|
||||
nugetRegistry, ok := a.(nuget.Registry)
|
||||
if !ok {
|
||||
return &PutArtifactResponse{
|
||||
BaseResponse{
|
||||
Error: fmt.Errorf("invalid registry type: expected nuget.Registry"),
|
||||
ResponseHeaders: nil,
|
||||
},
|
||||
}
|
||||
}
|
||||
headers, _, err := nugetRegistry.UploadPackage(ctx, info, fileReader)
|
||||
return &PutArtifactResponse{
|
||||
BaseResponse{
|
||||
Error: err,
|
||||
ResponseHeaders: headers,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
result, err := base.NoProxyWrapper(ctx, c.registryDao, f, info)
|
||||
if err != nil {
|
||||
return &PutArtifactResponse{
|
||||
BaseResponse{
|
||||
Error: err,
|
||||
ResponseHeaders: nil,
|
||||
},
|
||||
}
|
||||
}
|
||||
uploadResponse, ok := result.(*PutArtifactResponse)
|
||||
if !ok {
|
||||
return &PutArtifactResponse{
|
||||
BaseResponse{
|
||||
Error: err,
|
||||
ResponseHeaders: nil,
|
||||
},
|
||||
}
|
||||
}
|
||||
return uploadResponse
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
// Copyright 2023 Harness, Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package nuget
|
||||
|
||||
import (
|
||||
urlprovider "github.com/harness/gitness/app/url"
|
||||
"github.com/harness/gitness/registry/app/pkg/filemanager"
|
||||
"github.com/harness/gitness/registry/app/pkg/nuget"
|
||||
"github.com/harness/gitness/registry/app/store"
|
||||
"github.com/harness/gitness/store/database/dbtx"
|
||||
|
||||
"github.com/google/wire"
|
||||
)
|
||||
|
||||
func ControllerProvider(
|
||||
proxyStore store.UpstreamProxyConfigRepository,
|
||||
registryDao store.RegistryRepository,
|
||||
imageDao store.ImageRepository,
|
||||
artifactDao store.ArtifactRepository,
|
||||
fileManager filemanager.FileManager,
|
||||
tx dbtx.Transactor,
|
||||
urlProvider urlprovider.Provider,
|
||||
local nuget.LocalRegistry,
|
||||
) Controller {
|
||||
return NewController(proxyStore, registryDao, imageDao, artifactDao, fileManager, tx, urlProvider, local)
|
||||
}
|
||||
|
||||
var ControllerSet = wire.NewSet(ControllerProvider)
|
|
@ -0,0 +1,64 @@
|
|||
// Copyright 2023 Harness, Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package nuget
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/harness/gitness/registry/app/pkg/commons"
|
||||
nugettype "github.com/harness/gitness/registry/app/pkg/types/nuget"
|
||||
"github.com/harness/gitness/registry/request"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func (h *handler) DownloadPackage(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
info, ok := request.ArtifactInfoFrom(ctx).(*nugettype.ArtifactInfo)
|
||||
if !ok {
|
||||
log.Ctx(ctx).Error().Msg("Failed to get artifact info from context")
|
||||
h.HandleErrors(r.Context(), []error{fmt.Errorf("failed to fetch info from context")}, w)
|
||||
return
|
||||
}
|
||||
|
||||
response := h.controller.DownloadPackage(ctx, *info)
|
||||
|
||||
defer func() {
|
||||
if response.Body != nil {
|
||||
err := response.Body.Close()
|
||||
if err != nil {
|
||||
log.Ctx(ctx).Error().Msgf("Failed to close body: %v", err)
|
||||
}
|
||||
}
|
||||
if response.ReadCloser != nil {
|
||||
err := response.ReadCloser.Close()
|
||||
if err != nil {
|
||||
log.Ctx(ctx).Error().Msgf("Failed to close readCloser: %v", err)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
if !commons.IsEmpty(response.GetError()) {
|
||||
h.HandleError(r.Context(), w, response.GetError())
|
||||
}
|
||||
|
||||
if response.RedirectURL != "" {
|
||||
http.Redirect(w, r, response.RedirectURL, http.StatusTemporaryRedirect)
|
||||
return
|
||||
}
|
||||
h.ServeContent(w, r, response.Body, info.Filename)
|
||||
response.ResponseHeaders.WriteToResponse(w)
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
// Copyright 2023 Harness, Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package nuget
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/harness/gitness/registry/app/api/controller/pkg/nuget"
|
||||
"github.com/harness/gitness/registry/app/api/handler/packages"
|
||||
nugetmetadata "github.com/harness/gitness/registry/app/metadata/nuget"
|
||||
"github.com/harness/gitness/registry/app/pkg"
|
||||
nugettype "github.com/harness/gitness/registry/app/pkg/types/nuget"
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
)
|
||||
|
||||
type Handler interface {
|
||||
pkg.ArtifactInfoProvider
|
||||
UploadPackage(writer http.ResponseWriter, request *http.Request)
|
||||
DownloadPackage(http.ResponseWriter, *http.Request)
|
||||
GetServiceEndpoint(http.ResponseWriter, *http.Request)
|
||||
}
|
||||
|
||||
type handler struct {
|
||||
packages.Handler
|
||||
controller nuget.Controller
|
||||
}
|
||||
|
||||
func NewHandler(
|
||||
controller nuget.Controller,
|
||||
packageHandler packages.Handler,
|
||||
) Handler {
|
||||
return &handler{
|
||||
Handler: packageHandler,
|
||||
controller: controller,
|
||||
}
|
||||
}
|
||||
|
||||
var _ Handler = (*handler)(nil)
|
||||
|
||||
func (h *handler) GetPackageArtifactInfo(r *http.Request) (pkg.PackageArtifactInfo, error) {
|
||||
info, err := h.Handler.GetArtifactInfo(r)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
image := chi.URLParam(r, "id")
|
||||
filename := chi.URLParam(r, "filename")
|
||||
version := chi.URLParam(r, "version")
|
||||
|
||||
var md nugetmetadata.Metadata
|
||||
|
||||
info.Image = image
|
||||
return &nugettype.ArtifactInfo{
|
||||
ArtifactInfo: info,
|
||||
Metadata: md,
|
||||
Filename: filename,
|
||||
Version: version,
|
||||
}, nil
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
// Copyright 2023 Harness, Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package nuget
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/harness/gitness/registry/app/pkg/commons"
|
||||
nugettype "github.com/harness/gitness/registry/app/pkg/types/nuget"
|
||||
"github.com/harness/gitness/registry/request"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func (h *handler) GetServiceEndpoint(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
info, ok := request.ArtifactInfoFrom(ctx).(*nugettype.ArtifactInfo)
|
||||
if !ok {
|
||||
log.Ctx(ctx).Error().Msg("Failed to get artifact info from context")
|
||||
h.HandleErrors(r.Context(), []error{fmt.Errorf("failed to fetch info from context")}, w)
|
||||
return
|
||||
}
|
||||
response := h.controller.GetServiceEndpoint(r.Context(), *info)
|
||||
|
||||
if !commons.IsEmpty(response.GetError()) {
|
||||
h.HandleError(r.Context(), w, response.GetError())
|
||||
return
|
||||
}
|
||||
err := json.NewEncoder(w).Encode(response.ServiceEndpoint)
|
||||
if err != nil {
|
||||
h.HandleErrors(r.Context(), []error{err}, w)
|
||||
return
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
// Copyright 2023 Harness, Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package nuget
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/harness/gitness/registry/app/pkg/commons"
|
||||
nugettype "github.com/harness/gitness/registry/app/pkg/types/nuget"
|
||||
"github.com/harness/gitness/registry/request"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func (h *handler) UploadPackage(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
info, ok := request.ArtifactInfoFrom(ctx).(*nugettype.ArtifactInfo)
|
||||
if !ok {
|
||||
log.Ctx(ctx).Error().Msg("Failed to get artifact info from context")
|
||||
h.HandleErrors(r.Context(), []error{fmt.Errorf("failed to fetch info from context")}, w)
|
||||
return
|
||||
}
|
||||
response := h.controller.UploadPackage(r.Context(), *info, r.Body)
|
||||
if !commons.IsEmpty(response.GetError()) {
|
||||
h.HandleError(ctx, w, response.GetError())
|
||||
return
|
||||
}
|
||||
response.ResponseHeaders.WriteToResponse(w)
|
||||
}
|
|
@ -90,12 +90,14 @@ const (
|
|||
PathPackageTypeGeneric PathPackageType = "generic"
|
||||
PathPackageTypeMaven PathPackageType = "maven"
|
||||
PathPackageTypePython PathPackageType = "python"
|
||||
PathPackageTypeNuget PathPackageType = "nuget"
|
||||
)
|
||||
|
||||
var packageTypeMap = map[PathPackageType]artifact2.PackageType{
|
||||
PathPackageTypeGeneric: artifact2.PackageTypeGENERIC,
|
||||
PathPackageTypeMaven: artifact2.PackageTypeMAVEN,
|
||||
PathPackageTypePython: artifact2.PackageTypePYTHON,
|
||||
PathPackageTypeNuget: artifact2.PackageTypeNUGET,
|
||||
}
|
||||
|
||||
func (h *handler) GetAuthenticator() authn.Authenticator {
|
||||
|
|
|
@ -2207,6 +2207,7 @@ components:
|
|||
- PYTHON
|
||||
- GENERIC
|
||||
- HELM
|
||||
- NUGET
|
||||
- NPM
|
||||
SectionType:
|
||||
type: string
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Package artifact provides primitives to interact with the openapi HTTP API.
|
||||
//
|
||||
// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT.
|
||||
// Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT.
|
||||
package artifact
|
||||
|
||||
import (
|
||||
|
@ -346,6 +346,7 @@ type MiddlewareFunc func(http.Handler) http.Handler
|
|||
|
||||
// CreateRegistry operation middleware
|
||||
func (siw *ServerInterfaceWrapper) CreateRegistry(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -368,11 +369,12 @@ func (siw *ServerInterfaceWrapper) CreateRegistry(w http.ResponseWriter, r *http
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// DeleteRegistry operation middleware
|
||||
func (siw *ServerInterfaceWrapper) DeleteRegistry(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -393,11 +395,12 @@ func (siw *ServerInterfaceWrapper) DeleteRegistry(w http.ResponseWriter, r *http
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetRegistry operation middleware
|
||||
func (siw *ServerInterfaceWrapper) GetRegistry(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -418,11 +421,12 @@ func (siw *ServerInterfaceWrapper) GetRegistry(w http.ResponseWriter, r *http.Re
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// ModifyRegistry operation middleware
|
||||
func (siw *ServerInterfaceWrapper) ModifyRegistry(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -443,11 +447,12 @@ func (siw *ServerInterfaceWrapper) ModifyRegistry(w http.ResponseWriter, r *http
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// ListArtifactLabels operation middleware
|
||||
func (siw *ServerInterfaceWrapper) ListArtifactLabels(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -495,11 +500,12 @@ func (siw *ServerInterfaceWrapper) ListArtifactLabels(w http.ResponseWriter, r *
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetArtifactStatsForRegistry operation middleware
|
||||
func (siw *ServerInterfaceWrapper) GetArtifactStatsForRegistry(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -539,11 +545,12 @@ func (siw *ServerInterfaceWrapper) GetArtifactStatsForRegistry(w http.ResponseWr
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// DeleteArtifact operation middleware
|
||||
func (siw *ServerInterfaceWrapper) DeleteArtifact(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -573,11 +580,12 @@ func (siw *ServerInterfaceWrapper) DeleteArtifact(w http.ResponseWriter, r *http
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// UpdateArtifactLabels operation middleware
|
||||
func (siw *ServerInterfaceWrapper) UpdateArtifactLabels(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -607,11 +615,12 @@ func (siw *ServerInterfaceWrapper) UpdateArtifactLabels(w http.ResponseWriter, r
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetArtifactStats operation middleware
|
||||
func (siw *ServerInterfaceWrapper) GetArtifactStats(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -660,11 +669,12 @@ func (siw *ServerInterfaceWrapper) GetArtifactStats(w http.ResponseWriter, r *ht
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetArtifactSummary operation middleware
|
||||
func (siw *ServerInterfaceWrapper) GetArtifactSummary(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -694,11 +704,12 @@ func (siw *ServerInterfaceWrapper) GetArtifactSummary(w http.ResponseWriter, r *
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// DeleteArtifactVersion operation middleware
|
||||
func (siw *ServerInterfaceWrapper) DeleteArtifactVersion(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -737,11 +748,12 @@ func (siw *ServerInterfaceWrapper) DeleteArtifactVersion(w http.ResponseWriter,
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetArtifactDetails operation middleware
|
||||
func (siw *ServerInterfaceWrapper) GetArtifactDetails(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -791,11 +803,12 @@ func (siw *ServerInterfaceWrapper) GetArtifactDetails(w http.ResponseWriter, r *
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetDockerArtifactDetails operation middleware
|
||||
func (siw *ServerInterfaceWrapper) GetDockerArtifactDetails(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -852,11 +865,12 @@ func (siw *ServerInterfaceWrapper) GetDockerArtifactDetails(w http.ResponseWrite
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetDockerArtifactLayers operation middleware
|
||||
func (siw *ServerInterfaceWrapper) GetDockerArtifactLayers(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -913,11 +927,12 @@ func (siw *ServerInterfaceWrapper) GetDockerArtifactLayers(w http.ResponseWriter
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetDockerArtifactManifest operation middleware
|
||||
func (siw *ServerInterfaceWrapper) GetDockerArtifactManifest(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -974,11 +989,12 @@ func (siw *ServerInterfaceWrapper) GetDockerArtifactManifest(w http.ResponseWrit
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetDockerArtifactManifests operation middleware
|
||||
func (siw *ServerInterfaceWrapper) GetDockerArtifactManifests(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -1017,11 +1033,12 @@ func (siw *ServerInterfaceWrapper) GetDockerArtifactManifests(w http.ResponseWri
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetArtifactFiles operation middleware
|
||||
func (siw *ServerInterfaceWrapper) GetArtifactFiles(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -1103,11 +1120,12 @@ func (siw *ServerInterfaceWrapper) GetArtifactFiles(w http.ResponseWriter, r *ht
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetHelmArtifactDetails operation middleware
|
||||
func (siw *ServerInterfaceWrapper) GetHelmArtifactDetails(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -1146,11 +1164,12 @@ func (siw *ServerInterfaceWrapper) GetHelmArtifactDetails(w http.ResponseWriter,
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetHelmArtifactManifest operation middleware
|
||||
func (siw *ServerInterfaceWrapper) GetHelmArtifactManifest(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -1189,11 +1208,12 @@ func (siw *ServerInterfaceWrapper) GetHelmArtifactManifest(w http.ResponseWriter
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetArtifactVersionSummary operation middleware
|
||||
func (siw *ServerInterfaceWrapper) GetArtifactVersionSummary(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -1232,11 +1252,12 @@ func (siw *ServerInterfaceWrapper) GetArtifactVersionSummary(w http.ResponseWrit
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetAllArtifactVersions operation middleware
|
||||
func (siw *ServerInterfaceWrapper) GetAllArtifactVersions(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -1309,11 +1330,12 @@ func (siw *ServerInterfaceWrapper) GetAllArtifactVersions(w http.ResponseWriter,
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetAllArtifactsByRegistry operation middleware
|
||||
func (siw *ServerInterfaceWrapper) GetAllArtifactsByRegistry(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -1385,11 +1407,12 @@ func (siw *ServerInterfaceWrapper) GetAllArtifactsByRegistry(w http.ResponseWrit
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetClientSetupDetails operation middleware
|
||||
func (siw *ServerInterfaceWrapper) GetClientSetupDetails(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -1429,11 +1452,12 @@ func (siw *ServerInterfaceWrapper) GetClientSetupDetails(w http.ResponseWriter,
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// ListWebhooks operation middleware
|
||||
func (siw *ServerInterfaceWrapper) ListWebhooks(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -1497,11 +1521,12 @@ func (siw *ServerInterfaceWrapper) ListWebhooks(w http.ResponseWriter, r *http.R
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// CreateWebhook operation middleware
|
||||
func (siw *ServerInterfaceWrapper) CreateWebhook(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -1522,11 +1547,12 @@ func (siw *ServerInterfaceWrapper) CreateWebhook(w http.ResponseWriter, r *http.
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// DeleteWebhook operation middleware
|
||||
func (siw *ServerInterfaceWrapper) DeleteWebhook(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -1556,11 +1582,12 @@ func (siw *ServerInterfaceWrapper) DeleteWebhook(w http.ResponseWriter, r *http.
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetWebhook operation middleware
|
||||
func (siw *ServerInterfaceWrapper) GetWebhook(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -1590,11 +1617,12 @@ func (siw *ServerInterfaceWrapper) GetWebhook(w http.ResponseWriter, r *http.Req
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// UpdateWebhook operation middleware
|
||||
func (siw *ServerInterfaceWrapper) UpdateWebhook(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -1624,11 +1652,12 @@ func (siw *ServerInterfaceWrapper) UpdateWebhook(w http.ResponseWriter, r *http.
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// ListWebhookExecutions operation middleware
|
||||
func (siw *ServerInterfaceWrapper) ListWebhookExecutions(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -1677,11 +1706,12 @@ func (siw *ServerInterfaceWrapper) ListWebhookExecutions(w http.ResponseWriter,
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetWebhookExecution operation middleware
|
||||
func (siw *ServerInterfaceWrapper) GetWebhookExecution(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -1720,11 +1750,12 @@ func (siw *ServerInterfaceWrapper) GetWebhookExecution(w http.ResponseWriter, r
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// ReTriggerWebhookExecution operation middleware
|
||||
func (siw *ServerInterfaceWrapper) ReTriggerWebhookExecution(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -1763,11 +1794,12 @@ func (siw *ServerInterfaceWrapper) ReTriggerWebhookExecution(w http.ResponseWrit
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetArtifactStatsForSpace operation middleware
|
||||
func (siw *ServerInterfaceWrapper) GetArtifactStatsForSpace(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -1807,11 +1839,12 @@ func (siw *ServerInterfaceWrapper) GetArtifactStatsForSpace(w http.ResponseWrite
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetAllArtifacts operation middleware
|
||||
func (siw *ServerInterfaceWrapper) GetAllArtifacts(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -1899,11 +1932,12 @@ func (siw *ServerInterfaceWrapper) GetAllArtifacts(w http.ResponseWriter, r *htt
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetAllRegistries operation middleware
|
||||
func (siw *ServerInterfaceWrapper) GetAllRegistries(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -1991,7 +2025,7 @@ func (siw *ServerInterfaceWrapper) GetAllRegistries(w http.ResponseWriter, r *ht
|
|||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
type UnescapedCookieParamError struct {
|
||||
|
@ -5734,97 +5768,97 @@ func (sh *strictHandler) GetAllRegistries(w http.ResponseWriter, r *http.Request
|
|||
// Base64 encoded, gzipped, json marshaled Swagger object
|
||||
var swaggerSpec = []string{
|
||||
|
||||
"H4sIAAAAAAAC/+xd3XLbOpJ+FRZ3LxnLZya7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JOL5Rd4wsUfG8rjl1l",
|
||||
"D7PoLiWCoEn+8If1wWMNuJNlL3xtwlfNZtxLX0fpq0lC5yg2nkvxHcul+K5tsy+jNy9vxk7pgX4ZwvsI",
|
||||
"MAycJJaZ5GVWxpqAKskEj3cQ0NUK3N4CrA+3h7p9sLAJbtvgXX2ipRHjN+KBEpmByHSsVXrJ5zcI2Tzt",
|
||||
"FUNy+g2m8agATSI//4kFy2tTvUhIt0GZJwpRsh4eKSC+kq5pq3wveRtvNN1LMYsaoNgoyMEv8ddDkTPJ",
|
||||
"Lg9M0bXOp3y/8GpXO3n2MDmI3kH8QA7ijRBsSQ7Tpqo+QvLqgfR2VVRp9vQLWbYDOHjM48nho18FDwix",
|
||||
"Kgb2uQoOyk8bWimyPIFpvlem9lzTbmJUelrx6BB+uU3JzpsBNZ/0G94VlADzQngvvue/PYTBZnsxaFjZ",
|
||||
"Szl/XwH+nytkj4M9WQhvGd96OBwW3YM8tXETznkJbcbqMsKnUKS27XHe47w46zSDwoB2ll8XD36xfw+R",
|
||||
"s4sleN46DXCfaeMtZdpgWLFAaue73zZ/C3wYgE5rL3y+mcP79tLll06tBpk/YbeLCKsOHb0Ed71L7iC9",
|
||||
"qLhusxPf4n7OJL/lF6BeXoDrkLMX+k6Vfn9xR9DPEA6fdpbdPolxR9ktCU1deNnTHLQBLkbVLUvuNcIf",
|
||||
"qRiANBw8/cHmT7RVe1R8MuYvcLI7Js/J2Cmb50SUGKQSI97JUAikQNK3toBENAEUXSRaKNRTYwOO8F1x",
|
||||
"krnDIy91jdWi26zbXMJopWux4nptbk/LsufiPle0l9v4m++b/w8AAP//zFKjCD7lAAA=",
|
||||
}
|
||||
|
||||
// GetSwagger returns the content of the embedded swagger specification file
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Package artifact provides primitives to interact with the openapi HTTP API.
|
||||
//
|
||||
// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT.
|
||||
// Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT.
|
||||
package artifact
|
||||
|
||||
import (
|
||||
|
@ -31,6 +31,7 @@ const (
|
|||
PackageTypeHELM PackageType = "HELM"
|
||||
PackageTypeMAVEN PackageType = "MAVEN"
|
||||
PackageTypeNPM PackageType = "NPM"
|
||||
PackageTypeNUGET PackageType = "NUGET"
|
||||
PackageTypePYTHON PackageType = "PYTHON"
|
||||
)
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import (
|
|||
middlewareauthn "github.com/harness/gitness/app/api/middleware/authn"
|
||||
"github.com/harness/gitness/registry/app/api/handler/generic"
|
||||
"github.com/harness/gitness/registry/app/api/handler/maven"
|
||||
"github.com/harness/gitness/registry/app/api/handler/nuget"
|
||||
"github.com/harness/gitness/registry/app/api/handler/packages"
|
||||
"github.com/harness/gitness/registry/app/api/handler/python"
|
||||
"github.com/harness/gitness/registry/app/api/middleware"
|
||||
|
@ -44,6 +45,7 @@ func NewRouter(
|
|||
mavenHandler *maven.Handler,
|
||||
genericHandler *generic.Handler,
|
||||
pythonHandler python.Handler,
|
||||
nugetHandler nuget.Handler,
|
||||
) Handler {
|
||||
r := chi.NewRouter()
|
||||
|
||||
|
@ -98,6 +100,20 @@ func NewRouter(
|
|||
http.Error(w, fmt.Sprintf("Package type '%s' is not supported", packageType), http.StatusNotFound)
|
||||
})
|
||||
})
|
||||
|
||||
r.Route("/nuget", func(r chi.Router) {
|
||||
r.Use(middlewareauthn.Attempt(packageHandler.GetAuthenticator()))
|
||||
|
||||
r.With(middleware.StoreArtifactInfo(nugetHandler)).
|
||||
With(middleware.RequestPackageAccess(packageHandler, enum.PermissionArtifactsUpload)).
|
||||
Put("/", nugetHandler.UploadPackage)
|
||||
r.With(middleware.StoreArtifactInfo(nugetHandler)).
|
||||
With(middleware.RequestPackageAccess(packageHandler, enum.PermissionArtifactsDownload)).
|
||||
Get("/package/{id}/{version}/{filename}", nugetHandler.DownloadPackage)
|
||||
r.With(middleware.StoreArtifactInfo(nugetHandler)).
|
||||
With(middleware.RequestPackageAccess(packageHandler, enum.PermissionArtifactsDownload)).
|
||||
Get("/index.json", nugetHandler.GetServiceEndpoint)
|
||||
})
|
||||
})
|
||||
|
||||
return r
|
||||
|
|
|
@ -24,6 +24,7 @@ import (
|
|||
"github.com/harness/gitness/audit"
|
||||
"github.com/harness/gitness/registry/app/api/handler/generic"
|
||||
"github.com/harness/gitness/registry/app/api/handler/maven"
|
||||
"github.com/harness/gitness/registry/app/api/handler/nuget"
|
||||
hoci "github.com/harness/gitness/registry/app/api/handler/oci"
|
||||
"github.com/harness/gitness/registry/app/api/handler/packages"
|
||||
"github.com/harness/gitness/registry/app/api/handler/python"
|
||||
|
@ -116,8 +117,9 @@ func PackageHandlerProvider(
|
|||
mavenHandler *maven.Handler,
|
||||
genericHandler *generic.Handler,
|
||||
pypiHandler python.Handler,
|
||||
nugetHandler nuget.Handler,
|
||||
) packagerrouter.Handler {
|
||||
return packagerrouter.NewRouter(handler, mavenHandler, genericHandler, pypiHandler)
|
||||
return packagerrouter.NewRouter(handler, mavenHandler, genericHandler, pypiHandler, nugetHandler)
|
||||
}
|
||||
|
||||
var WireSet = wire.NewSet(APIHandlerProvider, OCIHandlerProvider, AppRouterProvider,
|
||||
|
|
|
@ -21,9 +21,11 @@ import (
|
|||
"github.com/harness/gitness/app/services/refcache"
|
||||
corestore "github.com/harness/gitness/app/store"
|
||||
urlprovider "github.com/harness/gitness/app/url"
|
||||
nuget2 "github.com/harness/gitness/registry/app/api/controller/pkg/nuget"
|
||||
python2 "github.com/harness/gitness/registry/app/api/controller/pkg/python"
|
||||
"github.com/harness/gitness/registry/app/api/handler/generic"
|
||||
mavenhandler "github.com/harness/gitness/registry/app/api/handler/maven"
|
||||
nugethandler "github.com/harness/gitness/registry/app/api/handler/nuget"
|
||||
ocihandler "github.com/harness/gitness/registry/app/api/handler/oci"
|
||||
"github.com/harness/gitness/registry/app/api/handler/packages"
|
||||
pypi2 "github.com/harness/gitness/registry/app/api/handler/python"
|
||||
|
@ -38,6 +40,7 @@ import (
|
|||
"github.com/harness/gitness/registry/app/pkg/filemanager"
|
||||
generic2 "github.com/harness/gitness/registry/app/pkg/generic"
|
||||
"github.com/harness/gitness/registry/app/pkg/maven"
|
||||
"github.com/harness/gitness/registry/app/pkg/nuget"
|
||||
"github.com/harness/gitness/registry/app/pkg/python"
|
||||
"github.com/harness/gitness/registry/app/store"
|
||||
"github.com/harness/gitness/registry/app/store/database"
|
||||
|
@ -133,6 +136,13 @@ func NewPythonHandlerProvider(
|
|||
return pypi2.NewHandler(controller, packageHandler)
|
||||
}
|
||||
|
||||
func NewNugetHandlerProvider(
|
||||
controller nuget2.Controller,
|
||||
packageHandler packages.Handler,
|
||||
) nugethandler.Handler {
|
||||
return nugethandler.NewHandler(controller, packageHandler)
|
||||
}
|
||||
|
||||
func NewGenericHandlerProvider(
|
||||
spaceStore corestore.SpaceStore, controller *generic2.Controller, tokenStore corestore.TokenStore,
|
||||
userCtrl *usercontroller.Controller, authenticator authn.Authenticator, urlProvider urlprovider.Provider,
|
||||
|
@ -156,16 +166,19 @@ var WireSet = wire.NewSet(
|
|||
NewGenericHandlerProvider,
|
||||
NewPackageHandlerProvider,
|
||||
NewPythonHandlerProvider,
|
||||
NewNugetHandlerProvider,
|
||||
database.WireSet,
|
||||
pkg.WireSet,
|
||||
docker.WireSet,
|
||||
filemanager.WireSet,
|
||||
maven.WireSet,
|
||||
nuget.WireSet,
|
||||
python.WireSet,
|
||||
router.WireSet,
|
||||
gc.WireSet,
|
||||
generic2.WireSet,
|
||||
python2.ControllerSet,
|
||||
nuget2.ControllerSet,
|
||||
base.WireSet,
|
||||
)
|
||||
|
||||
|
|
|
@ -0,0 +1,177 @@
|
|||
// Copyright 2023 Harness, Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package nuget
|
||||
|
||||
import (
|
||||
"github.com/harness/gitness/registry/app/metadata"
|
||||
)
|
||||
|
||||
var _ metadata.Metadata = (*NugetMetadata)(nil)
|
||||
|
||||
//nolint:revive
|
||||
type NugetMetadata struct {
|
||||
Metadata
|
||||
Files []metadata.File `json:"files"`
|
||||
FileCount int64 `json:"file_count"`
|
||||
}
|
||||
|
||||
func (p *NugetMetadata) GetFiles() []metadata.File {
|
||||
return p.Files
|
||||
}
|
||||
|
||||
func (p *NugetMetadata) SetFiles(files []metadata.File) {
|
||||
p.Files = files
|
||||
p.FileCount = int64(len(files))
|
||||
}
|
||||
|
||||
// Package represents the entire NuGet package.
|
||||
type Metadata struct {
|
||||
PackageMetadata PackageMetadata `json:"metadata" xml:"metadata"`
|
||||
Files *FilesWrapper `json:"files,omitempty" xml:"files,omitempty"`
|
||||
}
|
||||
|
||||
// PackageMetadata represents the metadata of a NuGet package.
|
||||
type PackageMetadata struct {
|
||||
ID string `json:"id" xml:"id"`
|
||||
Version string `json:"version" xml:"version"`
|
||||
Title string `json:"title,omitempty" xml:"title,omitempty"`
|
||||
Authors string `json:"authors" xml:"authors"`
|
||||
Owners string `json:"owners,omitempty" xml:"owners,omitempty"`
|
||||
LicenseURL string `json:"licenseUrl,omitempty" xml:"licenseUrl,omitempty"`
|
||||
ProjectURL string `json:"projectUrl,omitempty" xml:"projectUrl,omitempty"`
|
||||
IconURL string `json:"iconUrl,omitempty" xml:"iconUrl,omitempty"`
|
||||
RequireLicenseAcceptance bool `json:"requireLicenseAcceptance,omitempty" xml:"requireLicenseAcceptance,omitempty"`
|
||||
DevelopmentDependency bool `json:"developmentDependency,omitempty" xml:"developmentDependency,omitempty"`
|
||||
Description string `json:"description" xml:"description"`
|
||||
Summary string `json:"summary,omitempty" xml:"summary,omitempty"`
|
||||
ReleaseNotes string `json:"releaseNotes,omitempty" xml:"releaseNotes,omitempty"`
|
||||
Copyright string `json:"copyright,omitempty" xml:"copyright,omitempty"`
|
||||
Language string `json:"language,omitempty" xml:"language,omitempty"`
|
||||
Tags string `json:"tags,omitempty" xml:"tags,omitempty"`
|
||||
Serviceable bool `json:"serviceable,omitempty" xml:"serviceable,omitempty"`
|
||||
Icon string `json:"icon,omitempty" xml:"icon,omitempty"`
|
||||
Readme string `json:"readme,omitempty" xml:"readme,omitempty"`
|
||||
Repository *Repository `json:"repository,omitempty" xml:"repository,omitempty"`
|
||||
License *License `json:"license,omitempty" xml:"license,omitempty"`
|
||||
PackageTypes []PackageType `json:"packageTypes,omitempty" xml:"packageType"`
|
||||
Dependencies *DependenciesWrapper `json:"dependencies,omitempty" xml:"dependencies,omitempty"`
|
||||
FrameworkAssemblies []FrameworkAssembly `json:"frameworkAssemblies,omitempty" xml:"frameworkAssembly"`
|
||||
FrameworkReferences *FrameworkReferencesWrapper `json:"frameworkReferences,omitempty" xml:"frameworkReferences,omitempty"`
|
||||
References *ReferencesWrapper `json:"references,omitempty" xml:"references,omitempty"`
|
||||
ContentFiles []ContentFileEntry `json:"contentFiles,omitempty" xml:"files"`
|
||||
MinClientVersion string `json:"minClientVersion,omitempty" xml:"minClientVersion,attr"`
|
||||
}
|
||||
|
||||
// Dependency represents a package dependency.
|
||||
type Dependency struct {
|
||||
ID string `json:"id,omitempty" xml:"id,attr"`
|
||||
Version string `json:"version,omitempty" xml:"version,attr"`
|
||||
Include string `json:"include,omitempty" xml:"include,attr"`
|
||||
Exclude string `json:"exclude,omitempty" xml:"exclude,attr"`
|
||||
}
|
||||
|
||||
// DependencyGroup represents a group of dependencies.
|
||||
type DependencyGroup struct {
|
||||
TargetFramework string `json:"targetFramework,omitempty" xml:"targetFramework,attr"`
|
||||
Dependencies []Dependency `json:"dependencies,omitempty" xml:"dependency"`
|
||||
}
|
||||
|
||||
// Reference represents a package reference.
|
||||
type Reference struct {
|
||||
File string `json:"file" xml:"file,attr"`
|
||||
}
|
||||
|
||||
// ReferenceGroup represents a group of references.
|
||||
type ReferenceGroup struct {
|
||||
TargetFramework string `json:"targetFramework,omitempty" xml:"targetFramework,attr"`
|
||||
References []Reference `json:"references,omitempty" xml:"reference"`
|
||||
}
|
||||
|
||||
// FrameworkReference represents a single framework reference.
|
||||
type FrameworkReference struct {
|
||||
Name string `json:"name" xml:"name,attr"`
|
||||
}
|
||||
|
||||
// FrameworkReferenceGroup represents a group of framework references.
|
||||
type FrameworkReferenceGroup struct {
|
||||
TargetFramework string `json:"targetFramework" xml:"targetFramework,attr"`
|
||||
FrameworkReferences []FrameworkReference `json:"frameworkReferences,omitempty" xml:"frameworkReference"`
|
||||
}
|
||||
|
||||
// ContentFileEntry represents a content file entry.
|
||||
type ContentFileEntry struct {
|
||||
Include string `json:"include" xml:"include,attr"`
|
||||
Exclude string `json:"exclude,omitempty" xml:"exclude,attr"`
|
||||
BuildAction string `json:"buildAction,omitempty" xml:"buildAction,attr"`
|
||||
CopyToOutput bool `json:"copyToOutput,omitempty" xml:"copyToOutput,attr"`
|
||||
Flatten bool `json:"flatten,omitempty" xml:"flatten,attr"`
|
||||
}
|
||||
|
||||
// PackageType represents a package type.
|
||||
type PackageType struct {
|
||||
Name string `json:"name" xml:"name,attr"`
|
||||
Version string `json:"version,omitempty" xml:"version,attr"`
|
||||
}
|
||||
|
||||
// Repository represents the repository information.
|
||||
type Repository struct {
|
||||
Type string `json:"type,omitempty" xml:"type,attr"`
|
||||
URL string `json:"url,omitempty" xml:"url,attr"`
|
||||
Branch string `json:"branch,omitempty" xml:"branch,attr"`
|
||||
Commit string `json:"commit,omitempty" xml:"commit,attr"`
|
||||
}
|
||||
|
||||
// License represents a package license.
|
||||
type License struct {
|
||||
Type string `json:"type" xml:"type,attr"`
|
||||
Version string `json:"version,omitempty" xml:"version,attr"`
|
||||
//nolint:staticcheck
|
||||
Text string `json:",chardata" xml:",chardata"`
|
||||
}
|
||||
|
||||
// FrameworkAssembly represents a framework assembly reference.
|
||||
type FrameworkAssembly struct {
|
||||
AssemblyName string `json:"assemblyName" xml:"assemblyName,attr"`
|
||||
TargetFramework string `json:"targetFramework,omitempty" xml:"targetFramework,attr"`
|
||||
}
|
||||
|
||||
// DependenciesWrapper represents the `<dependencies>` section.
|
||||
type DependenciesWrapper struct {
|
||||
Dependencies []Dependency `json:"dependencies,omitempty" xml:"dependency"`
|
||||
Groups []DependencyGroup `json:"groups,omitempty" xml:"group"`
|
||||
}
|
||||
|
||||
// ReferencesWrapper represents the `<references>` section.
|
||||
type ReferencesWrapper struct {
|
||||
References []Reference `json:"references,omitempty" xml:"reference"`
|
||||
Groups []ReferenceGroup `json:"groups,omitempty" xml:"group"`
|
||||
}
|
||||
|
||||
// FrameworkReferencesWrapper represents the `<frameworkReferences>` section.
|
||||
type FrameworkReferencesWrapper struct {
|
||||
Groups []FrameworkReferenceGroup `json:"groups,omitempty" xml:"group"`
|
||||
}
|
||||
|
||||
// File represents an individual file in the `<files>` section.
|
||||
type File struct {
|
||||
Src string `json:"src" xml:"src,attr"`
|
||||
Target string `json:"target,omitempty" xml:"target,attr"`
|
||||
Exclude string `json:"exclude,omitempty" xml:"exclude,attr"`
|
||||
}
|
||||
|
||||
// FilesWrapper represents the `<files>` section.
|
||||
type FilesWrapper struct {
|
||||
Files []File `json:"files,omitempty" xml:"file"`
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
// Copyright 2023 Harness, Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package nuget
|
||||
|
||||
import "github.com/harness/gitness/registry/app/pkg/types/nuget"
|
||||
|
||||
func buildServiceEndpoint(baseURL string) *nuget.ServiceEndpoint {
|
||||
return &nuget.ServiceEndpoint{
|
||||
Version: "3.0.0",
|
||||
Resources: []nuget.Resource{
|
||||
{
|
||||
ID: baseURL + "/query",
|
||||
Type: "SearchQueryService",
|
||||
},
|
||||
{
|
||||
ID: baseURL + "/registration",
|
||||
Type: "RegistrationsBaseUrl",
|
||||
},
|
||||
{
|
||||
ID: baseURL + "/package",
|
||||
Type: "PackageBaseAddress/3.0.0",
|
||||
},
|
||||
{
|
||||
ID: baseURL,
|
||||
Type: "PackagePublish/2.0.0",
|
||||
},
|
||||
{
|
||||
ID: baseURL + "/symbolpackage",
|
||||
Type: "SymbolPackagePublish/4.9.0",
|
||||
},
|
||||
{
|
||||
ID: baseURL + "/query",
|
||||
Type: "SearchQueryService/3.0.0-rc",
|
||||
},
|
||||
{
|
||||
ID: baseURL + "/registration",
|
||||
Type: "RegistrationsBaseUrl/3.0.0-rc",
|
||||
},
|
||||
{
|
||||
ID: baseURL + "/query",
|
||||
Type: "SearchQueryService/3.0.0-beta",
|
||||
},
|
||||
{
|
||||
ID: baseURL + "/registration",
|
||||
Type: "RegistrationsBaseUrl/3.0.0-beta",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
|
@ -0,0 +1,209 @@
|
|||
// Copyright 2023 Harness, Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package nuget
|
||||
|
||||
import (
|
||||
"archive/zip"
|
||||
"context"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
urlprovider "github.com/harness/gitness/app/url"
|
||||
"github.com/harness/gitness/registry/app/api/openapi/contracts/artifact"
|
||||
nugetmetadata "github.com/harness/gitness/registry/app/metadata/nuget"
|
||||
"github.com/harness/gitness/registry/app/pkg"
|
||||
"github.com/harness/gitness/registry/app/pkg/base"
|
||||
"github.com/harness/gitness/registry/app/pkg/commons"
|
||||
"github.com/harness/gitness/registry/app/pkg/filemanager"
|
||||
nugettype "github.com/harness/gitness/registry/app/pkg/types/nuget"
|
||||
"github.com/harness/gitness/registry/app/storage"
|
||||
"github.com/harness/gitness/registry/app/store"
|
||||
"github.com/harness/gitness/registry/types"
|
||||
"github.com/harness/gitness/store/database/dbtx"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
var _ pkg.Artifact = (*localRegistry)(nil)
|
||||
var _ Registry = (*localRegistry)(nil)
|
||||
|
||||
var IDMatch = regexp.MustCompile(`\A\w+(?:[.-]\w+)*\z`)
|
||||
|
||||
type PackageType int
|
||||
|
||||
const (
|
||||
// DependencyPackage represents a package (*.nupkg).
|
||||
DependencyPackage PackageType = iota + 1
|
||||
// SymbolsPackage represents a symbol package (*.snupkg).
|
||||
SymbolsPackage
|
||||
)
|
||||
|
||||
type localRegistry struct {
|
||||
localBase base.LocalBase
|
||||
fileManager filemanager.FileManager
|
||||
proxyStore store.UpstreamProxyConfigRepository
|
||||
tx dbtx.Transactor
|
||||
registryDao store.RegistryRepository
|
||||
imageDao store.ImageRepository
|
||||
artifactDao store.ArtifactRepository
|
||||
urlProvider urlprovider.Provider
|
||||
}
|
||||
|
||||
func (c *localRegistry) GetServiceEndpoint(ctx context.Context,
|
||||
info nugettype.ArtifactInfo) *nugettype.ServiceEndpoint {
|
||||
baseURL := c.urlProvider.RegistryURL(ctx, "pkg", info.RootIdentifier, info.RegIdentifier, "nuget")
|
||||
serviceEndpoints := buildServiceEndpoint(baseURL)
|
||||
return serviceEndpoints
|
||||
}
|
||||
|
||||
func (c *localRegistry) UploadPackage(ctx context.Context,
|
||||
info nugettype.ArtifactInfo,
|
||||
fileReader io.ReadCloser,
|
||||
) (headers *commons.ResponseHeaders, sha256 string, err error) {
|
||||
metadata, err := c.buildMetadata(info, fileReader)
|
||||
if err != nil {
|
||||
return headers, "", err
|
||||
}
|
||||
fileName := strings.ToLower(fmt.Sprintf("%s.%s.nupkg",
|
||||
metadata.PackageMetadata.ID, metadata.PackageMetadata.Version))
|
||||
info.Metadata = metadata
|
||||
info.Filename = fileName
|
||||
info.Version = metadata.PackageMetadata.Version
|
||||
info.Image = metadata.PackageMetadata.ID
|
||||
path := info.Image + "/" + info.Version + "/" + fileName
|
||||
|
||||
return c.localBase.Upload(ctx, info.ArtifactInfo, fileName, info.Version, path, fileReader,
|
||||
&nugetmetadata.NugetMetadata{
|
||||
Metadata: info.Metadata,
|
||||
})
|
||||
}
|
||||
|
||||
func (c *localRegistry) buildMetadata(info nugettype.ArtifactInfo,
|
||||
fileReader io.Reader) (metadata nugetmetadata.Metadata, err error) {
|
||||
pathUUID := uuid.NewString()
|
||||
tmpFile, err2 := os.CreateTemp(os.TempDir(), info.RootIdentifier+"-"+pathUUID+"*")
|
||||
if err2 != nil {
|
||||
return metadata, err2
|
||||
}
|
||||
defer os.Remove(tmpFile.Name()) // Cleanup
|
||||
|
||||
_, err2 = io.Copy(tmpFile, fileReader)
|
||||
if err2 != nil {
|
||||
return metadata, err2
|
||||
}
|
||||
_, err = tmpFile.Seek(0, 0)
|
||||
if err != nil {
|
||||
return nugetmetadata.Metadata{}, err
|
||||
}
|
||||
|
||||
stat, err2 := tmpFile.Stat()
|
||||
if err2 != nil {
|
||||
return metadata, err2
|
||||
}
|
||||
|
||||
archive, err2 := zip.NewReader(tmpFile, stat.Size())
|
||||
if err2 != nil {
|
||||
return metadata, err2
|
||||
}
|
||||
|
||||
for _, file := range archive.File {
|
||||
if filepath.Dir(file.Name) != "." {
|
||||
continue
|
||||
}
|
||||
if strings.HasSuffix(strings.ToLower(file.Name), ".nuspec") {
|
||||
f, err3 := archive.Open(file.Name)
|
||||
if err3 != nil {
|
||||
return metadata, err3
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
metadata, err = c.parseMetadata(f)
|
||||
return metadata, err
|
||||
}
|
||||
}
|
||||
return metadata, nil
|
||||
}
|
||||
|
||||
func (c *localRegistry) parseMetadata(f io.Reader) (metadata nugetmetadata.Metadata, err error) {
|
||||
var p nugetmetadata.Metadata
|
||||
if err = xml.NewDecoder(f).Decode(&p); err != nil {
|
||||
return metadata, err
|
||||
}
|
||||
|
||||
if !IDMatch.MatchString(p.PackageMetadata.ID) {
|
||||
return metadata, fmt.Errorf("invalid package id: %s", p.PackageMetadata.ID)
|
||||
}
|
||||
return p, nil
|
||||
}
|
||||
|
||||
func (c *localRegistry) DownloadPackage(ctx context.Context,
|
||||
info nugettype.ArtifactInfo) (*commons.ResponseHeaders, *storage.FileReader, string, error) {
|
||||
responseHeaders := &commons.ResponseHeaders{
|
||||
Headers: make(map[string]string),
|
||||
Code: 0,
|
||||
}
|
||||
|
||||
path := "/" + info.Image + "/" + info.Version + "/" + info.Filename
|
||||
|
||||
fileReader, _, redirectURL, err := c.fileManager.DownloadFile(ctx, path, types.Registry{
|
||||
ID: info.RegistryID,
|
||||
Name: info.RegIdentifier,
|
||||
}, info.RootIdentifier)
|
||||
if err != nil {
|
||||
return responseHeaders, nil, "", err
|
||||
}
|
||||
responseHeaders.Code = http.StatusOK
|
||||
return responseHeaders, fileReader, redirectURL, nil
|
||||
}
|
||||
|
||||
type LocalRegistry interface {
|
||||
Registry
|
||||
}
|
||||
|
||||
func NewLocalRegistry(
|
||||
localBase base.LocalBase,
|
||||
fileManager filemanager.FileManager,
|
||||
proxyStore store.UpstreamProxyConfigRepository,
|
||||
tx dbtx.Transactor,
|
||||
registryDao store.RegistryRepository,
|
||||
imageDao store.ImageRepository,
|
||||
artifactDao store.ArtifactRepository,
|
||||
urlProvider urlprovider.Provider,
|
||||
) LocalRegistry {
|
||||
return &localRegistry{
|
||||
localBase: localBase,
|
||||
fileManager: fileManager,
|
||||
proxyStore: proxyStore,
|
||||
tx: tx,
|
||||
registryDao: registryDao,
|
||||
imageDao: imageDao,
|
||||
artifactDao: artifactDao,
|
||||
urlProvider: urlProvider,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *localRegistry) GetArtifactType() artifact.RegistryType {
|
||||
return artifact.RegistryTypeVIRTUAL
|
||||
}
|
||||
|
||||
func (c *localRegistry) GetPackageTypes() []artifact.PackageType {
|
||||
return []artifact.PackageType{artifact.PackageTypeNUGET}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
// Copyright 2023 Harness, Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package nuget
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
|
||||
"github.com/harness/gitness/registry/app/pkg"
|
||||
"github.com/harness/gitness/registry/app/pkg/commons"
|
||||
"github.com/harness/gitness/registry/app/pkg/types/nuget"
|
||||
"github.com/harness/gitness/registry/app/storage"
|
||||
)
|
||||
|
||||
type Registry interface {
|
||||
pkg.Artifact
|
||||
|
||||
UploadPackage(
|
||||
ctx context.Context,
|
||||
info nuget.ArtifactInfo,
|
||||
fileReader io.ReadCloser,
|
||||
) (*commons.ResponseHeaders, string, error)
|
||||
|
||||
DownloadPackage(ctx context.Context, info nuget.ArtifactInfo) (
|
||||
*commons.ResponseHeaders,
|
||||
*storage.FileReader,
|
||||
string,
|
||||
error,
|
||||
)
|
||||
|
||||
GetServiceEndpoint(ctx context.Context, info nuget.ArtifactInfo) *nuget.ServiceEndpoint
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
// Copyright 2023 Harness, Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package nuget
|
||||
|
||||
import (
|
||||
urlprovider "github.com/harness/gitness/app/url"
|
||||
"github.com/harness/gitness/registry/app/pkg/base"
|
||||
"github.com/harness/gitness/registry/app/pkg/filemanager"
|
||||
"github.com/harness/gitness/registry/app/store"
|
||||
"github.com/harness/gitness/store/database/dbtx"
|
||||
|
||||
"github.com/google/wire"
|
||||
)
|
||||
|
||||
func LocalRegistryProvider(
|
||||
localBase base.LocalBase,
|
||||
fileManager filemanager.FileManager,
|
||||
proxyStore store.UpstreamProxyConfigRepository,
|
||||
tx dbtx.Transactor,
|
||||
registryDao store.RegistryRepository,
|
||||
imageDao store.ImageRepository,
|
||||
artifactDao store.ArtifactRepository,
|
||||
urlProvider urlprovider.Provider,
|
||||
) LocalRegistry {
|
||||
registry := NewLocalRegistry(localBase, fileManager, proxyStore, tx, registryDao, imageDao, artifactDao,
|
||||
urlProvider)
|
||||
base.Register(registry)
|
||||
return registry
|
||||
}
|
||||
|
||||
var WireSet = wire.NewSet(LocalRegistryProvider)
|
|
@ -0,0 +1,60 @@
|
|||
// Copyright 2023 Harness, Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package nuget
|
||||
|
||||
import (
|
||||
"github.com/harness/gitness/registry/app/metadata/nuget"
|
||||
"github.com/harness/gitness/registry/app/pkg"
|
||||
)
|
||||
|
||||
type ArtifactInfo struct {
|
||||
pkg.ArtifactInfo
|
||||
Version string
|
||||
Filename string
|
||||
Metadata nuget.Metadata
|
||||
}
|
||||
|
||||
// BaseArtifactInfo implements pkg.PackageArtifactInfo interface.
|
||||
func (a ArtifactInfo) BaseArtifactInfo() pkg.ArtifactInfo {
|
||||
return a.ArtifactInfo
|
||||
}
|
||||
|
||||
func (a ArtifactInfo) GetImageVersion() (exists bool, imageVersion string) {
|
||||
if a.Image != "" && a.Version != "" {
|
||||
return true, pkg.JoinWithSeparator(":", a.Image, a.Version)
|
||||
}
|
||||
return false, ""
|
||||
}
|
||||
|
||||
type File struct {
|
||||
FileURL string
|
||||
Name string
|
||||
}
|
||||
|
||||
type PackageMetadata struct {
|
||||
Name string
|
||||
Files []File
|
||||
}
|
||||
|
||||
type ServiceEndpoint struct {
|
||||
Version string `json:"version"`
|
||||
Resources []Resource `json:"resources"`
|
||||
}
|
||||
|
||||
type Resource struct {
|
||||
//nolint:revive
|
||||
ID string `json:"@id"`
|
||||
Type string `json:"@type"`
|
||||
}
|
Loading…
Reference in New Issue