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',
repo: 'xoxys/molecule',
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
build_args: {
MOLECULE_VERSION: "${DRONE_TAG%-*}",
},
},
when: {
ref: [
'refs/pull/**',
],
},
},
{
name: 'publish',
image: 'plugins/docker:18-linux-' + arch,
settings: {
auto_tag: true,
auto_tag_suffix: arch,
dockerfile: 'Dockerfile',
repo: 'xoxys/molecule',
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
build_args: {
MOLECULE_VERSION: "${DRONE_TAG%-*}",
},
},
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 }}**
Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}
Message: {{ build.message }}',
roomid: { from_secret: 'matrix_roomid' },
homeserver: { from_secret: 'matrix_homeserver' },
username: { from_secret: 'matrix_username' },
password: { from_secret: 'matrix_password' },
},
when: {
status: [
'success',
'failure',
],
},
},
],
depends_on: depends_on,
trigger: {
ref: [
'refs/heads/master',
'refs/tags/**',
],
status: [
'success',
'failure',
],
},
};
[
PipelineBuild(arch='amd64'),
PipelineNotifications(depends_on=[
'build-amd64',
]),
]