You've already forked cron-apt
Added pipeline
This commit is contained in:
75
.drone.jsonnet
Normal file
75
.drone.jsonnet
Normal file
@@ -0,0 +1,75 @@
|
||||
// Distros to Test on ;)
|
||||
local distros = ['debian11',
|
||||
'ubuntu2204'];
|
||||
|
||||
/* Configuration of DIND */
|
||||
local docker_service() =
|
||||
{
|
||||
name: 'docker',
|
||||
image: 'docker:dind',
|
||||
privileged: true,
|
||||
volumes: [{ name: 'dockersock', path: '/var/run' },],
|
||||
};
|
||||
|
||||
local email_notification() =
|
||||
{
|
||||
name: 'notify by email',
|
||||
image: 'drillster/drone-email',
|
||||
settings:
|
||||
{ host: 'mail.guise.net.nz',
|
||||
username:
|
||||
{ from_secret: 'EMAIL_USER' },
|
||||
password:
|
||||
{ from_secret: 'EMAIL_PASS' },
|
||||
from: 'drone@guise.net.nz'
|
||||
}
|
||||
};
|
||||
|
||||
local test_distro(distribution) =
|
||||
{
|
||||
name: 'Molecule test on %(distribution)s' % { distribution: distribution },
|
||||
volumes: [{ name: 'dockersock', path: '/var/run' },],
|
||||
pull: true,
|
||||
image: 'guisea/ansible-molecule:alpine-latest',
|
||||
commands: [
|
||||
'sleep 10', // give docker enough time to start
|
||||
'mkdir ${DRONE_REPO_NAME}',
|
||||
'rsync -a . ${DRONE_REPO_NAME} --exclude ${DRONE_REPO_NAME}',
|
||||
'cd ${DRONE_REPO_NAME}',
|
||||
'molecule test'
|
||||
],
|
||||
environment:
|
||||
{ MOLECULE_DISTRO: '%(distribution)s' % { distribution: distribution }
|
||||
},
|
||||
};
|
||||
|
||||
local gen_pipeline(distro) =
|
||||
{kind: 'pipeline',
|
||||
type: 'docker',
|
||||
name: 'Test on %(distro)s' % { distro: distro },
|
||||
steps:
|
||||
[test_distro(distro)],
|
||||
services:
|
||||
[docker_service()],
|
||||
volumes:
|
||||
[{
|
||||
name: 'dockersock',
|
||||
temp: {},
|
||||
},],
|
||||
};
|
||||
|
||||
// Generate the output
|
||||
[
|
||||
gen_pipeline('debian11'),
|
||||
gen_pipeline('ubuntu2204'),
|
||||
{kind: 'pipeline',
|
||||
type: 'docker',
|
||||
name: 'Notify',
|
||||
steps: [email_notification()],
|
||||
when:
|
||||
{ status: [ 'success', 'failure' ] },
|
||||
depends_on:
|
||||
['Test on %(distro)s' % { distro: distro }
|
||||
for distro in distros]
|
||||
}
|
||||
]
|
||||
@@ -5,11 +5,11 @@ dependency:
|
||||
driver:
|
||||
name: docker
|
||||
platforms:
|
||||
- name: instance
|
||||
image: docker.io/guisea/docker-ubuntu22.04-ansible
|
||||
command: /usr/bin/systemctl
|
||||
- name: ${MOLECULE_DISTRO:-ubuntu2204}
|
||||
image: docker.io/guisea/docker-${MOLECULE_DISTRO:-ubuntu2204}-ansible
|
||||
command: ${MOLECULE_DOCKER_COMMAND:-""}
|
||||
pre_build_image: true
|
||||
provisioner:
|
||||
name: ansible
|
||||
verifier:
|
||||
name: ansible
|
||||
playbooks:
|
||||
converge: ${MOLECULE_PLAYBOOK:-converge.yml}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
---
|
||||
# This is an example playbook to execute Ansible tests.
|
||||
|
||||
- name: Verify
|
||||
hosts: all
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: fetch /etc/apt/sources.list
|
||||
command: cat /etc/apt/sources.list
|
||||
register: sources
|
||||
|
||||
- name: Output info
|
||||
debug:
|
||||
var: sources
|
||||
|
||||
- name: Example assertion
|
||||
ansible.builtin.assert:
|
||||
that: true
|
||||
@@ -32,12 +32,10 @@
|
||||
when: cron_apt_apply_security
|
||||
|
||||
- name: Comment out security lines in /etc/apt/sources.list
|
||||
lineinfile:
|
||||
dest: /etc/apt/sources.list
|
||||
regexp: '^(deb.*security.*?main.*)'
|
||||
line: '# \1'
|
||||
backrefs: yes
|
||||
state: present
|
||||
replace:
|
||||
path: /etc/apt/sources.list
|
||||
regexp: '^(deb.*security.*)'
|
||||
replace: '# \1'
|
||||
when: cron_apt_apply_security
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user