Coder Social home page Coder Social logo

ryantheallmighty / docker-hub-api Goto Github PK

View Code? Open in Web Editor NEW
72.0 72.0 28.0 197 KB

Docker Hub API is a API library written for NodeJS to access the official Docker Hub/Registry

License: GNU General Public License v3.0

JavaScript 99.96% Dockerfile 0.04%

docker-hub-api's Introduction

Hi ๐Ÿ‘‹, I'm Ryan Dowling

A full stack software engineer in Melbourne, Australia, working with the latest technologies in both the front end and back end space

ย ryantheallmighty

ryandowlingau ryantheallmighty ryanallmighty1

docker-hub-api's People

Contributors

borales avatar ryantheallmighty avatar strarsis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

docker-hub-api's Issues

User account sign up

Can we use this package to create a brand new user account - set new username and password?

Attaching repo to github for builds

I am creating a Docker Helper Service that will, in addition to other things, create a private docker repo on Docker Cloud Service on the behalf of the user and build and store his image in this repo. The user will have granted OAuth access to their Github repo [contains DockerFile] to the Helper service [And not to Docker Cloud Service Repo directly].

Two questions:

  1. Can I build an image without linking Docker CLoud Service repo to user's Github repo like using an S3 bucket as a source?
  2. Can I connect the two repos - Docker Cloud Service and User's Github - via an API?

Fix package entrypoint.

See PR #6 .

EDIT: Apparently lib/ is also used in the tests.
Build artifacts missing in published package instead?

Move documentation to wiki

As title states, the documentation is all in the README.md and can be a bit messy to read, I wish to move it to the repositories wiki for easier reading of the README.md and the documentation.

Restructuring of the modules source

Hey Ryan,

I looked at the source of the package and felt that the structure of the code could be improved a bit.
Would you be open to suggestions or PR's to improve the structure? :)

cannot get top repositories from official user `library`

At this line: https://github.com/RyanTheAllmighty/Docker-Hub-API/blob/develop/src/api.js#L762

        /**
         * Gets the details about a repository.
         *
         * @param {String} [username] - the username of the repository to get information about. If left out or '_' is provided then it will query the official Docker repository with the given name
         * @param {String} name - the name of the repository to get information about
         * @returns {Promise}
         */
        repository: function (username, name) {
            // If no name is passed in, then the user wants an official repository
            if (username && !name) {
                name = username;
                username = 'library';
            }

            // If username is '_' then we're trying to get an official repository
            if (username === '_') {
                username = 'library';
            }

            // Make sure the username is all lowercase as per Docker Hub requirements
            username = username.toLowerCase();

            return this.makeGetRequest(`repositories/${username}/${name}`);
        },

Here:

            if (username && !name) {
                name = username;
                username = 'library';
            }

In your case, if I give dockerHubApi.repository('_'), the actual request is repositories/library/_, which is expecting error.

I think should be:

            if (!username && !name) { // here, should be, !username && !name
                name ='';
                username = 'library';
            }

Are these official APIs?

I could not find official documentation from DockerHub for these APIs. I believe you have inspected the APIs the DockerHub UI uses and implemented this library.
Am I right? If yes, then there is no official support for these APIs either. DockerHub has no official support for them and the library will break if and when they decide to change the APIs. Correct?

Docker Hub Personal Token Auth error

This is in reference to SISheogorath/readme-to-dockerhub#95

I was using his implementation of your API and when using the dockers new personal-token login it will not authenticate.

An excerpt from his code.

(node:1) UnhandledPromiseRejectionWarning: Error: {"detail":"access to the resource is forbidden with personal access token"}
    at Object.<anonymous> (/app/node_modules/docker-hub-api/src/api.js:1428:47)
    at Request.self.callback (/app/node_modules/request/request.js:185:22)
    at Request.emit (events.js:321:20)
    at Request.<anonymous> (/app/node_modules/request/request.js:1161:10)
    at Request.emit (events.js:321:20)
    at IncomingMessage.<anonymous> (/app/node_modules/request/request.js:1083:12)
    at Object.onceWrapper (events.js:427:28)
    at IncomingMessage.emit (events.js:333:22)
    at endReadableNT (_stream_readable.js:1201:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

createAutomatedbuild return error

Hi
I use this awesome tool for create automated build.
But when I create repository, It returns error. (Static repository great works)

I use bitbucket and use below code for create my repository, but body.details returns '{ build_tags: [ 'This field is required.' ] }'

let dockerHubAPI = require('docker-hub-api');
dockerHubAPI.login(process.env.USER_NAME, process.env.USER_PASSWD).then(function(info) {
console.log(info); //Logins OK
});

//After Log in
var details={ 'build_tags': [ { 'name': 'latest', 'source_type': 'Branch', 'source_name': 'master', 'dockerfile_location': '/' } ], 'description': 'test', 'is_private': false, 'provider': 'bitbucket', 'vcs_repo_name': 'username/repository' }; //For create basic build option
dockerHubAPI.createAutomatedBuild('myaccount', 'test', details).then(function(resolve,reject) {
console.log(reject);
console.log(resolve);
}).catch((error) => {
    console.log(error);
    error;
});

I was give build_tags and according to manual, it can void (then set default).

Is this docker-hub-api or docker-hub bug? Other wise my config fault?

saveBuildTag(...) is missing

Despite being documented in README and also available by Dockerhub API,
the method saveBuildTag(...) doesn't seem to be implemented yet.

Trigger build without creating it

It is also possible to trigger a build in Docker Hub web UI without creating it first.
This is especially useful with docker/hub-feedback#520 not resolved yet.
Otherwise the build has to be created first, triggered and then removed again.
This would also increase the Web UI feature vs API parity.

Support for organisation teams

Does this library support operations for managing teams in a specific organization?

I can't see that in the documentation of the code, thanks

Add constants for build status

Adding constants for the build status codes to docker-hub-api
would make code more self-documentary:

[...]
if(build.status == dockerHubAPI.BUILD_STATUS_SUCCEEDED) {
[...]
if(build.status == dockerHubAPI.BUILD_STATUS_FAILED) {
[...]

Build settings is not working

dockerHubAPI.buildSettings(username, repository) is not working. It always returns

(node:36992) UnhandledPromiseRejectionWarning: Error: {"detail":"Object not found"}

[docs] Minor syntax issue

In Docker-Hub-API documentation (README file), the commas are missing
for the example object samples (Title "Passing in an object with the details:").

Delete Tags Not Working

Deleting tags is not working for me. I think the issue is that the URL isn't correct for the current Docker Hub API.

this.makeDeleteRequest(`repositories/${username}/${name}/autobuild/tags/${id}`).then(resolve).catch(reject);

repositories/${username}/${name}/autobuild/tags/${id}

...is the URL being called. I changed it to:

repositories/${username}/${name}/tags/${id}

...and was able to get it working, but only after also changing id to be the name of the tag instead of the ID.

Hopefully this helps. Or maybe I'm the only person experiencing this issue.

detail response is handled as an error without checking the error value

When a request returns detail, the API returns this as an error, which isn't always the case. It should check the error value.

A response with detail typical looks like this:

{"detail": "some message", "error": false}

I think that the code that parses this should check if error is true/false before rejecting it as an error.

Looking for a maintainer

Hi all,

I no longer use this library personally anymore, and as such it's gone into disrepair.

I'd love to transfer the npm package and repo (if wanted) to someone else who uses it and would actively update and maintain the package.

Please let me know here if you're interested and how you're currently using the package so I can forward it on to someone.

Thanks

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.