publish images to dockerhub and quay

This commit is contained in:
Robert Kaussow 2020-09-06 20:52:16 +02:00
parent 3599ba6128
commit 3d393c6e6a
No known key found for this signature in database
GPG Key ID: 65362AE74AF98B61
8 changed files with 242 additions and 71 deletions

View File

@ -1,7 +1,6 @@
local PythonVersion(pyversion='3.5') = {
name: 'python' + std.strReplace(pyversion, '.', '') + '-pytest',
image: 'python:' + pyversion,
pull: 'always',
environment: {
PY_COLORS: 1,
},
@ -27,7 +26,6 @@ local PipelineLint = {
{
name: 'flake8',
image: 'python:3.8',
pull: 'always',
environment: {
PY_COLORS: 1,
},
@ -56,12 +54,12 @@ local PipelineTest = {
PythonVersion(pyversion='3.7'),
PythonVersion(pyversion='3.8'),
],
trigger: {
ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'],
},
depends_on: [
'lint',
],
trigger: {
ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'],
},
};
local PipelineSecurity = {
@ -75,7 +73,6 @@ local PipelineSecurity = {
{
name: 'bandit',
image: 'python:3.8',
pull: 'always',
environment: {
PY_COLORS: 1,
},
@ -163,7 +160,6 @@ local PipelineBuildContainer(arch='amd64') = {
{
name: 'build',
image: 'python:3.8',
pull: 'always',
commands: [
'python setup.py bdist_wheel',
],
@ -171,33 +167,50 @@ local PipelineBuildContainer(arch='amd64') = {
{
name: 'dryrun',
image: 'plugins/docker:18-linux-' + arch,
pull: 'always',
settings: {
dry_run: true,
dockerfile: 'Dockerfile',
repo: 'xoxys/docker-autotag',
dockerfile: 'docker/Dockerfile',
repo: 'xoxys/${DRONE_REPO_NAME}',
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
},
depends_on: ['build'],
when: {
ref: ['refs/pull/**'],
},
},
{
name: 'publish',
name: 'publish-dockerhub',
image: 'plugins/docker:18-linux-' + arch,
pull: 'always',
settings: {
auto_tag: true,
auto_tag_suffix: arch,
dockerfile: 'Dockerfile',
repo: 'xoxys/docker-autotag',
dockerfile: 'docker/Dockerfile',
repo: 'xoxys/${DRONE_REPO_NAME}',
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
},
when: {
ref: ['refs/heads/master', 'refs/tags/**'],
},
depends_on: ['dryrun'],
},
{
name: 'publish-quay',
image: 'plugins/docker:18-linux-' + arch,
settings: {
auto_tag: true,
auto_tag_suffix: arch,
dockerfile: 'docker/Dockerfile',
registry: 'quay.io',
repo: 'quay.io/thegeeklab/${DRONE_REPO_NAME}',
username: { from_secret: 'quay_username' },
password: { from_secret: 'quay_password' },
},
when: {
ref: ['refs/heads/master', 'refs/tags/**'],
},
depends_on: ['dryrun'],
},
],
depends_on: [
@ -218,25 +231,64 @@ local PipelineNotifications = {
steps: [
{
image: 'plugins/manifest',
name: 'manifest',
name: 'manifest-dockerhub',
settings: {
ignore_missing: true,
auto_tag: true,
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
spec: 'manifest.tmpl',
spec: 'docker/manifest.tmpl',
},
when: {
status: ['success'],
},
},
{
name: 'readme',
image: 'sheogorath/readme-to-dockerhub',
image: 'plugins/manifest',
name: 'manifest-quay',
settings: {
ignore_missing: true,
auto_tag: true,
username: { from_secret: 'quay_username' },
password: { from_secret: 'quay_password' },
spec: 'docker/manifest-quay.tmpl',
},
when: {
status: ['success'],
},
},
{
name: 'pushrm-dockerhub',
pull: 'always',
image: 'chko/docker-pushrm:1',
environment: {
DOCKERHUB_USERNAME: { from_secret: 'docker_username' },
DOCKERHUB_PASSWORD: { from_secret: 'docker_password' },
DOCKERHUB_REPO_PREFIX: 'xoxys',
DOCKERHUB_REPO_NAME: 'docker-autotag',
README_PATH: 'README.md',
SHORT_DESCRIPTION: 'docker-autotag - Automate cloning a single branch from a repo list',
DOCKER_PASS: {
from_secret: 'docker_password',
},
DOCKER_USER: {
from_secret: 'docker_username',
},
PUSHRM_FILE: 'README.md',
PUSHRM_SHORT: 'docker-autotag - Create docker tags from a given version string',
PUSHRM_TARGET: 'xoxys/${DRONE_REPO_NAME}',
},
when: {
status: ['success'],
},
},
{
name: 'pushrm-quay',
pull: 'always',
image: 'chko/docker-pushrm:1',
environment: {
APIKEY__QUAY_IO: {
from_secret: 'quay_token',
},
PUSHRM_FILE: 'README.md',
PUSHRM_TARGET: 'quay.io/thegeeklab/${DRONE_REPO_NAME}',
},
when: {
status: ['success'],
},
},
{
@ -249,6 +301,9 @@ local PipelineNotifications = {
username: { from_secret: 'matrix_username' },
password: { from_secret: 'matrix_password' },
},
when: {
status: ['success', 'failure'],
},
},
],
depends_on: [

View File

@ -8,7 +8,6 @@ platform:
steps:
- name: flake8
pull: always
image: python:3.8
commands:
- pip install -r dev-requirements.txt -qq
@ -33,7 +32,6 @@ platform:
steps:
- name: python35-pytest
pull: always
image: python:3.5
commands:
- pip install -r dev-requirements.txt -qq
@ -46,7 +44,6 @@ steps:
- clone
- name: python36-pytest
pull: always
image: python:3.6
commands:
- pip install -r dev-requirements.txt -qq
@ -59,7 +56,6 @@ steps:
- clone
- name: python37-pytest
pull: always
image: python:3.7
commands:
- pip install -r dev-requirements.txt -qq
@ -72,7 +68,6 @@ steps:
- clone
- name: python38-pytest
pull: always
image: python:3.8
commands:
- pip install -r dev-requirements.txt -qq
@ -103,7 +98,6 @@ platform:
steps:
- name: bandit
pull: always
image: python:3.8
commands:
- pip install -r dev-requirements.txt -qq
@ -187,42 +181,62 @@ platform:
steps:
- name: build
pull: always
image: python:3.8
commands:
- python setup.py bdist_wheel
- name: dryrun
pull: always
image: plugins/docker:18-linux-amd64
settings:
dockerfile: Dockerfile
dockerfile: docker/Dockerfile
dry_run: true
password:
from_secret: docker_password
repo: xoxys/docker-autotag
repo: xoxys/${DRONE_REPO_NAME}
username:
from_secret: docker_username
when:
ref:
- refs/pull/**
depends_on:
- build
- name: publish
pull: always
- name: publish-dockerhub
image: plugins/docker:18-linux-amd64
settings:
auto_tag: true
auto_tag_suffix: amd64
dockerfile: Dockerfile
dockerfile: docker/Dockerfile
password:
from_secret: docker_password
repo: xoxys/docker-autotag
repo: xoxys/${DRONE_REPO_NAME}
username:
from_secret: docker_username
when:
ref:
- refs/heads/master
- refs/tags/**
depends_on:
- dryrun
- name: publish-quay
image: plugins/docker:18-linux-amd64
settings:
auto_tag: true
auto_tag_suffix: amd64
dockerfile: docker/Dockerfile
password:
from_secret: quay_password
registry: quay.io
repo: quay.io/thegeeklab/${DRONE_REPO_NAME}
username:
from_secret: quay_username
when:
ref:
- refs/heads/master
- refs/tags/**
depends_on:
- dryrun
trigger:
ref:
@ -243,42 +257,62 @@ platform:
steps:
- name: build
pull: always
image: python:3.8
commands:
- python setup.py bdist_wheel
- name: dryrun
pull: always
image: plugins/docker:18-linux-arm64
settings:
dockerfile: Dockerfile
dockerfile: docker/Dockerfile
dry_run: true
password:
from_secret: docker_password
repo: xoxys/docker-autotag
repo: xoxys/${DRONE_REPO_NAME}
username:
from_secret: docker_username
when:
ref:
- refs/pull/**
depends_on:
- build
- name: publish
pull: always
- name: publish-dockerhub
image: plugins/docker:18-linux-arm64
settings:
auto_tag: true
auto_tag_suffix: arm64
dockerfile: Dockerfile
dockerfile: docker/Dockerfile
password:
from_secret: docker_password
repo: xoxys/docker-autotag
repo: xoxys/${DRONE_REPO_NAME}
username:
from_secret: docker_username
when:
ref:
- refs/heads/master
- refs/tags/**
depends_on:
- dryrun
- name: publish-quay
image: plugins/docker:18-linux-arm64
settings:
auto_tag: true
auto_tag_suffix: arm64
dockerfile: docker/Dockerfile
password:
from_secret: quay_password
registry: quay.io
repo: quay.io/thegeeklab/${DRONE_REPO_NAME}
username:
from_secret: quay_username
when:
ref:
- refs/heads/master
- refs/tags/**
depends_on:
- dryrun
trigger:
ref:
@ -299,42 +333,62 @@ platform:
steps:
- name: build
pull: always
image: python:3.8
commands:
- python setup.py bdist_wheel
- name: dryrun
pull: always
image: plugins/docker:18-linux-arm
settings:
dockerfile: Dockerfile
dockerfile: docker/Dockerfile
dry_run: true
password:
from_secret: docker_password
repo: xoxys/docker-autotag
repo: xoxys/${DRONE_REPO_NAME}
username:
from_secret: docker_username
when:
ref:
- refs/pull/**
depends_on:
- build
- name: publish
pull: always
- name: publish-dockerhub
image: plugins/docker:18-linux-arm
settings:
auto_tag: true
auto_tag_suffix: arm
dockerfile: Dockerfile
dockerfile: docker/Dockerfile
password:
from_secret: docker_password
repo: xoxys/docker-autotag
repo: xoxys/${DRONE_REPO_NAME}
username:
from_secret: docker_username
when:
ref:
- refs/heads/master
- refs/tags/**
depends_on:
- dryrun
- name: publish-quay
image: plugins/docker:18-linux-arm
settings:
auto_tag: true
auto_tag_suffix: arm
dockerfile: docker/Dockerfile
password:
from_secret: quay_password
registry: quay.io
repo: quay.io/thegeeklab/${DRONE_REPO_NAME}
username:
from_secret: quay_username
when:
ref:
- refs/heads/master
- refs/tags/**
depends_on:
- dryrun
trigger:
ref:
@ -354,28 +408,60 @@ platform:
arch: amd64
steps:
- name: manifest
- name: manifest-dockerhub
image: plugins/manifest
settings:
auto_tag: true
ignore_missing: true
password:
from_secret: docker_password
spec: manifest.tmpl
spec: docker/manifest.tmpl
username:
from_secret: docker_username
when:
status:
- success
- name: readme
image: sheogorath/readme-to-dockerhub
- name: manifest-quay
image: plugins/manifest
settings:
auto_tag: true
ignore_missing: true
password:
from_secret: quay_password
spec: docker/manifest-quay.tmpl
username:
from_secret: quay_username
when:
status:
- success
- name: pushrm-dockerhub
pull: always
image: chko/docker-pushrm:1
environment:
DOCKERHUB_PASSWORD:
DOCKER_PASS:
from_secret: docker_password
DOCKERHUB_REPO_NAME: docker-autotag
DOCKERHUB_REPO_PREFIX: xoxys
DOCKERHUB_USERNAME:
DOCKER_USER:
from_secret: docker_username
README_PATH: README.md
SHORT_DESCRIPTION: docker-autotag - Automate cloning a single branch from a repo list
PUSHRM_FILE: README.md
PUSHRM_SHORT: docker-autotag - Create docker tags from a given version string
PUSHRM_TARGET: xoxys/${DRONE_REPO_NAME}
when:
status:
- success
- name: pushrm-quay
pull: always
image: chko/docker-pushrm:1
environment:
APIKEY__QUAY_IO:
from_secret: quay_token
PUSHRM_FILE: README.md
PUSHRM_TARGET: quay.io/thegeeklab/${DRONE_REPO_NAME}
when:
status:
- success
- name: matrix
image: plugins/matrix
@ -389,6 +475,10 @@ steps:
template: "Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: {{ build.message }}"
username:
from_secret: matrix_username
when:
status:
- success
- failure
trigger:
ref:
@ -406,6 +496,6 @@ depends_on:
---
kind: signature
hmac: a58be4e73614e614db6ea5d8e7a9aed43595c39a6af432ff2b666abeda695a12
hmac: 5997a4be30a1f15ebe8dddd9584dbfc496c673497c12ee4b61a437e0076bc00d
...

View File

@ -1,4 +1,2 @@
* ENHANCEMENT
* always print determined tag list to console
* BUGFUX
* fix undefined variable
- INTERNAL
- publish to dockerhub and quay.io

View File

@ -1,10 +1,14 @@
# docker-autotag
docker-autotag - Create docker tags from a given version string
[![Build Status](https://img.shields.io/drone/build/xoxys/docker-autotag?logo=drone)](https://cloud.drone.io/xoxys/docker-autotag)
[![Docker Hub](https://img.shields.io/badge/docker-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/xoxys/docker-autotag)
[![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/xoxys/docker-autotag)
[![Quay.io](https://img.shields.io/badge/quay-latest-blue.svg?logo=docker&logoColor=white)](https://quay.io/repository/thegeeklab/docker-autotag)
[![Python Version](https://img.shields.io/pypi/pyversions/docker-autotag.svg)](https://pypi.org/project/docker-autotag/)
[![PyPi Status](https://img.shields.io/pypi/status/docker-autotag.svg)](https://pypi.org/project/docker-autotag/)
[![PyPi Release](https://img.shields.io/pypi/v/docker-autotag.svg)](https://pypi.org/project/docker-autotag/)
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/xoxys/docker-autotag)
[![License: MIT](https://img.shields.io/github/license/xoxys/docker-autotag)](LICENSE)
Simple tool to create a list of docker tags from a given version string.

24
docker/manifest-quay.tmpl Normal file
View File

@ -0,0 +1,24 @@
image: quay.io/thegeeklab/docker-autotag:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
{{#if build.tags}}
tags:
{{#each build.tags}}
- {{this}}
{{/each}}
{{/if}}
manifests:
- image: quay.io/thegeeklab/docker-autotag:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}amd64
platform:
architecture: amd64
os: linux
- image: quay.io/thegeeklab/docker-autotag:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm64
platform:
architecture: arm64
os: linux
variant: v8
- image: quay.io/thegeeklab/docker-autotag:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm
platform:
architecture: arm
os: linux
variant: v7

View File

@ -2,7 +2,7 @@
__author__ = "Robert Kaussow"
__project__ = "docker-autotag"
__version__ = "0.1.1"
__version__ = "0.1.2"
__license__ = "MIT"
__maintainer__ = "Robert Kaussow"
__email__ = "mail@geeklabor.de"