local PipelineBuild(arch="amd64") = {
kind: "pipeline",
name: "build-" + arch,
platform: {
os: "linux",
arch: arch,
},
steps: [
{
name: "dryrun",
image: "plugins/docker:18-linux-" + arch,
pull: "always",
settings: {
dry_run: true,
dockerfile: "Dockerfile",
repo: "xoxys/molecule",
username: { from_secret: "docker_username" },
password: { from_secret: "docker_password" },
},
},
{
name: "publish",
image: "plugins/docker:18-linux-" + arch,
pull: "always",
settings: {
auto_tag: true,
auto_tag_suffix: arch,
dockerfile: "Dockerfile",
repo: "xoxys/molecule",
username: { from_secret: "docker_username" },
password: { from_secret: "docker_password" },
},
when: {
ref: [
"refs/heads/master",
"refs/tags/**",
],
},
},
],
};
local PipelineNotifications(depends_on=[]) = {
kind: "pipeline",
name: "notifications",
platform: {
os: "linux",
arch: "amd64",
},
steps: [
{
image: "plugins/manifest",
name: "manifest",
pull: "always",
settings: {
ignore_missing: true,
username: { from_secret: "docker_username" },
password: { from_secret: "docker_password" },
spec: "docker/manifest.tmpl",
},
when: {
ref: [
"refs/heads/master",
"refs/tags/**",
],
},
},
{
name: "readme",
image: "sheogorath/readme-to-dockerhub",
pull: "always",
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: {
ref: [
"refs/heads/master",
"refs/tags/**",
],
},
},
{
name: "microbadger",
image: "plugins/webhook",
pull: "always",
settings: {
urls: { from_secret: "microbadger_url" },
},
when: {
ref: [
"refs/heads/master",
"refs/tags/**",
],
},
},
{
name: "matrix",
image: "plugins/matrix",
pull: "always",
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" ],
ref: [
"refs/heads/master",
"refs/tags/**",
],
},
},
],
depends_on: depends_on,
};
[
PipelineBuild(arch="amd64"),
PipelineNotifications(depends_on=[
"build-amd64",
])
]