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
all passing commits are built into container images hosted on github
check
- looks for tagsin
- downloads metadata about the tag
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
the check
step looks at the configured registry for new tags for the image
an example version:
{
"tag": "2.7.1"
}
produces the following files:
tag
digest
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