drone-test-1/.drone.yml
Chris Hammer d49c00ceb5
Some checks reported errors
continuous-integration/drone/push Build encountered an error
re-add image to test
2023-11-17 15:41:56 -05:00

111 lines
3.0 KiB
YAML

---
name: run_ansible_tests
kind: pipeline
type: docker
environment:
ANSIBLE_DOCKER_IMAGE : gitea.thezengarden.net/podman/images/ansible-dev:latest
ANSIBLE_INVENTORY : "-i 127.0.0.1, --connection=local"
ANSIBLE_PLAYBOOK : hello.yml
steps:
- name: "debug"
image: gitea.thezengarden.net/podman/images/ansible-dev:latest
commands:
- "echo \"image: $ANSIBLE_DOCKER_IMAGE - inventory: $ANSIBLE_INVENTORY - playbook: $ANSIBLE_PLAYBOOK\""
when:
branch:
- development
event: [push]
- name: "ansible_environment_verify"
image: gitea.thezengarden.net/podman/images/ansible-dev:latest
commands:
- git log -1
- ansible --version
- ansible-lint --version
when:
branch:
- development
event: [push]
- name: "ansible_galaxy_requirements"
image: "$ANSIBLE_DOCKER_IMAGE"
commands:
- ansible-galaxy install -r $DRONE_WORKSPACE/requirements.yml
when:
branch:
- development
event: [push]
- name: "ansible_lint"
image: "$ANSIBLE_DOCKER_IMAGE"
commands:
- ansible-lint --offline $DRONE_WORKSPACE
when:
branch:
- development
event: [push]
- name: "ansible_playbook_execution"
image: "$ANSIBLE_DOCKER_IMAGE"
environment:
ANSIBLE_INVENTORY:
from_secret: ansible_inventory
commands:
- ansible-playbook -v $ANSIBLE_INVENTORY $DRONE_WORKSPACE/$ANSIBLE_PLAYBOOK
when:
branch:
- development
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
# ---
# name: Test Ansible Linting of drone-test-1
# kind: pipeline
# type: docker
# steps:
# - name: Add comment to pull request
# image: gitea.thezengarden.net/podman/images/ansible-dev:latest
# environment:
# GITEA_TOKEN:
# from_secret: gitea_token
# commands:
# - 'curl -sL -X POST -H "Authorization: token $GITEA_TOKEN" -H "Content-type: application/json" https://gitea.thezengarden.net/api/v1/repos/${DRONE_REPO_OWNER}/${DRONE_REPO_NAME}/issues/${DRONE_PULL_REQUEST}/comments -d "{\"body\": \"Build complete and successful for $DRONE_REPO_NAME\"}"'
# depends_on:
# - "Install requirements, lint, and run Ansible playbook"
# when:
# event:
# - pull_request