refactoring
This commit is contained in:
parent
ae4010b6a1
commit
89f60c8795
173
.drone.jsonnet
173
.drone.jsonnet
@ -1,129 +1,132 @@
|
||||
local PipelineBuild(arch="amd64") = {
|
||||
kind: "pipeline",
|
||||
name: "build-" + arch,
|
||||
local PipelineBuild(arch='amd64') = {
|
||||
kind: 'pipeline',
|
||||
name: 'build-' + arch,
|
||||
platform: {
|
||||
os: "linux",
|
||||
os: 'linux',
|
||||
arch: arch,
|
||||
},
|
||||
steps: [
|
||||
{
|
||||
name: "dryrun",
|
||||
image: "plugins/docker:18-linux-" + arch,
|
||||
pull: "always",
|
||||
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" },
|
||||
},
|
||||
},
|
||||
{
|
||||
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" },
|
||||
dockerfile: 'Dockerfile.' + arch,
|
||||
repo: 'xoxys/molecule',
|
||||
username: { from_secret: 'docker_username' },
|
||||
password: { from_secret: 'docker_password' },
|
||||
},
|
||||
when: {
|
||||
ref: [
|
||||
"refs/heads/master",
|
||||
"refs/tags/**",
|
||||
'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",
|
||||
kind: 'pipeline',
|
||||
name: 'notifications',
|
||||
platform: {
|
||||
os: "linux",
|
||||
arch: "amd64",
|
||||
os: 'linux',
|
||||
arch: 'amd64',
|
||||
},
|
||||
steps: [
|
||||
{
|
||||
image: "plugins/manifest",
|
||||
name: "manifest",
|
||||
pull: "always",
|
||||
image: 'plugins/manifest',
|
||||
name: 'manifest',
|
||||
settings: {
|
||||
ignore_missing: true,
|
||||
username: { from_secret: "docker_username" },
|
||||
password: { from_secret: "docker_password" },
|
||||
spec: "manifest.tmpl",
|
||||
},
|
||||
when: {
|
||||
ref: [
|
||||
"refs/heads/master",
|
||||
"refs/tags/**",
|
||||
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",
|
||||
pull: "always",
|
||||
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"
|
||||
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/**",
|
||||
status: [
|
||||
'success',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "microbadger",
|
||||
image: "plugins/webhook",
|
||||
pull: "always",
|
||||
name: 'matrix',
|
||||
image: 'plugins/matrix',
|
||||
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 }}**<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" },
|
||||
},
|
||||
when: {
|
||||
status: [ "success", "failure" ],
|
||||
ref: [
|
||||
"refs/heads/master",
|
||||
"refs/tags/**",
|
||||
],
|
||||
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"),
|
||||
PipelineBuild(arch='amd64'),
|
||||
PipelineNotifications(depends_on=[
|
||||
"build-amd64",
|
||||
])
|
||||
'build-amd64',
|
||||
]),
|
||||
]
|
||||
|
68
.drone.yml
68
.drone.yml
@ -8,24 +8,25 @@ platform:
|
||||
|
||||
steps:
|
||||
- name: dryrun
|
||||
pull: always
|
||||
image: plugins/docker:18-linux-amd64
|
||||
settings:
|
||||
dockerfile: Dockerfile
|
||||
dockerfile: Dockerfile.amd64
|
||||
dry_run: true
|
||||
password:
|
||||
from_secret: docker_password
|
||||
repo: xoxys/molecule
|
||||
username:
|
||||
from_secret: docker_username
|
||||
when:
|
||||
ref:
|
||||
- refs/pull/**
|
||||
|
||||
- name: publish
|
||||
pull: always
|
||||
image: plugins/docker:18-linux-amd64
|
||||
settings:
|
||||
auto_tag: true
|
||||
auto_tag_suffix: amd64
|
||||
dockerfile: Dockerfile
|
||||
dockerfile: Dockerfile.amd64
|
||||
password:
|
||||
from_secret: docker_password
|
||||
repo: xoxys/molecule
|
||||
@ -36,6 +37,20 @@ steps:
|
||||
- refs/heads/master
|
||||
- refs/tags/**
|
||||
|
||||
- name: publish-gitea
|
||||
pull: always
|
||||
image: plugins/gitea-release
|
||||
settings:
|
||||
api_key:
|
||||
from_secret: gitea_token
|
||||
base_url: https://gitea.rknet.org
|
||||
note: CHANGELOG.md
|
||||
overwrite: true
|
||||
title: ${DRONE_TAG}
|
||||
when:
|
||||
ref:
|
||||
- refs/tags/**
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
name: notifications
|
||||
@ -46,22 +61,21 @@ platform:
|
||||
|
||||
steps:
|
||||
- name: manifest
|
||||
pull: always
|
||||
image: plugins/manifest
|
||||
settings:
|
||||
ignore_missing: true
|
||||
password:
|
||||
from_secret: docker_password
|
||||
spec: manifest.tmpl
|
||||
tags:
|
||||
- ${DRONE_TAG}
|
||||
- ${DRONE_TAG%-*}
|
||||
- ${DRONE_TAG%.*}
|
||||
- ${DRONE_TAG%%.*}
|
||||
username:
|
||||
from_secret: docker_username
|
||||
when:
|
||||
ref:
|
||||
- refs/heads/master
|
||||
- refs/tags/**
|
||||
|
||||
- name: readme
|
||||
pull: always
|
||||
image: sheogorath/readme-to-dockerhub
|
||||
environment:
|
||||
DOCKERHUB_PASSWORD:
|
||||
@ -73,23 +87,10 @@ steps:
|
||||
README_PATH: README.md
|
||||
SHORT_DESCRIPTION: Molecule - Automated Ansible roles testing
|
||||
when:
|
||||
ref:
|
||||
- refs/heads/master
|
||||
- refs/tags/**
|
||||
|
||||
- name: microbadger
|
||||
pull: always
|
||||
image: plugins/webhook
|
||||
settings:
|
||||
urls:
|
||||
from_secret: microbadger_url
|
||||
when:
|
||||
ref:
|
||||
- refs/heads/master
|
||||
- refs/tags/**
|
||||
status:
|
||||
- success
|
||||
|
||||
- name: matrix
|
||||
pull: always
|
||||
image: plugins/matrix
|
||||
settings:
|
||||
homeserver:
|
||||
@ -101,19 +102,20 @@ steps:
|
||||
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
|
||||
when:
|
||||
ref:
|
||||
- refs/heads/master
|
||||
- refs/tags/**
|
||||
status:
|
||||
- success
|
||||
- failure
|
||||
|
||||
trigger:
|
||||
ref:
|
||||
- refs/heads/master
|
||||
- refs/tags/**
|
||||
status:
|
||||
- success
|
||||
- failure
|
||||
|
||||
depends_on:
|
||||
- build-amd64
|
||||
|
||||
---
|
||||
kind: signature
|
||||
hmac: 63cc04ce09b24f38ae1b5eb3664f6585f52a434cb2e2520abd9e4208b9f49ee3
|
||||
hmac: 569724d921f5f116f046c6a23305a82ea62621cd41f442372d577b7e1023988f
|
||||
|
||||
...
|
||||
|
1
CHANGELOG.md
Normal file
1
CHANGELOG.md
Normal file
@ -0,0 +1 @@
|
||||
* Inital release
|
32
Dockerfile
32
Dockerfile
@ -6,19 +6,33 @@ LABEL maintainer="Robert Kaussow <mail@geeklabor.de>" \
|
||||
org.label-schema.vendor="Robert Kaussow" \
|
||||
org.label-schema.schema-version="1.0"
|
||||
|
||||
ENV PY_COLORS=1
|
||||
ENV USER=root
|
||||
ENV PATH=/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin
|
||||
ARG ANSIBLE_VERSION=2.9.0
|
||||
ARG MOLECULE_VERSION=latest
|
||||
|
||||
ENV PY_COLORS=1 \
|
||||
USER=root \
|
||||
PATH=/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin
|
||||
|
||||
COPY overlay/ /
|
||||
|
||||
RUN \
|
||||
apk add --update --no-cache --virtual .build-deps gcc make libffi-dev musl-dev \
|
||||
openssl-dev python-dev && \
|
||||
RUN apk add --update --no-cache --virtual .build-deps gcc make libffi-dev musl-dev \
|
||||
openssl-dev python3-dev && \
|
||||
apk add --update --no-cache git openssh-client && \
|
||||
pip install --upgrade --no-cache-dir pip setuptools && \
|
||||
pip install --no-cache-dir ansible~=2.9.0 pycrypto boto boto3 botocore hcloud \
|
||||
apache-libcloud molecule && \
|
||||
# Required to fix hcloud dependency:
|
||||
# hcloud 1.6.3 has requirement requests<2.23,>=2.20, but you'll have requests 2.23.0
|
||||
echo "Installing ansible 'v$ANSIBLE_VERSION' ..." && \
|
||||
pip install -qq --upgrade --no-cache-dir pip setuptools requests~=2.22.0 && \
|
||||
pip install -qq --no-cache-dir ansible~="$ANSIBLE_VERSION" && \
|
||||
echo "Installing requirements ..." && \
|
||||
MOLECULE_MAJOR="${MOLECULE_VERSION%%.*}" && \
|
||||
pip install -qq --no-cache-dir -r /root/requirements.txt && \
|
||||
if [ -z "${MOLECULE_MAJOR//[0-9]}" ] && [ -n "$MOLECULE_MAJOR" ]; then \
|
||||
echo "Installing molecule 'v$MOLECULE_VERSION' ..." && \
|
||||
pip install -qq --no-cache-dir molecule~="$MOLECULE_VERSION"; \
|
||||
else \
|
||||
echo "Installing latest molecule ..." && \
|
||||
pip install -qq --no-cache-dir molecule; \
|
||||
fi && \
|
||||
apk del .build-deps && \
|
||||
rm -rf /var/cache/apk/* && \
|
||||
rm -rf /tmp/* && \
|
||||
|
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) <year> <copyright holders>
|
||||
Copyright (c) 2020 Robert Kaussow <mail@geeklabor.de>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
26
README.md
26
README.md
@ -1,14 +1,26 @@
|
||||
# molecule
|
||||
# [molecule](https://gitea.rknet.org/docker/molecule)
|
||||
|
||||
[![Build Status](https://drone.rknet.org/api/badges/docker/molecule/status.svg)](https://drone.rknet.org/docker/molecule/)
|
||||
[![](https://images.microbadger.com/badges/image/xoxys/molecule.svg)](https://microbadger.com/images/xoxys/molecule "Get your own image badge on microbadger.com")
|
||||
[![Build Status](https://img.shields.io/drone/build/docker/molecule?logo=drone&server=https%3A%2F%2Fdrone.rknet.org)](https://drone.rknet.org/docker/molecule)
|
||||
[![Docker Hub](https://img.shields.io/badge/docker-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/xoxys/molecule)
|
||||
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
|
||||
|
||||
Docker image to automate Ansible deployment tests with Molecule. The image was build to use with any docker based CI system.
|
||||
|
||||
## Environment variables
|
||||
|
||||
`MOLECULE_CUSTOM_MODULES_REPO`
|
||||
If you use custom modules you can specify a git repo containing these files. The repo will be cloned so ansible can use it.
|
||||
```Shell
|
||||
# If you use custom modules you can specify a git repo containing these files.
|
||||
# The repo will be cloned so ansible can use it.
|
||||
MOLECULE_CUSTOM_MODULES_REPO=
|
||||
|
||||
`MOLECULE_CUSTOM_FILTERS_REPO`
|
||||
If you have custom filters you can specify a git repo containing these files.
|
||||
# If you have custom filters you can specify a git repo containing these files.
|
||||
MOLECULE_CUSTOM_FILTERS_REPO=
|
||||
```
|
||||
|
||||
### License
|
||||
|
||||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
||||
|
||||
### Maintainers and Contributors
|
||||
|
||||
[Robert Kaussow](https://gitea.rknet.org/xoxys)
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/usr/bin/env sh
|
||||
set -eo pipefail
|
||||
|
||||
DIR=$(pwd)
|
||||
|
15
overlay/root/requirements.txt
Normal file
15
overlay/root/requirements.txt
Normal file
@ -0,0 +1,15 @@
|
||||
# linter
|
||||
testinfra
|
||||
flake8
|
||||
yamllint
|
||||
ansible-lint
|
||||
|
||||
# cloud provider deps
|
||||
boto
|
||||
boto3
|
||||
botocore
|
||||
apache-libcloud
|
||||
hcloud
|
||||
|
||||
# misc
|
||||
pycrypto
|
Reference in New Issue
Block a user