Coder Social home page Coder Social logo

miclip / nuget-resource Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 3.0 103.69 MB

Concourse resource that pushes, downloads, extracts dotnet core libraries and applications to and from a nuget feed.

License: MIT License

Dockerfile 2.59% Shell 0.68% Go 96.73%
concourse-resource nuget nuget-packages dotnet

nuget-resource's Issues

DownloadPackage fails if 'PackageBaseAddress/3.0.0' API endpoint does not have a trailing slash

The issue appears to be that the string concatenation in the line below assumes that downloadUrl will always have a trailing slash:

req, err := http.NewRequest(http.MethodGet, downloadURL+queryParams, nil)

This is true for https://api.nuget.org/v3/index.json, but from what I can tell, a trailing slash isn't required in the service index documentation --even though one is included in their sample.

In particular, BaGet does not include a trailing slash in the service index it creates, and nuget-resource fails to unarchive a package after generating a download request similar to the one below for a package with ID "MyPackageName" and version 0.1.0:

GET /v3/packageMyPackageName/0.1.0/MyPackageName.0.1.0.nupkg

NuGet publish fails on Nexus host because code does not use HTTPS

Using your resource fails for me because of the following error:

packagepath: /tmp/build/put/rf-exceptions/bin/Release2022/12/21 10:44:14 error getting publish url from apierror getting Service Index 401
Please note: There's also an error in the string output concatenation.

This is because the custom host that I'm trying to publish to is a Nexus repository, which declines HTTP methods and requires HTTPS instead.

I believe this is due to your code:

func (client *nugetclientv3) GetServiceIndex(ctx context.Context) (*ServiceIndex, error) {

	req, err := http.NewRequest(http.MethodGet, client.FeedURL, nil)
	if err != nil {
		return nil, err
	}
	req = req.WithContext(ctx)
	req.Header.Add("accept", "application/json")
	var netClient = &http.Client{
		Timeout: 10 * time.Second,
	}
	res, err := netClient.Do(req)
	if err != nil {
		return nil, err
	}
	if res.StatusCode != 200 {
		return nil, fmt.Errorf("error getting Service Index %d", res.StatusCode)
	}
	defer res.Body.Close()

	var r ServiceIndex
	if err := json.NewDecoder(res.Body).Decode(&r); err != nil {
		return nil, err
	}
	return &r, nil
}

I'm not very familiar with go, so I might be wrong about the code part, but using HTTP for nexus repositories will not work, according to https://stackoverflow.com/questions/68370067/gradle-error-when-deploying-to-nexus-repository which explains the error.

When using the NuGet CLI manually, I can successfully push to the repository.

In the resource, I am providing a URI with HTTPS, so there's no wrong configuration on my side.
The API key is the same that I used manually in CLI.

Also, is this project still alive? There hasn't been much activity since years.

Where are the configuration files?

The readme show what appears to be part of a yaml sample configuration but provides no explanation as to where this code goes. Is this one or many configuration files? Which directory are they copied to in the container? Did I overlook a file in this repository that provides the configuration file?

Issue Could not find PackageBaseAddress/3.0.0 Endpoint after successful publish

Hello, when I try to push out the package it successfully uploads it to our nuget repo and then it fails on a second step.

The code:

  - name: nuget-out
    type: nuget 
    source:
      nuget_source: {{nuget-source}}
      nuget_apikey: {{nuget-api-key}}
      package_id: {{package-id}}
      prerelease: true
    - put: nuget-out
      params: 
        package_path: build-output/*.nupkg

Error:

failed to get download url from api
Could not find PackageBaseAddress/3.0.0 Endpoint

It seems that our nuget repo does not have the PackageBaseAddress Endpoint.
Is there any way to skip this download?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.