refactoring

This commit is contained in:
Robert Kaussow 2020-02-04 10:49:12 +01:00
parent 0f04eed106
commit 7972f7321c
4 changed files with 70 additions and 98 deletions

View File

@ -1,38 +1,38 @@
local PipelineBuild(os='linux', arch='amd64') = {
local tag = os + '-' + arch,
local version_tag = os + '-' + arch,
local file_suffix = std.strReplace(version_tag, '-', '.'),
kind: "pipeline",
name: version_tag,
local PipelineBuild(arch='amd64') = {
local tag = 'linux-' + arch,
kind: 'pipeline',
name: 'build-container-' + arch,
platform: {
os: os,
os: 'linux',
arch: arch,
},
steps: [
{
name: 'dryrun',
image: 'plugins/docker:' + tag,
pull: 'always',
settings: {
dry_run: true,
tags: version_tag,
dockerfile: './Dockerfile.' + file_suffix,
dockerfile: './Dockerfile.' + arch,
repo: 'xoxys/nginx',
username: { from_secret: "docker_username" },
password: { from_secret: "docker_password" },
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
},
when: {
ref: [
'refs/pull/**',
],
},
},
{
name: 'publish',
image: 'plugins/docker:' + tag,
pull: 'always',
settings: {
auto_tag: true,
auto_tag_suffix: version_tag,
dockerfile: './Dockerfile.' + file_suffix,
auto_tag_suffix: arch,
dockerfile: './Dockerfile.' + arch,
repo: 'xoxys/nginx',
username: { from_secret: "docker_username" },
password: { from_secret: "docker_password" },
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
},
when: {
ref: [
@ -45,82 +45,64 @@ local PipelineBuild(os='linux', arch='amd64') = {
};
local PipelineNotifications(depends_on=[]) = {
kind: "pipeline",
name: "notifications",
kind: 'pipeline',
name: 'notifications',
platform: {
os: "linux",
arch: "amd64",
os: 'linux',
arch: 'amd64',
},
steps: [
{
image: "plugins/manifest",
name: "manifest",
pull: "always",
image: 'plugins/manifest',
name: 'manifest',
settings: {
ignore_missing: true,
username: { from_secret: "docker_username" },
password: { from_secret: "docker_password" },
spec: "./manifest.tmpl",
},
when: {
ref: [
'refs/heads/master',
'refs/tags/**',
],
tags: ['${DRONE_TAG}', '${DRONE_TAG%-*}', '${DRONE_TAG%.*}', '${DRONE_TAG%%.*}'],
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
spec: './manifest.tmpl',
},
},
{
name: "readme",
image: "sheogorath/readme-to-dockerhub",
pull: "always",
name: 'readme',
image: 'sheogorath/readme-to-dockerhub',
environment: {
DOCKERHUB_USERNAME: { from_secret: "docker_username" },
DOCKERHUB_PASSWORD: { from_secret: "docker_password" },
DOCKERHUB_REPO_PREFIX: "xoxys",
DOCKERHUB_REPO_NAME: "nginx",
README_PATH: "README.md",
SHORT_DESCRIPTION: "Rootless NGINX - High-performance HTTP server and reverse proxy"
},
when: {
ref: [
'refs/heads/master',
'refs/tags/**',
],
DOCKERHUB_USERNAME: { from_secret: 'docker_username' },
DOCKERHUB_PASSWORD: { from_secret: 'docker_password' },
DOCKERHUB_REPO_PREFIX: 'xoxys',
DOCKERHUB_REPO_NAME: 'nginx',
README_PATH: 'README.md',
SHORT_DESCRIPTION: 'Rootless NGINX - High-performance HTTP server and reverse proxy',
},
},
{
name: "microbadger",
image: "plugins/webhook",
pull: "always",
image: 'plugins/matrix',
name: 'matrix',
settings: {
urls: { from_secret: "microbadger_url" },
},
},
{
image: "plugins/matrix",
name: "matrix",
pull: 'always',
settings: {
homeserver: "https://matrix.rknet.org",
roomid: "MtidqQXWWAtQcByBhH:rknet.org",
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" },
password: { from_secret: "matrix_password" },
homeserver: 'https://matrix.rknet.org',
roomid: 'MtidqQXWWAtQcByBhH:rknet.org',
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' },
password: { from_secret: 'matrix_password' },
},
when: {
status: [ "success", "failure" ],
status: ['success', 'failure'],
},
},
],
trigger: {
status: [ "success", "failure" ],
ref: [
'refs/heads/master',
'refs/tags/**',
],
status: ['success', 'failure'],
},
depends_on: depends_on,
};
[
PipelineBuild(os='linux', arch='amd64'),
PipelineBuild(arch='amd64'),
PipelineNotifications(depends_on=[
"linux-amd64",
])
'build-container-amd64',
]),
]

View File

@ -1,6 +1,6 @@
---
kind: pipeline
name: linux-amd64
name: build-container-amd64
platform:
os: linux
@ -8,25 +8,25 @@ platform:
steps:
- name: dryrun
pull: always
image: plugins/docker:linux-amd64
settings:
dockerfile: ./Dockerfile.linux.amd64
dockerfile: ./Dockerfile.amd64
dry_run: true
password:
from_secret: docker_password
repo: xoxys/nginx
tags: linux-amd64
username:
from_secret: docker_username
when:
ref:
- refs/pull/**
- name: publish
pull: always
image: plugins/docker:linux-amd64
settings:
auto_tag: true
auto_tag_suffix: linux-amd64
dockerfile: ./Dockerfile.linux.amd64
auto_tag_suffix: amd64
dockerfile: ./Dockerfile.amd64
password:
from_secret: docker_password
repo: xoxys/nginx
@ -35,7 +35,7 @@ steps:
when:
ref:
- refs/heads/master
- "refs/tags/**"
- refs/tags/**
---
kind: pipeline
@ -47,22 +47,21 @@ platform:
steps:
- name: manifest
pull: always
image: plugins/manifest
settings:
ignore_missing: true
password:
from_secret: docker_password
spec: ./manifest.tmpl
tags:
- ${DRONE_TAG}
- ${DRONE_TAG%-*}
- ${DRONE_TAG%.*}
- ${DRONE_TAG%%.*}
username:
from_secret: docker_username
when:
ref:
- refs/heads/master
- "refs/tags/**"
- name: readme
pull: always
image: sheogorath/readme-to-dockerhub
environment:
DOCKERHUB_PASSWORD:
@ -73,20 +72,8 @@ steps:
from_secret: docker_username
README_PATH: README.md
SHORT_DESCRIPTION: Rootless NGINX - High-performance HTTP server and reverse proxy
when:
ref:
- refs/heads/master
- "refs/tags/**"
- name: microbadger
pull: always
image: plugins/webhook
settings:
urls:
from_secret: microbadger_url
- name: matrix
pull: always
image: plugins/matrix
settings:
homeserver: https://matrix.rknet.org
@ -102,15 +89,18 @@ steps:
- failure
trigger:
ref:
- refs/heads/master
- refs/tags/**
status:
- success
- failure
depends_on:
- linux-amd64
- build-container-amd64
---
kind: signature
hmac: 9619ca3e3158f7e30d6f7c80939260f2e30c3321349f24bdeb4cdfc229768fdb
hmac: 18d51c3100fde1f5f7a1813aeb14fff653ae509b4040e492d2420486201988eb
...

View File

@ -6,7 +6,7 @@ tags:
{{/each}}
{{/if}}
manifests:
- image: xoxys/nginx:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
- image: xoxys/nginx:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}amd64
platform:
architecture: amd64
os: linux