Skip to content

mymasse/registry-tag-resource

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

registry-tag-resource

a concourse resource type for tags in a oci registry

a blog post on www.toby.codes describes how this resource type can be used

public image

all passing commits are built into container images hosted on github

operations

  • check - looks for tags
  • in - downloads metadata about the tag

configuration

source:
  # where the image lives
  #
  # for docker hub https://hub.docker.com/v2/user_or_org/image_name
  #
  # for example https://hub.docker.com/v2/library/ruby for _/ruby
  # for example https://quay.io/v2/coreos/etcd'
  #
  # mandatory
  uri: https://hub.docker.com/v2/repositories/governmentpaas/cf-cli

  # basic auth
  #
  # only works for registries, does not work for docker hub
  #
  # optional
  username: my-registry-username
  password: my-secret-password

  # how many pages to check in the registry
  #
  # optional ; default 1
  pages: 1

  # how many tags to fetch per page
  #
  # optional ; default 25
  tags_per_page: 50

  # ruby regular expression for filtering tags
  #
  # optional
  regexp: 'v[0-9]+'

  # to specify semantic versions
  # see github.com/jlindsey/semantic
  #
  # optional
  semver:
    # mandatory
    matcher: '~1.5'

    # optional
    prefix: 'v'
    

  # to sort by other methods

  # optional
  sort:
    # exclusive with semver.matcher
    #
    # alphabetical or numerical
    #
    # optional
    method: alphabetical

    # for example, can be used to retrieve oldest tag as most recent version
    #
    # optional
    reverse: true

check - check for new tags

the check step looks at the configured registry for new tags for the image

an example version:

{
  "tag": "2.7.1"
}

in - fetch registry image metadata

produces the following files:

  • tag
  • digest

examples

dynamically generate docker image using build args

using a Dockerfile with a build arg:

BUILD_ARG ruby_version
FROM ruby:$ruby_version

...

a pipeline that uses the oci-build-task can dynamically build docker images using BUILD-ARG_ params:

name: dynamically-build-image
plan:

  # source code
  - get: my-src 

  # registry-tag
  - get: ruby-img-tag
  
  # make tag file from resource available as a variable
  - load_var: ruby-version
    file: ruby-img-tag/tag

  - task: build-img
    privileged: true
    config:
      platform: linux

      image_resource:
        type: registry-image
        source:
          repository: vito/oci-build-task

      inputs:
        - name: my-src
          path: .

      outputs:
        - name: image

      params:
        # load ruby version for build task
        BUILD_ARG_ruby_version: ((.:ruby-version))

      run:
        path: build

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 97.8%
  • Dockerfile 2.2%