Giter Site home page Giter Site logo

repo-info-tools's Introduction

Docker Repo-info builder, pure bash for simplicity.

A simple as possible scripts to automate the generation of Docker metadata directory known as "repo-info"

The drib name came from the initials: "Docker repo-info builder"

How to use it

Are you using GNU/Linux right? (this is linux only, sorry.)

You can follow this simple steps:

  • Create the repo-info folder in the place you need it.
  • Copy the drib.sh (only this file) to the repo-info folder you just created.(You can do this step by getting the raw file from github, see how below)
  • Change to the created folder and give exec right to the file:
$ chmod +x drib.sh
  • Now run it, lets assume that you want to create the metadata folder for the skycoin/skycoindev-cli with the tag develop let's see:
$ ./drib.sh skycoin/skycoindev-cli:develop
Ready to process the repo-info for 'skycoin/skycoindev-cli => skycoin/skycoindev-cli'.
Getting remote info...
Got token from: https://auth.docker.io/token
Get remote digest: sha256:f078698f17c9fb74151b5e63aa6a959505f27fba1af95378ce760c91f0d7ea2a
Got image config
Parsing remote data to /home/cat/github/repo-info/remote/develop.md
Done remote.
Getting local info...
Pulling the image from docker hub
develop: Pulling from skycoin/skycoindev-cli
Digest: sha256:dc32d9062d9bee86d3d9ad5230ec6022068794af8029c926595892904900b02f
Status: Image is up to date for skycoin/skycoindev-cli:develop
Parsing local data to /home/cat/github/repo-info/local/develop.md
Done local.
All Done, thank you.

Now you can check your fs to see the created files/folders, you will have a README.md and two folders named local & remote. Now you can remove the drib.sh file if you like or let it be for future updates.

Search & process all tags for a given image

Imagine you are the maintainer of a group of docker images for a project in a public repository (Docker Hub, but can be others) with just different tags...

How wonderful will be if you can make the repo-info for all tags in the repository for a given image name?

Wonder no more: move to your desired folder run it with two special arguments '-a' and your image name (in this case skycoin/skycoindev-cli)

$ ./drib.sh -a skycoin/skycoindev-cli
Found the following tags:
TAGS: develop dind
Processing tag: develop
Getting remote info...
Got token from: https://auth.docker.io/token
Get remote digest: sha256:f078698f17c9fb74151b5e63aa6a959505f27fba1af95378ce760c91f0d7ea2a
Got image config
Parsing remote data to /home/cat/github/remote/develop.md
Done remote.
Getting local info...
Pulling the image from docker hub
develop: Pulling from skycoin/skycoindev-cli
Digest: sha256:dc32d9062d9bee86d3d9ad5230ec6022068794af8029c926595892904900b02f
Status: Image is up to date for skycoin/skycoindev-cli:develop
Parsing local data to /home/cat/github/local/develop.md
Done local.
All Done, thank you.
Processing tag: dind
Getting remote info...
Got token from: https://auth.docker.io/token
Get remote digest: sha256:059f9228a6dfe11c08e475b383cd851edbbb2d11ee766cc4067e329f3b6ce5c2
Got image config
Parsing remote data to /home/cat/github/remote/dind.md
Done remote.
Getting local info...
Pulling the image from docker hub
dind: Pulling from skycoin/skycoindev-cli
Digest: sha256:0fe7e94109f07dbb6d2840e13bb660be50cef87b11999c47354ec2c36945423c
Status: Image is up to date for skycoin/skycoindev-cli:dind
Parsing local data to /home/cat/github/local/dind.md
Done local.
All Done, thank you.

Troubles?

If you get in troubles with it or manages to crash it, please search your problem to see if it was already reported and, if not, then file an issue .

Good to Know

The basic syntax of the command line is

$ ./drib.sh <local_image[:local_tag]> [remote_image[:remote-tag]]

As you see the only needed parameter is the local image, the tags are assumes as 'latest' is not specified.

Also note that you can run it with different local and remote image names and also tags.

The search and process all tags command line syntax is like this

$ ./drib.sh -a <repository>

In this case all options are mandatory and 'repository' refers to a docker hub registry entry like 'library/registry' or 'skycoin/skycoin'

Search and process all tags with a filter option syntax is like this

$ ./drib.sh -a <repository> -f "(^latest.*$)|(^develop.*$)|(^release.*$)|(^arm.*$)"

Where the argument of the '-f' switch is a regex expression ready to be processed by the grep -E command; see the man for grep to know more.

The power of regexes will let you make your particular magic on filtering.

Getting the file, fast way

You can fetch & setup the file in just one line with this command: (You need to move to the folder where you want to run it before)

$ curl -LG https://github.com/simelo/repo-info-tools/raw/master/drib.sh -o drib.sh && chmod +x drib.sh

This very is handy for automation tasks, if you need it be completely silent, just run it like this.

$ curl -sLG https://github.com/simelo/repo-info-tools/raw/master/drib.sh -o drib.sh && chmod +x drib.sh

Proxy operation

It can work over HTTP/HTTPS proxies, just take a peek on the code to modify and uncomment two lines.

Script feedback

If your images are big and your bandwidth is slow the local part will take a while, it will download the image locally if not already downloaded, keep an eye on console.

If this is your case: take a trip to the nearest window to check if the outer world is there. ;-)

repo-info-tools's People

Contributors

olemis avatar stdevpavelmc avatar

Watchers

 avatar  avatar  avatar

Forkers

cubantech olemis

repo-info-tools's Issues

Implement Github bot for repo-info synchronization

It should work similar to snyk bot .

  • Move drip.sh to new scripts folder
  • Implement this in cmd/repoinfobot folder
  • HTTP endpoint for connecting to Docker Hub / Cloud (or alike) web hooks
  • Schedule cron job to scrape target image.
  • Create branch with changes detected after scraping metadata
  • Submit PR if differences found

If possible language = python .

There is a need for some kind of filtering on the -a switch

For example:

If you want to process all tags for a given image (-a switch) but you want to use only some of them, like latest, develop, release ones but ignore the ones with fixes, features, etc.

A filter option can be a good tool here.

The script fails silently with some images.

$ ./drib.sh skycoin/skycoindev-cli:develop
Ready to process the repo-info for 'skycoin/skycoindev-cli:develop => skycoin/skycoindev-cli:develop'.
Getting remote info...
Got token from: https://auth.docker.io/token?service=registry.docker.io&scope=repository:skycoin/skycoindev-cli:pull
Get remote digest: sha256:f078698f17c9fb74151b5e63aa6a959505f27fba1af95378ce760c91f0d7ea2a
Got image config
Parsing remote data to ./repo-info/remote/develop.md
$

Here the script fails silently, and don't write nothing to the "$tag.md" file, it must do it like this:

$ ./drib.sh library/registry:latest
Ready to process the repo-info for 'library/registry:latest => library/registry:latest'.
Getting remote info...
Got token from: https://auth.docker.io/token?service=registry.docker.io&scope=repository:library/registry:pull
Get remote digest: sha256:2e2f252f3c88679f1207d87d57c07af6819a1a17e22573bcef32804122d2f305
Got image config
Parsing remote data to ./repo-info/remote/latest.md
Done remote.
Getting local info...
Pulling the image from docker hub
latest: Pulling from library/registry
Digest: sha256:5a156ff125e5a12ac7fdec2b90b7e2ae5120fa249cf62248337b6d04abc574c8
Status: Image is up to date for registry:latest
Parsing local data to ./repo-info/local/latest.md
Done local.
All Done, thank you.
$

That's a ok run.

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.