Compare commits
27 Commits
Author | SHA1 | Date | |
---|---|---|---|
aba04f8660 | |||
7bbec1352e | |||
ed9a72f79c | |||
a5c7e7c8e9 | |||
179039bfba | |||
c5df397953 | |||
21e5a9515e | |||
5eb7697e36 | |||
9b14322d25 | |||
8eae49e6a9 | |||
6b1f5d8988 | |||
1f22c52ca1 | |||
476fa369af | |||
eb0bd02789 | |||
8730d58db7 | |||
7acb1dc04f | |||
6f75b743f2 | |||
b8c50c0e8d | |||
282d82460a | |||
4c72431847 | |||
ac8d46684b | |||
b1782e1b38 | |||
02187e9403 | |||
f04637077b | |||
b549d3a87d | |||
76b79057e5 | |||
9495f95f95 |
@ -1,7 +1,2 @@
|
|||||||
skip_list:
|
skip_list:
|
||||||
- yaml[line-length]
|
- yaml[line-length]
|
||||||
- yaml[colons]
|
|
||||||
|
|
||||||
exclude_paths:
|
|
||||||
- .drone.yml
|
|
||||||
- requirements.yml
|
|
||||||
|
106
.drone.yml
106
.drone.yml
@ -1,90 +1,46 @@
|
|||||||
---
|
---
|
||||||
global-variables:
|
name: Ansible Playbook Lint and Test Execution
|
||||||
ansible_image: &ansible_image "gitea.thezengarden.net/podman/images/ansible-dev:latest"
|
|
||||||
ansible_inventory: &ansible_inventory "-i 127.0.0.1, --connection=local"
|
|
||||||
ansible_playbook: &ansible_playbook "hello.yml"
|
|
||||||
|
|
||||||
|
|
||||||
name: run_ansible_tests
|
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
|
|
||||||
|
|
||||||
environment:
|
|
||||||
ANSIBLE_INVENTORY : *ansible_inventory
|
|
||||||
ANSIBLE_PLAYBOOK : *ansible_playbook
|
|
||||||
ANSIBLE_DOCKER_IMAGE : *ansible_image
|
|
||||||
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: "ansible_environment_verify"
|
- name: Install requirements, lint, and run Ansible playbook
|
||||||
image: *ansible_image
|
image: gitea.thezengarden.net/podman/images/ansible-dev:latest
|
||||||
|
environment:
|
||||||
|
GITEA_TOKEN:
|
||||||
|
from_secret: gitea_token
|
||||||
|
ANSIBLE_INVENTORY:
|
||||||
|
from_secret: ansible_inventory
|
||||||
commands:
|
commands:
|
||||||
- git log -1
|
# - ansible-galaxy install -r $DRONE_WORKSPACE/requirements.yml
|
||||||
- ansible --version
|
- ansible-lint --offline $DRONE_WORKSPACE
|
||||||
- ansible-lint --version
|
- ansible-playbook -v -i $ANSIBLE_INVENTORY $DRONE_WORKSPACE/hello.yml
|
||||||
|
- echo "Build complete and successful for $DRONE_REPO_NAME"
|
||||||
when:
|
when:
|
||||||
branch:
|
branch:
|
||||||
|
- development
|
||||||
|
event:
|
||||||
|
include:
|
||||||
|
- push
|
||||||
exclude:
|
exclude:
|
||||||
- main
|
- pull_request
|
||||||
event: [push]
|
|
||||||
|
|
||||||
|
|
||||||
- name: "ansible_galaxy_requirements"
|
- name: push commit
|
||||||
image: *ansible_image
|
image: appleboy/drone-git-push
|
||||||
commands:
|
settings:
|
||||||
- ansible-galaxy install -r requirements.yml
|
branch: testing
|
||||||
when:
|
remote: gitea@10.10.10.109:chris/drone-test-1.git
|
||||||
branch:
|
force: false
|
||||||
exclude:
|
commit: true
|
||||||
- main
|
empty_commit: true
|
||||||
event: [push]
|
commit_message: "Drone build ${DRONE_COMMIT_SHA:0:7}"
|
||||||
|
author_name: "Drone CI"
|
||||||
|
author_email: "chris@thezengarden.net"
|
||||||
- name: "ansible_lint"
|
skip_verify: true
|
||||||
image: *ansible_image
|
ssh_key:
|
||||||
commands:
|
from_secret: gitea_ssh_privkey
|
||||||
- ansible-lint --offline
|
|
||||||
when:
|
|
||||||
branch:
|
|
||||||
exclude:
|
|
||||||
- main
|
|
||||||
event: [push]
|
|
||||||
|
|
||||||
|
|
||||||
- name: "ansible_playbook_execution"
|
|
||||||
image: *ansible_image
|
|
||||||
commands:
|
|
||||||
- ansible-playbook -v $ANSIBLE_INVENTORY $ANSIBLE_PLAYBOOK
|
|
||||||
when:
|
|
||||||
branch:
|
|
||||||
exclude:
|
|
||||||
- main
|
|
||||||
event: [push]
|
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
###############################################################################
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
|
|
||||||
# - name: Update repo with build stats
|
|
||||||
# image: appleboy/drone-git-push
|
|
||||||
# settings:
|
|
||||||
# branch: testing
|
|
||||||
# remote: gitea@10.10.10.109:chris/drone-test-1.git
|
|
||||||
# force: false
|
|
||||||
# commit: true
|
|
||||||
# empty_commit: true
|
|
||||||
# commit_message: "Drone build ${DRONE_COMMIT_SHA:0:7} => ${DRONE_BUILD_STATUS}"
|
|
||||||
# author_name: "Drone CI"
|
|
||||||
# author_email: "chris@thezengarden.net"
|
|
||||||
# skip_verify: true
|
|
||||||
# ssh_key:
|
|
||||||
# from_secret: gitea_ssh_privkey
|
|
||||||
# when:
|
|
||||||
# branch:
|
|
||||||
# - development
|
|
||||||
|
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
|
30
.drone.yml.test1
Normal file
30
.drone.yml.test1
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
---
|
||||||
|
name: Ansible Linting of drone-test-1
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: "Ansible Testing: Install required packages and Python modules"
|
||||||
|
image: quay.io/centos/centos:stream9
|
||||||
|
commands:
|
||||||
|
- dnf update -y
|
||||||
|
- dnf install -y python3-pip git hostname
|
||||||
|
- pip3 install ansible-core==2.14.11 ansible-lint==6.13.1
|
||||||
|
|
||||||
|
|
||||||
|
- name: "Ansible Testing: Make repo directory and clone desired repository"
|
||||||
|
image: quay.io/centos/centos:stream9
|
||||||
|
commands:
|
||||||
|
- mkdir /opt/test
|
||||||
|
- git clone https://gitea.thezengarden.net/chris/drone-test-1.git /opt/test/drone-test-1
|
||||||
|
depends_on:
|
||||||
|
- "Ansible Testing: Install required packages and Python modules"
|
||||||
|
|
||||||
|
|
||||||
|
- name: "Ansible Testing: Run Ansible-Lint and Ansible-Playbook against cloned repo"
|
||||||
|
image: quay.io/centos/centos:stream9
|
||||||
|
commands:
|
||||||
|
- ansible-lint /opt/test/drone-test-1
|
||||||
|
- ansible-playbook -v -i 127.0.0.1, /opt/test/drone-test-1/hello.yml
|
||||||
|
depends_on:
|
||||||
|
- "Ansible Testing: Make repo directory and clone desired repository"
|
10
hello.yml
10
hello.yml
@ -1,16 +1,10 @@
|
|||||||
- name: Hello world
|
- name: Hello world
|
||||||
hosts: all
|
hosts: localhost
|
||||||
|
connection: local
|
||||||
become: false
|
become: false
|
||||||
gather_facts: false
|
gather_facts: false
|
||||||
|
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Say Hello world
|
- name: Say Hello world
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: Hello world!
|
msg: Hello world!
|
||||||
|
|
||||||
|
|
||||||
- name: Install Git
|
|
||||||
ansible.builtin.package:
|
|
||||||
name: git
|
|
||||||
state: present
|
|
||||||
|
21
old/drone-yml.centos8
Normal file
21
old/drone-yml.centos8
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
name: Ansible Linting of drone-test-1
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Prepare CentOS 8 image, clone, and test code
|
||||||
|
image: centos:8
|
||||||
|
commands:
|
||||||
|
- hostname
|
||||||
|
- lscpu
|
||||||
|
- dnf --disablerepo '*' --enablerepo=extras swap centos-linux-repos centos-stream-repos -y
|
||||||
|
- dnf distro-sync -y
|
||||||
|
- dnf update -y
|
||||||
|
- hostname
|
||||||
|
- dnf install -y ansible-core git
|
||||||
|
- pip3 install ansible-lint
|
||||||
|
- mkdir /opt/test
|
||||||
|
- git clone https://gitea.thezengarden.net/chris/drone-test-1.git /opt/test/drone-test-1
|
||||||
|
- ansible-lint /opt/test/drone-test-1
|
||||||
|
|
@ -1,3 +1,5 @@
|
|||||||
collections:
|
collections:
|
||||||
- name: ansible.posix
|
- community.general
|
||||||
- name: community.general
|
- ansible.netcommon
|
||||||
|
- community.docker
|
||||||
|
- containers.podman
|
||||||
|
Loading…
x
Reference in New Issue
Block a user