alpine-tools/.drone.jsonnet

196 lines
4.9 KiB
Plaintext
Raw Normal View History

2021-01-18 19:41:40 +00:00
local PipelineTest = {
kind: 'pipeline',
name: 'test',
platform: {
os: 'linux',
arch: 'amd64',
},
steps: [
{
name: 'markdownlint',
image: 'thegeeklab/markdownlint-cli',
commands: [
"markdownlint 'README.md'",
],
},
],
trigger: {
ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
},
};
local PipelineBuildContainer(arch='amd64') = {
kind: 'pipeline',
name: 'build-container-' + std.split(arch, '_')[0],
platform: {
os: 'linux',
arch: 'amd64',
},
steps: [
{
name: 'tags',
image: 'thegeeklab/docker-autotag',
environment: {
DOCKER_AUTOTAG_FORCE_LATEST: 'True',
DOCKER_AUTOTAG_IGNORE_PRERELEASE: 'True',
DOCKER_AUTOTAG_OUTPUT_FILE: '.tags',
DOCKER_AUTOTAG_VERSION: '${DRONE_TAG}',
DOCKER_AUTOTAG_SUFFIX: std.split(arch, '_')[0],
},
},
{
name: 'dryrun',
image: 'thegeeklab/drone-docker-buildx:20',
settings: {
dry_run: true,
dockerfile: 'Dockerfile.' + std.split(arch, '_')[0],
platforms: [
'linux/' + std.strReplace(arch, '_', '/'),
],
repo: 'thegeeklab/${DRONE_REPO_NAME}',
},
depends_on: ['tags'],
when: {
ref: ['refs/pull/**'],
},
},
{
name: 'publish-dockerhub',
image: 'thegeeklab/drone-docker-buildx:20',
settings: {
dockerfile: 'Dockerfile.' + std.split(arch, '_')[0],
repo: 'thegeeklab/${DRONE_REPO_NAME}',
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
},
when: {
ref: ['refs/heads/main', 'refs/tags/**'],
},
depends_on: ['tags'],
},
2021-01-18 19:49:15 +00:00
{
name: 'publish-quay',
2021-01-18 20:07:55 +00:00
image: 'thegeeklab/drone-docker-buildx:20',
2021-01-18 19:49:15 +00:00
settings: {
2021-01-18 19:53:57 +00:00
dockerfile: 'Dockerfile.' + std.split(arch, '_')[0],
2021-01-18 19:49:15 +00:00
registry: 'quay.io',
repo: 'quay.io/thegeeklab/${DRONE_REPO_NAME}',
username: { from_secret: 'quay_username' },
password: { from_secret: 'quay_password' },
},
when: {
ref: ['refs/heads/main', 'refs/tags/**'],
},
depends_on: ['tags'],
},
2021-01-18 19:41:40 +00:00
],
depends_on: [
'test',
],
trigger: {
ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
},
};
local PipelineNotifications = {
kind: 'pipeline',
name: 'notifications',
platform: {
os: 'linux',
arch: 'amd64',
},
steps: [
{
image: 'plugins/manifest',
name: 'manifest-dockerhub',
settings: {
ignore_missing: true,
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
spec: 'manifest.tmpl',
},
when: {
status: ['success'],
},
},
2021-01-18 19:49:15 +00:00
{
image: 'plugins/manifest',
name: 'manifest-quay',
settings: {
ignore_missing: true,
username: { from_secret: 'quay_username' },
password: { from_secret: 'quay_password' },
spec: 'manifest-quay.tmpl',
},
when: {
status: ['success'],
},
},
2021-01-18 19:41:40 +00:00
{
name: 'pushrm-dockerhub',
pull: 'always',
image: 'chko/docker-pushrm:1',
environment: {
DOCKER_PASS: {
from_secret: 'docker_password',
},
DOCKER_USER: {
from_secret: 'docker_username',
},
PUSHRM_FILE: 'README.md',
PUSHRM_SHORT: 'Custom Alpine image including a common toolset',
PUSHRM_TARGET: 'thegeeklab/${DRONE_REPO_NAME}',
2021-01-18 19:49:15 +00:00
},
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}',
2021-01-18 19:41:40 +00:00
},
when: {
status: ['success'],
},
},
{
name: 'matrix',
2021-09-19 19:48:16 +00:00
image: 'thegeeklab/drone-matrix',
2021-01-18 19:41:40 +00:00
settings: {
homeserver: { from_secret: 'matrix_homeserver' },
roomid: { from_secret: 'matrix_roomid' },
2021-09-22 07:22:31 +00:00
template: 'Status: **{{ build.Status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.Link }}){{#if build.Branch}} ({{ build.Branch }}){{/if}} by {{ commit.Author }}<br/> Message: {{ commit.Message.Title }}',
2021-01-18 19:41:40 +00:00
username: { from_secret: 'matrix_username' },
password: { from_secret: 'matrix_password' },
},
when: {
status: ['success', 'failure'],
},
},
],
depends_on: [
'build-container-amd64',
'build-container-arm64',
'build-container-arm',
],
trigger: {
ref: ['refs/heads/main', 'refs/tags/**'],
status: ['success', 'failure'],
},
};
[
PipelineTest,
PipelineBuildContainer(arch='amd64'),
PipelineBuildContainer(arch='arm64_v8'),
PipelineBuildContainer(arch='arm_v7'),
PipelineNotifications,
]