Skip to content

devatherock/artifactory-badge

Folders and files

NameName
Last commit message
Last commit date
Nov 21, 2020
Oct 17, 2020
Nov 21, 2020
Nov 14, 2020
Nov 21, 2020
Oct 19, 2020
Oct 17, 2020
Nov 16, 2020
Nov 19, 2020
Nov 14, 2020
Oct 17, 2020
Oct 17, 2020
Oct 17, 2020
Oct 17, 2020
Oct 17, 2020

Repository files navigation

CircleCI Version Coverage Status Quality Gate Docker Pulls Lines of Code Docker Image Size

artifactory-badge

Badge generator for docker registries hosted in jfrog artifactory

Usage

Sample command

docker run --rm \
  -p 8080:8080 \
  -e ARTIFACTORY_URL=https://some/url \
  -e ARTIFACTORY_API_KEY=xyz \
  devatherock/artifactory-badge:latest

Environment variables for configuration

Name Required Default Description
ARTIFACTORY_URL true (None) The JFrog artifactory URL that hosts the docker registry
ARTIFACTORY_API_KEY true (None) API key for interacting with artifactory's REST API
ARTIFACTORY_BADGE_SHIELDS_IO_ENABLED false true Indicates if shields.io should be used to generate the badge
LOGGING_LEVEL_ROOT false INFO SLF4J log level, for all(framework and custom) code
LOGGING_LEVEL_IO_GITHUB_DEVATHEROCK false INFO SLF4J log level, for custom code
MICRONAUT_ENVIRONMENTS false (None) Setting the value to mock will mock the calls to the artifactory. Only for testing purposes
MICRONAUT_SERVER_PORT false 8080 Port in which the app listens on
JAVA_OPTS false (None) Additional JVM arguments to be passed to the container's java process

Endpoints

  • /docker/pulls?package=path/to/package - Generates download count badge
  • /docker/image-size?package=path/to/package - Generates docker image size badge
  • /docker/layers?package=path/to/package - Generates docker image layers count badge
  • /version?package=path/to/package - Generates latest version badge

Sample badge generated by the custom generator

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="144" height="20" role="img" aria-label="docker pulls: 47">
    <title>docker pulls: 47</title>
    <linearGradient id="s" x2="0" y2="100%">
        <stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
        <stop offset="1" stop-opacity=".1"/>
    </linearGradient>
    <clipPath id="r">
        <rect width="144" height="20" rx="3" fill="#fff"/>
    </clipPath>
    <g clip-path="url(#r)">
        <rect width="112" height="20" fill="#555"/>
        <rect x="112" width="32" height="20" fill="#007ec6"/>
        <rect width="144" height="20" fill="url(#s)"/>
    </g>
    <g font-family="monospace">
        <text aria-hidden="true" x="0" y="15" fill="#fff" xml:space="preserve"> docker pulls </text>
        <text aria-hidden="true" x="112" y="15" fill="#fff" xml:space="preserve"> 47 </text>
    </g>
</svg>

Troubleshooting

Enabling debug logs

  • Set the environment variable LOGGING_LEVEL_ROOT to DEBUG to enable all debug logs - custom and framework
  • Set the environment variable LOGGING_LEVEL_IO_GITHUB_DEVATHEROCK to DEBUG to enable debug logs only in custom code
  • For fine-grained logging control, supply a custom logback.xml file and set the environment variable JAVA_OPTS to -Dlogback.configurationFile=/path/to/custom/logback.xml