publish images to dockerhub and quay

This commit is contained in:
Robert Kaussow 2020-09-06 19:59:28 +02:00
parent 6d6bd4f3ca
commit 6b4ad1cbea
No known key found for this signature in database
GPG Key ID: 65362AE74AF98B61
7 changed files with 233 additions and 42 deletions

View File

@ -188,29 +188,48 @@ local PipelineBuildContainer(arch='amd64') = {
image: 'plugins/docker:18-linux-' + arch, image: 'plugins/docker:18-linux-' + arch,
settings: { settings: {
dry_run: true, dry_run: true,
dockerfile: 'Dockerfile', dockerfile: 'docker/Dockerfile',
repo: 'xoxys/ansible-later', repo: 'xoxys/${DRONE_REPO_NAME}',
username: { from_secret: 'docker_username' }, username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' }, password: { from_secret: 'docker_password' },
}, },
depends_on: ['build'],
when: { when: {
ref: ['refs/pull/**'], ref: ['refs/pull/**'],
}, },
}, },
{ {
name: 'publish', name: 'publish-dockerhub',
image: 'plugins/docker:18-linux-' + arch, image: 'plugins/docker:18-linux-' + arch,
settings: { settings: {
auto_tag: true, auto_tag: true,
auto_tag_suffix: arch, auto_tag_suffix: arch,
dockerfile: 'Dockerfile', dockerfile: 'docker/Dockerfile',
repo: 'xoxys/ansible-later', repo: 'xoxys/${DRONE_REPO_NAME}',
username: { from_secret: 'docker_username' }, username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' }, password: { from_secret: 'docker_password' },
}, },
when: { when: {
ref: ['refs/heads/master', 'refs/tags/**'], 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: [ depends_on: [
@ -337,25 +356,64 @@ local PipelineNotifications = {
steps: [ steps: [
{ {
image: 'plugins/manifest', image: 'plugins/manifest',
name: 'manifest', name: 'manifest-dockerhub',
settings: { settings: {
ignore_missing: true, ignore_missing: true,
auto_tag: true, auto_tag: true,
username: { from_secret: 'docker_username' }, username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' }, password: { from_secret: 'docker_password' },
spec: 'manifest.tmpl', spec: 'docker/manifest.tmpl',
},
when: {
status: ['success'],
}, },
}, },
{ {
name: 'readme', image: 'plugins/manifest',
image: 'sheogorath/readme-to-dockerhub', 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: { environment: {
DOCKERHUB_USERNAME: { from_secret: 'docker_username' }, DOCKER_PASS: {
DOCKERHUB_PASSWORD: { from_secret: 'docker_password' }, from_secret: 'docker_password',
DOCKERHUB_REPO_PREFIX: 'xoxys', },
DOCKERHUB_REPO_NAME: 'ansible-later', DOCKER_USER: {
README_PATH: 'README.md', from_secret: 'docker_username',
SHORT_DESCRIPTION: 'ansible-later - Lovely automation testing framework', },
PUSHRM_FILE: 'README.md',
PUSHRM_SHORT: 'ansible-doctor - Simple annotation based documentation for your roles',
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'],
}, },
}, },
{ {
@ -368,6 +426,9 @@ local PipelineNotifications = {
username: { from_secret: 'matrix_username' }, username: { from_secret: 'matrix_username' },
password: { from_secret: 'matrix_password' }, password: { from_secret: 'matrix_password' },
}, },
when: {
status: ['success', 'failure'],
},
}, },
], ],
depends_on: [ depends_on: [

View File

@ -207,32 +207,55 @@ steps:
- name: dryrun - name: dryrun
image: plugins/docker:18-linux-amd64 image: plugins/docker:18-linux-amd64
settings: settings:
dockerfile: Dockerfile dockerfile: docker/Dockerfile
dry_run: true dry_run: true
password: password:
from_secret: docker_password from_secret: docker_password
repo: xoxys/ansible-later repo: xoxys/${DRONE_REPO_NAME}
username: username:
from_secret: docker_username from_secret: docker_username
when: when:
ref: ref:
- refs/pull/** - refs/pull/**
depends_on:
- build
- name: publish - name: publish-dockerhub
image: plugins/docker:18-linux-amd64 image: plugins/docker:18-linux-amd64
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: amd64 auto_tag_suffix: amd64
dockerfile: Dockerfile dockerfile: docker/Dockerfile
password: password:
from_secret: docker_password from_secret: docker_password
repo: xoxys/ansible-later repo: xoxys/${DRONE_REPO_NAME}
username: username:
from_secret: docker_username from_secret: docker_username
when: when:
ref: ref:
- refs/heads/master - refs/heads/master
- refs/tags/** - 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: trigger:
ref: ref:
@ -260,32 +283,55 @@ steps:
- name: dryrun - name: dryrun
image: plugins/docker:18-linux-arm64 image: plugins/docker:18-linux-arm64
settings: settings:
dockerfile: Dockerfile dockerfile: docker/Dockerfile
dry_run: true dry_run: true
password: password:
from_secret: docker_password from_secret: docker_password
repo: xoxys/ansible-later repo: xoxys/${DRONE_REPO_NAME}
username: username:
from_secret: docker_username from_secret: docker_username
when: when:
ref: ref:
- refs/pull/** - refs/pull/**
depends_on:
- build
- name: publish - name: publish-dockerhub
image: plugins/docker:18-linux-arm64 image: plugins/docker:18-linux-arm64
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: arm64 auto_tag_suffix: arm64
dockerfile: Dockerfile dockerfile: docker/Dockerfile
password: password:
from_secret: docker_password from_secret: docker_password
repo: xoxys/ansible-later repo: xoxys/${DRONE_REPO_NAME}
username: username:
from_secret: docker_username from_secret: docker_username
when: when:
ref: ref:
- refs/heads/master - refs/heads/master
- refs/tags/** - 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: trigger:
ref: ref:
@ -313,32 +359,55 @@ steps:
- name: dryrun - name: dryrun
image: plugins/docker:18-linux-arm image: plugins/docker:18-linux-arm
settings: settings:
dockerfile: Dockerfile dockerfile: docker/Dockerfile
dry_run: true dry_run: true
password: password:
from_secret: docker_password from_secret: docker_password
repo: xoxys/ansible-later repo: xoxys/${DRONE_REPO_NAME}
username: username:
from_secret: docker_username from_secret: docker_username
when: when:
ref: ref:
- refs/pull/** - refs/pull/**
depends_on:
- build
- name: publish - name: publish-dockerhub
image: plugins/docker:18-linux-arm image: plugins/docker:18-linux-arm
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: arm auto_tag_suffix: arm
dockerfile: Dockerfile dockerfile: docker/Dockerfile
password: password:
from_secret: docker_password from_secret: docker_password
repo: xoxys/ansible-later repo: xoxys/${DRONE_REPO_NAME}
username: username:
from_secret: docker_username from_secret: docker_username
when: when:
ref: ref:
- refs/heads/master - refs/heads/master
- refs/tags/** - 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: trigger:
ref: ref:
@ -446,28 +515,60 @@ platform:
arch: amd64 arch: amd64
steps: steps:
- name: manifest - name: manifest-dockerhub
image: plugins/manifest image: plugins/manifest
settings: settings:
auto_tag: true auto_tag: true
ignore_missing: true ignore_missing: true
password: password:
from_secret: docker_password from_secret: docker_password
spec: manifest.tmpl spec: docker/manifest.tmpl
username: username:
from_secret: docker_username from_secret: docker_username
when:
status:
- success
- name: readme - name: manifest-quay
image: sheogorath/readme-to-dockerhub 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: environment:
DOCKERHUB_PASSWORD: DOCKER_PASS:
from_secret: docker_password from_secret: docker_password
DOCKERHUB_REPO_NAME: ansible-later DOCKER_USER:
DOCKERHUB_REPO_PREFIX: xoxys
DOCKERHUB_USERNAME:
from_secret: docker_username from_secret: docker_username
README_PATH: README.md PUSHRM_FILE: README.md
SHORT_DESCRIPTION: ansible-later - Lovely automation testing framework PUSHRM_SHORT: ansible-doctor - Simple annotation based documentation for your roles
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 - name: matrix
image: plugins/matrix image: plugins/matrix
@ -481,6 +582,10 @@ steps:
template: "Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: {{ build.message }}" template: "Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: {{ build.message }}"
username: username:
from_secret: matrix_username from_secret: matrix_username
when:
status:
- success
- failure
trigger: trigger:
ref: ref:
@ -495,6 +600,6 @@ depends_on:
--- ---
kind: signature kind: signature
hmac: 759a975b796218d54d4e86f436810ec120bd53a5fa0abadf774467a35039bcd9 hmac: 9952ea94d9d4d8a7bb8854423d59e5d94af8c16aeb76fa28e01c9049fe13f950
... ...

View File

@ -1,2 +1,3 @@
- INTERNAL - INTERNAL
- upgrade CI pipeline to use Hugo v0.74.3 - upgrade CI pipeline to use Hugo v0.74.3
- publish to dockerhub and quay.io

View File

@ -6,7 +6,7 @@ __license__ = "MIT"
__maintainer__ = "Robert Kaussow" __maintainer__ = "Robert Kaussow"
__email__ = "mail@geeklabor.de" __email__ = "mail@geeklabor.de"
__url__ = "https://github.com/xoxys/ansible-later" __url__ = "https://github.com/xoxys/ansible-later"
__version__ = "0.3.6" __version__ = "0.3.7"
from ansiblelater import logger from ansiblelater import logger

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

@ -0,0 +1,24 @@
image: quay.io/thegeeklab/ansible-later:{{#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/ansible-later:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}amd64
platform:
architecture: amd64
os: linux
- image: quay.io/thegeeklab/ansible-later:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm64
platform:
architecture: arm64
os: linux
variant: v8
- image: quay.io/thegeeklab/ansible-later:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm
platform:
architecture: arm
os: linux
variant: v7