Refactor CI pipelien and enable molecule testing #1
58
.drone.1.yml
Normal file
58
.drone.1.yml
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
name: default
|
||||||
|
|
||||||
|
workspace:
|
||||||
|
base: /drone/src
|
||||||
|
path: xoxys.nginx
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: ansible-latest
|
||||||
|
image: python:2.7
|
||||||
|
pull: always
|
||||||
|
environment:
|
||||||
|
PY_COLORS: 1
|
||||||
|
commands:
|
||||||
|
- pip install ansible 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 ]
|
||||||
|
|
||||||
|
- name: ansible-master
|
||||||
|
image: python:2.7
|
||||||
|
pull: always
|
||||||
|
environment:
|
||||||
|
PY_COLORS: 1
|
||||||
|
commands:
|
||||||
|
- pip install git+https://github.com/ansible/ansible.git@devel -qq
|
||||||
|
- pip install 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 ]
|
||||||
|
|
||||||
|
- 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
|
||||||
|
GCE_CREDENTIALS_FILE: $HOME/ansible-testing.json
|
||||||
|
PY_COLORS: 1
|
||||||
|
commands:
|
||||||
|
- mkdir ./library/
|
||||||
|
- git clone https://gitea.rknet.org/ansible/custom_modules ./library/
|
||||||
|
- echo "$GCE_SSH_KEY" > $HOME/.ssh/google_compute_engine
|
||||||
|
- chmod 600 $HOME/.ssh/google_compute_engine
|
||||||
|
- echo "$GCE_CREDENTIALS_JSON" > $HOME/ansible-testing.json
|
||||||
|
- 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
|
90
.drone.jsonnet
Normal file
90
.drone.jsonnet
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
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 PipelineTesting = {
|
||||||
|
kind: "pipeline",
|
||||||
|
name: "testing",
|
||||||
|
platform: {
|
||||||
|
os: "linux",
|
||||||
|
arch: "amd64",
|
||||||
|
},
|
||||||
|
workspace: {
|
||||||
|
base: "/drone/src",
|
||||||
|
path: "xoxys.nginx"
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
AnsibleVersions(version="latest", package="ansible"),
|
||||||
|
AnsibleVersions(version="master", package="git+https://github.com/ansible/ansible.git@devel"),
|
||||||
|
{
|
||||||
|
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" },
|
||||||
|
GCE_CREDENTIALS_FILE: "$HOME/ansible-testing.json",
|
||||||
|
PY_COLORS: 1
|
||||||
|
},
|
||||||
|
commands: [
|
||||||
|
"mkdir ./library/",
|
||||||
|
"git clone https://gitea.rknet.org/ansible/custom_modules ./library/",
|
||||||
|
"echo \"$GCE_SSH_KEY\" > $HOME/.ssh/google_compute_engine",
|
||||||
|
"chmod 600 $HOME/.ssh/google_compute_engine",
|
||||||
|
"echo \"$GCE_CREDENTIALS_JSON\" > $HOME/ansible-testing.json",
|
||||||
|
"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",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
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: [
|
||||||
|
"testing",
|
||||||
|
],
|
||||||
|
trigger: {
|
||||||
|
event: [ "push", "tag" ],
|
||||||
|
status: [ "success", "failure" ],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
[
|
||||||
|
PipelineTesting,
|
||||||
|
]
|
65
.drone.yml
65
.drone.yml
@ -1,6 +1,10 @@
|
|||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
name: default
|
name: testing
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
workspace:
|
workspace:
|
||||||
base: /drone/src
|
base: /drone/src
|
||||||
@ -8,51 +12,54 @@ workspace:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: ansible-latest
|
- name: ansible-latest
|
||||||
image: python:2.7
|
|
||||||
pull: always
|
pull: always
|
||||||
environment:
|
image: python:3.7
|
||||||
PY_COLORS: 1
|
|
||||||
commands:
|
commands:
|
||||||
- pip install ansible ansible-later -qq
|
- pip install ansible ansible-later -qq
|
||||||
- git clone https://gitea.rknet.org/ansible/ansible-later-policy.git ~/policy
|
- 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
|
- "git ls-files *[^LICENSE,.md,molecule,.ini] | xargs ansible-later -c ~/policy/config.ini"
|
||||||
depends_on: [ clone ]
|
environment:
|
||||||
|
PY_COLORS: 1
|
||||||
|
depends_on:
|
||||||
|
- clone
|
||||||
|
|
||||||
- name: ansible-master
|
- name: ansible-master
|
||||||
image: python:2.7
|
|
||||||
pull: always
|
pull: always
|
||||||
|
image: python:3.7
|
||||||
|
commands:
|
||||||
|
- "pip install git+https://github.com/ansible/ansible.git@devel 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"
|
||||||
environment:
|
environment:
|
||||||
PY_COLORS: 1
|
PY_COLORS: 1
|
||||||
commands:
|
depends_on:
|
||||||
- pip install git+https://github.com/ansible/ansible.git@devel -qq
|
- clone
|
||||||
- pip install 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 ]
|
|
||||||
|
|
||||||
- name: molecule
|
- name: molecule
|
||||||
image: xoxys/molecule:gce
|
|
||||||
pull: always
|
pull: always
|
||||||
environment:
|
image: xoxys/molecule:gce
|
||||||
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
|
|
||||||
GCE_CREDENTIALS_FILE: $HOME/ansible-testing.json
|
|
||||||
PY_COLORS: 1
|
|
||||||
commands:
|
commands:
|
||||||
- mkdir ./library/
|
- mkdir ./library/
|
||||||
- git clone https://gitea.rknet.org/ansible/custom_modules ./library/
|
- git clone https://gitea.rknet.org/ansible/custom_modules ./library/
|
||||||
- echo "$GCE_SSH_KEY" > $HOME/.ssh/google_compute_engine
|
- "echo \"$GCE_SSH_KEY\" > $HOME/.ssh/google_compute_engine"
|
||||||
- chmod 600 $HOME/.ssh/google_compute_engine
|
- chmod 600 $HOME/.ssh/google_compute_engine
|
||||||
- echo "$GCE_CREDENTIALS_JSON" > $HOME/ansible-testing.json
|
- "echo \"$GCE_CREDENTIALS_JSON\" > $HOME/ansible-testing.json"
|
||||||
- molecule create --scenario-name gce-centos-7
|
- molecule create --scenario-name gce-centos-7
|
||||||
- molecule converge --scenario-name gce-centos-7
|
- molecule converge --scenario-name gce-centos-7
|
||||||
- molecule verify --scenario-name gce-centos-7
|
- molecule verify --scenario-name gce-centos-7
|
||||||
- molecule destroy --scenario-name gce-centos-7
|
- molecule destroy --scenario-name gce-centos-7
|
||||||
|
environment:
|
||||||
|
GCE_CREDENTIALS_FILE: $HOME/ansible-testing.json
|
||||||
|
GCE_CREDENTIALS_JSON:
|
||||||
|
from_secret: gce_credentials_json
|
||||||
|
GCE_PROJECT_ID:
|
||||||
|
from_secret: gce_project_id
|
||||||
|
GCE_SERVICE_ACCOUNT_EMAIL:
|
||||||
|
from_secret: gce_service_account_email
|
||||||
|
GCE_SSH_KEY:
|
||||||
|
from_secret: gce_ssh_key
|
||||||
|
GCE_SSH_USER:
|
||||||
|
from_secret: gce_ssh_user
|
||||||
|
PY_COLORS: 1
|
||||||
|
|
||||||
|
...
|
||||||
|
13
.yamllint
13
.yamllint
@ -1,13 +0,0 @@
|
|||||||
extends: default
|
|
||||||
|
|
||||||
rules:
|
|
||||||
braces:
|
|
||||||
max-spaces-inside: 1
|
|
||||||
level: error
|
|
||||||
brackets:
|
|
||||||
max-spaces-inside: 1
|
|
||||||
level: error
|
|
||||||
line-length: disable
|
|
||||||
# NOTE(retr0h): Templates no longer fail this lint rule.
|
|
||||||
# Uncomment if running old Molecule templates.
|
|
||||||
# truthy: disable
|
|
@ -22,9 +22,7 @@ verifier:
|
|||||||
lint:
|
lint:
|
||||||
name: flake8
|
name: flake8
|
||||||
ansible:
|
ansible:
|
||||||
raw_env_vars:
|
|
||||||
ANSIBLE_TIMEOUT: 60
|
|
||||||
ansiblecfg_defaults:
|
ansiblecfg_defaults:
|
||||||
force_color: true
|
force_color: true
|
||||||
nocolor: false
|
|
||||||
roles_path: /drone/src
|
roles_path: /drone/src
|
||||||
|
timeout: 60
|
||||||
|
Loading…
Reference in New Issue
Block a user