npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

semantic-release-docker-test

v1.0.2

Published

semantic-release plugins to use semantic versioning with docker images

Downloads

11

Readme

semantic-release-docker-test

semantic-release latest npm package version MIT license

A semantic-release plugin to use semantic versioning for docker images.

Configuration

Installation

npm i --save semantic-release-docker-test

Docker registry authentication

The docker registry authentication is required and can be set via environment variables.

Environment variables

| Variable | Description | | ------------------------ | ----------------------------------------------------------------------------------------- | | DOCKER_REGISTRY_URL | The hostname and port used by the desired docker registry. Leave blank to use docker hub. | | DOCKER_REGISTRY_USER | The user name to authenticate with at the registry. | | DOCKER_REGISTRY_PASSWORD | The password used for authentication at the registry. |

Usage

Full configuration

{
  "verifyConfig": ["semantic-release-docker-test"],
  "prepare": [
    {
      "path": "semantic-release-docker-test",
      "additionalTags": ["test", "demo"],
      "imageName": "my-image",
      "registryUrl": "my-private-registry:5678",
      "respositoryName": "my-repository",
      "pushVersionTag": true
    }
  ],
  "publish": {
    "path": "semantic-release-docker-test"
  }
}

Results in my-private-registry:5678/my-repository/my-image with tags test, demo and the <semver> determined by semantic-release.

Minimum configuration

{
  "verifyConfig": ["semantic-release-docker-test"],
  "prepare": {
    "path": "semantic-release-docker-test",
    "imageName": "my-image"
  },
  "publish": {
    "path": "semantic-release-docker-test"
  }
}

Results in my-image:<semver>.

Options

| Option | Description | | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | | additionalTags | Optional. An array of strings allowing to specify additional tags to apply to the image. | | imageName | Required The name of the image to release. | | registryUrl | Optional. The hostname and port used by the the registry in format hostname[:port]. Omit the port if the registry uses the default port | | repositoryName | Optional. The name of the repository in the registry, e.g. username on docker hub | | pushVersionTag | Optional. Whether the semantic release tag, determined by the version, should be pushed. Default is true. |

Steps

verifyConditions

It uses a registry server provided via config or environment variable (preferred) or defaults to docker hub if none is given.

  1. Verifies that environment variables for authentication via username and password are set.
  2. It also verifies that the credentials are correct by logging in to the given registry.

prepare

Tags the specified image with the version number determined by semantic-release and additional tags provided in the configuration. In addition it supports specifying a complete image name (CIN) via configuration settings according to the canonical format specified by docker:

[registryhostname[:port]/][username/]imagename[:tag]

publish

Pushes the tagged images to the registry.

Contribute

Develop

  1. Create a develop.ts file in the root of this Git-Repository and copy this:
import { SemanticReleaseConfig, SemanticReleaseContext } from 'semantic-release';
import { prepare, publish, verifyConditions } from './src';
import { DockerPluginConfig } from './src/models';

process.env.DOCKER_REGISTRY_USER = '<Your Docker Registry User>';
process.env.DOCKER_REGISTRY_PASSWORD = '<Your Docker Registry Password>';

const config: SemanticReleaseConfig = {
  branch: '',
  noCi: true,
  repositoryUrl: '',
  tagFormat: ''
};
const context: SemanticReleaseContext = {
  logger: {
    // tslint:disable-next-line:no-empty
    log: (message: string) => {}
  },
  options: {
    branch: '',
    noCi: true,
    prepare: [
      {
        additionalTags: ['latest'],
        imageName: 'testimage',
        repositoryName: '<your test repository>',
        path: 'semantic-release-docker-test'
      } as DockerPluginConfig,
      {
        additionalTags: ['latest'],
        imageName: 'testimage1',
        repositoryName: '<your test repository>',
        path: 'semantic-release-docker-test'
      } as DockerPluginConfig
    ],
    repositoryUrl: '',
    tagFormat: ''
  },
  nextRelease: {
    version: '1.0.3',
    gitHead: '45jh345g',
    gitTag: 'v1.0.3',
    notes: 'Nothing special'
  }
};
context.logger.log = (string: string) => {
  console.log(string);
};
verifyConditions(config, context);
prepare(config, context);
publish(config, context);
  1. Simply run the "Debug" VS Code Task