alpine/.drone.jsonnet

198 lines
4.9 KiB
Plaintext
Raw Normal View History

2021-01-10 14:19:12 +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',
2021-01-10 14:22:47 +00:00
name: 'build-container-' + std.split(arch, '_')[0],
2021-01-10 14:19:12 +00:00
platform: {
os: 'linux',
arch: 'amd64',
},
steps: [
{
name: 'tags',
image: 'thegeeklab/docker-autotag',
2021-01-10 14:19:12 +00:00
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],
2021-01-10 14:19:12 +00:00
},
},
{
name: 'dryrun',
2021-01-18 20:10:57 +00:00
image: 'thegeeklab/drone-docker-buildx:20',
2021-01-10 20:52:12 +00:00
settings: {
dry_run: true,
dockerfile: 'Dockerfile.' + std.split(arch, '_')[0],
2021-01-10 20:52:12 +00:00
platforms: [
'linux/' + std.strReplace(arch, '_', '/'),
],
2021-01-18 20:10:57 +00:00
repo: 'thegeeklab/${DRONE_REPO_NAME}',
2021-01-10 20:52:12 +00:00
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
2021-01-10 14:50:58 +00:00
},
depends_on: ['tags'],
2021-01-10 14:19:12 +00:00
when: {
ref: ['refs/pull/**'],
},
},
{
name: 'publish-dockerhub',
2021-01-18 20:10:57 +00:00
image: 'thegeeklab/drone-docker-buildx:20',
settings: {
dockerfile: 'Dockerfile.' + std.split(arch, '_')[0],
2021-01-18 20:10:57 +00:00
repo: 'thegeeklab/${DRONE_REPO_NAME}',
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
2021-01-10 14:19:12 +00:00
},
when: {
ref: ['refs/heads/main', 'refs/tags/**'],
},
depends_on: ['tags'],
},
2021-01-18 20:10:57 +00:00
{
name: 'publish-quay',
image: 'thegeeklab/drone-docker-buildx:20',
settings: {
dockerfile: 'Dockerfile.' + std.split(arch, '_')[0],
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-10 14:19:12 +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 20:10:57 +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-10 14:19:12 +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: 'Rootless Alpine base image',
2021-01-18 20:10:57 +00:00
PUSHRM_TARGET: 'thegeeklab/${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}',
2021-01-10 14:19:12 +00:00
},
when: {
status: ['success'],
},
},
{
name: 'matrix',
image: 'plugins/matrix',
settings: {
homeserver: { from_secret: 'matrix_homeserver' },
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 }}',
username: { from_secret: 'matrix_username' },
password: { from_secret: 'matrix_password' },
},
when: {
status: ['success', 'failure'],
},
},
],
depends_on: [
2021-01-10 14:22:47 +00:00
'build-container-amd64',
'build-container-arm64',
'build-container-arm',
2021-01-10 14:19:12 +00:00
],
trigger: {
ref: ['refs/heads/main', 'refs/tags/**'],
status: ['success', 'failure'],
},
};
[
PipelineTest,
PipelineBuildContainer(arch='amd64'),
PipelineBuildContainer(arch='arm64_v8'),
PipelineBuildContainer(arch='arm_v7'),
PipelineNotifications,
]