Git Product home page Git Product logo

repositorytools's Introduction

CI Build Fundraising

Python API and command-line interface for working with Sonatype Nexus

How to install

pip install repositorytools

Some command line examples

Preparing env. variables

export REPOSITORY_URL=https://repo.example.com
export REPOSITORY_USER=admin
export REPOSITORY_PASSWORD=mysecretpassword

Uploading an artifact

artifact upload foo-1.2.3.ext releases com.fooware

Resolving artifact's URL

artifact resolve com.fooware:foo:latest

Deleting artifacts

# by url
artifact delete https://repo.example.com/content/repositories/releases/com/fooware/foo/1.2.3/foo-1.2.3.ext

# by coordinates
artifact resolve com.fooware:foo:latest | xargs artifact delete

Working with staging repositories

Nexus Professional only

repo create -h
repo close -h
repo release -h
repo drop -h
repo list -h

Working with custom maven metadata

Nexus Professional only

artifact get-metadata -h
artifact set-metadata -h

Some library examples

For most of methods the same env. variables as above have to be exported or specified in call of repository_client_factory()

Uploading artifacts

import repositorytools

artifact = repositorytools.LocalArtifact(local_path='~/foo-1.2.3.jar', group='com.fooware')
client = repositorytools.repository_client_factory(user='admin', password='myS3cr3tPasswOrd')
remote_artifacts = client.upload_artifacts(local_artifacts=[artifact], repo_id='releases')
print(remote_artifacts)

Resolving artifacts

Works even without authentication.

import repositorytools

artifact = repositorytools.RemoteArtifact.from_repo_id_and_coordinates('test', 'com.fooware:foo:1.2.3')
client = repositorytools.repository_client_factory()
client.resolve_artifact(artifact)
print(artifact.url)

Deleting artifacts

import repositorytools

artifact = repositorytools.RemoteArtifact.from_repo_id_and_coordinates('test', 'com.fooware:foo:1.2.3')
client = repositorytools.repository_client_factory(user='admin', password='myS3cr3tPasswOrd')
client.resolve_artifact(artifact)
client.delete_artifact(artifact.url)

Documentation

is on http://repositorytools.readthedocs.org/en/latest/

Support

You can support my effort many ways:

repositorytools's People

Contributors

tantale avatar

Watchers

James Cloos avatar Allen Bhuiyan avatar

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.