nugetresource

package module
v0.0.0-...-0498797 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2018 License: MIT Imports: 6 Imported by: 0

README

Build Status

Nuget Resource

Pushes, downloads, extracts dotnet core libraries and applications to and from a nuget feed.

Source Configuration

  • nuget_source: Required. URL for nuget feed, only v3 API's are currently supported.

  • nuget_apikey: Required. Nuget server API Key.

  • nuget_timeout: Optional. The timeout for pushing packages to nuget, defaults to 300 seconds.

  • package_Id: Required for Check. Package Name or PackageID as defined in the nuspec or csproj.

  • prerelease: Optional. Whether the package is prerelease or not

Behavior

check: Detect a new version of a package

Requires the package_id and prerelease and nuget details in the source.

Resource:

resource_types:
  - name: nuget
    type: docker-image
    source:
      repository: miclip/nuget-resource
      tag: "latest"

resources:
  - name: nuget-get
    type: nuget 
    source:
      nuget_source: https://www.nuget.org/F/myfeed/api/v3/index.json
      nuget_apikey: {{nuget_apikey}}
      package_id: NugetResource.TestApplication
      prerelease: true

Job:

  name: deploy-service
  public: true
  serial: true
  plan:
  - get: nuget-get
    trigger: true
  - put: cf-resource
    params:
      manifest: nuget-get/manifest.yml
      path: nuget-get/
in: Fetch a package from nuget.

Downloads and unpacks the package into the output of the resource.

out: Push a package.

Given a package the resource will push it to the nuget feed.

Parameters
  • package_path: Required. Path to package file (nupkg)

  • nuget_cache_delay: Optional. Delay to wait between pushing the package and checking latest version. Some feeds like myget.com are cached.

Example Configuration

Resource Type
- name: nuget
  type: docker-image
  source:
    repository: miclip/nuget-resource
    tag: "latest"
Resource
- name: nuget-out
  type: nuget 
  source:
    nuget_source: https://www.nuget.org/F/myfeed/api/v3/index.json
    nuget_apikey: {{nuget_apikey}}
    package_id: NugetResource.TestApplication
    prerelease: true
Job
- name: build-service
  public: true
  serial: true
  plan:
  - get: app-repo
    trigger: true
  - task: build-and-pkg
    file: app-repo/ci/tasks/build.yml
  - put: nuget-out
    params: 
      package_path: build-output/*.nupkg

Development

Prerequisites
  • golang is required - version 1.11.x is tested; earlier versions may also work.
  • docker is required - version 18.06.x is tested; earlier versions may also work.
  • dep is used for dependency management of the golang packages.
Running the tests

The tests have been embedded with the Dockerfile; ensuring that the testing environment is consistent across any docker enabled platform. When the docker image builds, the test are run inside the docker container, on failure they will stop the build.

Run the tests with the following command:

docker build -t nuget-resource .
Examples

Dotnet core MVC Application with tests:

https://github.com/miclip/nuget-resource-test-application

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChmodAllFiles

func ChmodAllFiles(directory string, mode os.FileMode)

func Fatal

func Fatal(doing string, err error)

func MakeZip

func MakeZip(zipName string, files []string) error

MakeZip creates a zip archive file

func Sayf

func Sayf(message string, args ...interface{})

func UnarchiveZip

func UnarchiveZip(zipName string, destination string) error

UnarchiveZip ...

Types

type MetadataPair

type MetadataPair struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type Source

type Source struct {
	NugetSource  string `json:"nuget_source"`
	NugetAPIKey  string `json:"nuget_apikey"`
	NugetTimeout int    `json:"nuget_timeout"`
	PackageID    string `json:"package_Id"`
	PreRelease   bool   `json:"prerelease"`
}

func (Source) IsValid

func (source Source) IsValid() (bool, string)

type Version

type Version struct {
	PackageID string `json:"package_id"`
	Version   string `json:"version"`
}

Directories

Path Synopsis
cmd
check command
in command
out command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL