molecule/.drone.jsonnet

133 lines
3.1 KiB
Plaintext

local PipelineBuild(arch='amd64') = {
kind: 'pipeline',
name: 'build-' + arch,
platform: {
os: 'linux',
arch: arch,
},
steps: [
{
name: 'dryrun',
image: 'plugins/docker:18-linux-' + arch,
settings: {
dry_run: true,
dockerfile: 'Dockerfile.' + arch,
repo: 'xoxys/molecule',
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
},
when: {
ref: [
'refs/pull/**',
],
},
},
{
name: 'publish',
image: 'plugins/docker:18-linux-' + arch,
settings: {
auto_tag: true,
auto_tag_suffix: arch,
dockerfile: 'Dockerfile.' + arch,
repo: 'xoxys/molecule',
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
},
when: {
ref: [
'refs/heads/master',
'refs/tags/**',
],
},
},
{
name: 'publish-gitea',
image: 'plugins/gitea-release',
pull: 'always',
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/**'],
},
},
],
};
local PipelineNotifications(depends_on=[]) = {
kind: 'pipeline',
name: 'notifications',
platform: {
os: 'linux',
arch: 'amd64',
},
steps: [
{
image: 'plugins/manifest',
name: 'manifest',
settings: {
ignore_missing: true,
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',
environment: {
DOCKERHUB_USERNAME: { from_secret: 'docker_username' },
DOCKERHUB_PASSWORD: { from_secret: 'docker_password' },
DOCKERHUB_REPO_PREFIX: 'xoxys',
DOCKERHUB_REPO_NAME: 'molecule',
README_PATH: 'README.md',
SHORT_DESCRIPTION: 'Molecule - Automated Ansible roles testing',
},
when: {
status: [
'success',
],
},
},
{
name: 'matrix',
image: 'plugins/matrix',
settings: {
template: 'Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: {{ build.message }}',
roomid: { from_secret: 'matrix_roomid' },
homeserver: { from_secret: 'matrix_homeserver' },
username: { from_secret: 'matrix_username' },
password: { from_secret: 'matrix_password' },
},
},
],
depends_on: depends_on,
trigger: {
ref: [
'refs/heads/master',
'refs/tags/**',
],
status: [
'success',
'failure',
],
},
};
[
PipelineBuild(arch='amd64'),
PipelineNotifications(depends_on=[
'build-amd64',
]),
]