xoxys.nginx/.drone.jsonnet

103 lines
2.7 KiB
Plaintext
Raw Normal View History

2019-03-01 10:48:32 +00:00
local AnsibleVersions(version="latest", package="ansible") = {
name: "ansible-" + version,
image: "python:3.7",
pull: "always",
environment: {
PY_COLORS: 1
},
commands: [
"pip install " + package + " ansible-later -qq",
"git clone https://gitea.rknet.org/ansible/ansible-later-policy.git ~/policy",
"git ls-files *[^LICENSE,.md,molecule,.ini] | xargs ansible-later -c ~/policy/config.ini"
],
depends_on: [
"clone",
],
};
local PipelineLinting = {
2019-03-01 10:48:32 +00:00
kind: "pipeline",
name: "linting",
platform: {
os: "linux",
arch: "amd64",
},
steps: [
AnsibleVersions(version="latest", package="ansible"),
AnsibleVersions(version="master", package="git+https://github.com/ansible/ansible.git@devel"),
],
};
local PipelineDeployment = {
kind: "pipeline",
name: "deployment",
2019-03-01 10:48:32 +00:00
platform: {
os: "linux",
arch: "amd64",
},
workspace: {
base: "/drone/src",
path: "xoxys.nginx"
},
steps: [
{
name: "molecule",
image: "xoxys/molecule:gce",
pull: "always",
environment: {
GCE_SSH_KEY: { "from_secret": "gce_ssh_key" },
GCE_SERVICE_ACCOUNT_EMAIL: { "from_secret": "gce_service_account_email" },
GCE_PROJECT_ID: { "from_secret": "gce_project_id" },
GCE_CREDENTIALS_JSON: { "from_secret": "gce_credentials_json" },
GCE_SSH_USER: { "from_secret": "gce_ssh_user" },
2019-03-13 07:04:06 +00:00
GCE_CREDENTIALS_FILE: "/root/ansible-testing.json",
2019-03-12 10:47:30 +00:00
MOLECULE_CUSTOM_MODULES_REPO: "https://gitea.rknet.org/ansible/custom_modules",
2019-03-01 10:48:32 +00:00
PY_COLORS: 1
},
commands: [
2019-03-12 12:34:32 +00:00
"/bin/bash /docker-entrypoint.sh",
2019-03-01 10:48:32 +00:00
"molecule create --scenario-name gce-centos-7",
"molecule converge --scenario-name gce-centos-7",
"molecule verify --scenario-name gce-centos-7",
"molecule destroy --scenario-name gce-centos-7",
],
},
],
depends_on: [
"linting",
],
2019-03-01 10:48:32 +00:00
};
local PipelineNotifications = {
kind: "pipeline",
name: "notifications",
platform: {
os: "linux",
arch: "amd64",
},
steps: [
{
image: "plugins/matrix",
settings: {
homeserver: "https://matrix.rknet.org",
roomid: "MtidqQXWWAtQcByBhH:rknet.org",
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" },
},
},
],
depends_on: [
"deployment",
2019-03-01 10:48:32 +00:00
],
trigger: {
event: [ "push", "tag" ],
status: [ "success", "failure" ],
},
};
[
PipelineLinting,
PipelineDeployment
2019-03-01 10:48:32 +00:00
]