This commit is contained in:
Robert Kaussow 2020-02-22 17:39:28 +01:00
parent 2256d44980
commit 10cb72f955
4 changed files with 98 additions and 31 deletions

View File

@ -1,7 +1,6 @@
local PipelineBuild(arch='amd64') = { local PipelineBuild(arch='amd64') = {
local tag = 'linux-' + arch,
kind: 'pipeline', kind: 'pipeline',
name: 'build-container-' + arch, name: 'build-' + arch,
platform: { platform: {
os: 'linux', os: 'linux',
arch: arch, arch: arch,
@ -9,13 +8,14 @@ local PipelineBuild(arch='amd64') = {
steps: [ steps: [
{ {
name: 'dryrun', name: 'dryrun',
image: 'plugins/docker:' + tag, image: 'plugins/docker',
settings: { settings: {
dry_run: true, dry_run: true,
dockerfile: './Dockerfile.' + arch, dockerfile: 'Dockerfile',
repo: 'xoxys/nginx', 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' },
build_args: [],
}, },
when: { when: {
ref: [ ref: [
@ -25,14 +25,15 @@ local PipelineBuild(arch='amd64') = {
}, },
{ {
name: 'publish', name: 'publish',
image: 'plugins/docker:' + tag, image: 'plugins/docker',
settings: { settings: {
auto_tag: true, auto_tag: true,
auto_tag_suffix: arch, auto_tag_suffix: arch,
dockerfile: './Dockerfile.' + arch, dockerfile: 'Dockerfile',
repo: 'xoxys/nginx', 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' },
build_args: [],
}, },
when: { when: {
ref: [ ref: [
@ -41,6 +42,20 @@ local PipelineBuild(arch='amd64') = {
], ],
}, },
}, },
{
name: 'publish-gitea',
image: 'plugins/gitea-release',
settings: {
api_key: { from_secret: 'gitea_token' },
base_url: 'https://gitea.rknet.org',
overwrite: true,
title: '${DRONE_TAG}',
note: 'CHANGELOG.md',
},
when: {
ref: ['refs/tags/**'],
},
},
], ],
}; };
@ -57,9 +72,20 @@ local PipelineNotifications(depends_on=[]) = {
name: 'manifest', name: 'manifest',
settings: { settings: {
ignore_missing: true, ignore_missing: true,
tags: [
'${DRONE_TAG}',
'${DRONE_TAG%-*}',
'${DRONE_TAG%.*}',
'${DRONE_TAG%%.*}',
],
username: { from_secret: 'docker_username' }, username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' }, password: { from_secret: 'docker_password' },
spec: './manifest.tmpl', spec: 'manifest.tmpl',
},
when: {
status: [
'success',
],
}, },
}, },
{ {
@ -69,23 +95,31 @@ local PipelineNotifications(depends_on=[]) = {
DOCKERHUB_USERNAME: { from_secret: 'docker_username' }, DOCKERHUB_USERNAME: { from_secret: 'docker_username' },
DOCKERHUB_PASSWORD: { from_secret: 'docker_password' }, DOCKERHUB_PASSWORD: { from_secret: 'docker_password' },
DOCKERHUB_REPO_PREFIX: 'xoxys', DOCKERHUB_REPO_PREFIX: 'xoxys',
DOCKERHUB_REPO_NAME: 'nginx', DOCKERHUB_REPO_NAME: '${DRONE_REPO_NAME}',
README_PATH: 'README.md', README_PATH: 'README.md',
SHORT_DESCRIPTION: 'Rootless NGINX - High-performance HTTP server and reverse proxy', SHORT_DESCRIPTION: 'Rootless NGINX - High-performance HTTP server and reverse proxy',
}, },
when: {
status: [
'success',
],
},
}, },
{ {
image: 'plugins/matrix',
name: 'matrix', name: 'matrix',
image: 'plugins/matrix',
settings: { settings: {
homeserver: 'https://matrix.rknet.org', homeserver: { from_secret: 'matrix_homeserver' },
roomid: 'MtidqQXWWAtQcByBhH:rknet.org', roomid: { from_secret: 'matrix_roomid' },
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: { from_secret: 'matrix_username' }, username: { from_secret: 'matrix_username' },
password: { from_secret: 'matrix_password' }, password: { from_secret: 'matrix_password' },
}, },
when: { when: {
status: ['success', 'failure'], status: [
'success',
'failure',
],
}, },
}, },
], ],
@ -94,7 +128,10 @@ local PipelineNotifications(depends_on=[]) = {
'refs/heads/master', 'refs/heads/master',
'refs/tags/**', 'refs/tags/**',
], ],
status: ['success', 'failure'], status: [
'success',
'failure',
],
}, },
depends_on: depends_on, depends_on: depends_on,
}; };
@ -102,6 +139,6 @@ local PipelineNotifications(depends_on=[]) = {
[ [
PipelineBuild(arch='amd64'), PipelineBuild(arch='amd64'),
PipelineNotifications(depends_on=[ PipelineNotifications(depends_on=[
'build-container-amd64', 'build-amd64',
]), ]),
] ]

View File

@ -1,6 +1,6 @@
--- ---
kind: pipeline kind: pipeline
name: build-container-amd64 name: build-amd64
platform: platform:
os: linux os: linux
@ -8,13 +8,13 @@ platform:
steps: steps:
- name: dryrun - name: dryrun
image: plugins/docker:linux-amd64 image: plugins/docker
settings: settings:
dockerfile: ./Dockerfile.amd64 dockerfile: Dockerfile
dry_run: true dry_run: true
password: password:
from_secret: docker_password from_secret: docker_password
repo: xoxys/nginx repo: xoxys/${DRONE_REPO_NAME}
username: username:
from_secret: docker_username from_secret: docker_username
when: when:
@ -22,14 +22,14 @@ steps:
- refs/pull/** - refs/pull/**
- name: publish - name: publish
image: plugins/docker:linux-amd64 image: plugins/docker
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: amd64 auto_tag_suffix: amd64
dockerfile: ./Dockerfile.amd64 dockerfile: Dockerfile
password: password:
from_secret: docker_password from_secret: docker_password
repo: xoxys/nginx repo: xoxys/${DRONE_REPO_NAME}
username: username:
from_secret: docker_username from_secret: docker_username
when: when:
@ -37,6 +37,19 @@ steps:
- refs/heads/master - refs/heads/master
- refs/tags/** - refs/tags/**
- name: publish-gitea
image: plugins/gitea-release
settings:
api_key:
from_secret: gitea_token
base_url: https://gitea.rknet.org
note: CHANGELOG.md
overwrite: true
title: ${DRONE_TAG}
when:
ref:
- refs/tags/**
--- ---
kind: pipeline kind: pipeline
name: notifications name: notifications
@ -52,29 +65,42 @@ steps:
ignore_missing: true ignore_missing: true
password: password:
from_secret: docker_password from_secret: docker_password
spec: ./manifest.tmpl spec: manifest.tmpl
tags:
- ${DRONE_TAG}
- ${DRONE_TAG%-*}
- ${DRONE_TAG%.*}
- ${DRONE_TAG%%.*}
username: username:
from_secret: docker_username from_secret: docker_username
when:
status:
- success
- name: readme - name: readme
image: sheogorath/readme-to-dockerhub image: sheogorath/readme-to-dockerhub
environment: environment:
DOCKERHUB_PASSWORD: DOCKERHUB_PASSWORD:
from_secret: docker_password from_secret: docker_password
DOCKERHUB_REPO_NAME: nginx DOCKERHUB_REPO_NAME: ${DRONE_REPO_NAME}
DOCKERHUB_REPO_PREFIX: xoxys DOCKERHUB_REPO_PREFIX: xoxys
DOCKERHUB_USERNAME: DOCKERHUB_USERNAME:
from_secret: docker_username from_secret: docker_username
README_PATH: README.md README_PATH: README.md
SHORT_DESCRIPTION: Rootless NGINX - High-performance HTTP server and reverse proxy SHORT_DESCRIPTION: Rootless NGINX - High-performance HTTP server and reverse proxy
when:
status:
- success
- name: matrix - name: matrix
image: plugins/matrix image: plugins/matrix
settings: settings:
homeserver: https://matrix.rknet.org homeserver:
from_secret: matrix_homeserver
password: password:
from_secret: matrix_password from_secret: matrix_password
roomid: MtidqQXWWAtQcByBhH:rknet.org roomid:
from_secret: matrix_roomid
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
@ -92,10 +118,10 @@ trigger:
- failure - failure
depends_on: depends_on:
- build-container-amd64 - build-amd64
--- ---
kind: signature kind: signature
hmac: 4934bdb4da4822d1b66100616df27aa4c6b9b23fbec8191303def1ac2cce0764 hmac: 58628427cc7d49043cf825e1419f8132b47ac392a79aac3a19056273dc517915
... ...

View File

@ -1,7 +1,8 @@
FROM alpine:3.10 FROM alpine:3.10
LABEL maintainer="Robert Kaussow <mail@geeklabor.de>" \ LABEL maintainer="Robert Kaussow <mail@geeklabor.de>" \
org.label-schema.name="Nginx" \ org.label-schema.name="nginx" \
org.label-schema.vcs-url="https://gitea.rknet.org/docker/nginx" \
org.label-schema.vendor="Robert Kaussow" \ org.label-schema.vendor="Robert Kaussow" \
org.label-schema.schema-version="1.0" org.label-schema.schema-version="1.0"

View File

@ -2,7 +2,10 @@ image: xoxys/nginx:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{
{{#if build.tags}} {{#if build.tags}}
tags: tags:
{{#each build.tags}} {{#each build.tags}}
- {{this}} {{#if this}}
- {{trimPrefix "v" this}}
- {{trimPrefix "v" this}}-amd64
{{/if}}
{{/each}} {{/each}}
{{/if}} {{/if}}
manifests: manifests: