An open API service indexing awesome lists of open source software.

https://github.com/tlwr/registry-tag-resource

a concourse resource for oci registry tags
https://github.com/tlwr/registry-tag-resource

concourse concourse-resource hacktoberfest

Last synced: 6 months ago
JSON representation

a concourse resource for oci registry tags

Awesome Lists containing this project

README

          

# registry-tag-resource

a [concourse](https://concourse-ci.org)
[resource type](https://resource-types.concourse-ci.org)
for tags in a oci registry

a
[blog post on www.toby.codes](https://www.toby.codes/posts/2021-05-Automatic-updates-of-Docker-images-with-Concourse)
describes how this resource type can be used

## public image

all passing commits are built into container images hosted on
[github](https://github.com/users/tlwr/packages/container/package/registry-tag-resource)

## operations

* `check` - looks for tags
* `in` - downloads metadata about the tag

## configuration

```yaml
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:

```json
{
"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](Dockerfile) with a build arg:

```Dockerfile
BUILD_ARG ruby_version
FROM ruby:$ruby_version

...
```

a pipeline that uses the
[oci-build-task](https://github.com/vito/oci-build-task) can dynamically
build docker images using `BUILD-ARG_` params:

```yaml
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
```