Add ci instructions.

This commit is contained in:
James Pace 2022-12-26 20:30:16 -05:00
parent 589f119c24
commit 537f11417b
2 changed files with 97 additions and 0 deletions

View File

@ -0,0 +1,92 @@
---
- name: Setup container for building.
hosts: localhost
tags: setup
tasks:
- name: Create a container
containers.podman.podman_container:
name: ostree-debian-builder
image: docker.io/library/debian:bullseye
volume: "{{ playbook_dir | dirname }}:/project:Z"
command: 'sleep infinity'
state: started
- name: Add the container to inventory.
ansible.builtin.add_host:
name: ostree-debian-builder
ansible_connection: containers.podman.podman
ansible_user: root
ansible_python_interpreter: /usr/bin/python3
changed_when: false
- name: Get the basic depedencies.
delegate_to: ostree-debian-builder
raw: bash -c "apt update && apt install -y python3 build-essential devscripts"
- name: Build package.
hosts: ostree-debian-builder
tags: build
tasks:
- name: Make out of tree build directory.
ansible.builtin.tempfile:
state: directory
suffix: build
prefix: project
register: temp_file_loc
- name: Copy build files to location.
ansible.builtin.shell:
cmd: "cp -r /project {{ temp_file_loc.path }}/. "
- name: Install build dependencies.
ansible.builtin.shell:
chdir: "{{temp_file_loc.path }}/project"
cmd: |
apt update
mk-build-deps
apt install -y ./*.deb
- name: Call debuild.
ansible.builtin.shell:
chdir: "{{temp_file_loc.path }}/project"
cmd: |
export DEB_BUILD_OPTIONS=nocheck
debuild -us -uc -b
- name: Copy deb file back to the main directory.
ansible.builtin.shell:
cmd: "cp -r {{ temp_file_loc.path }}/*.deb /project/."
- name: Copy changes file back to the main directory.
ansible.builtin.shell:
cmd: "cp -r {{ temp_file_loc.path }}/*.changes /project/."
- name: Copy buildinfo file back to the main directory.
ansible.builtin.shell:
cmd: "cp -r {{ temp_file_loc.path }}/*.buildinfo /project/."
- name: Upload to packaging server.
hosts: packaging
tags: deploy
tasks:
- name: Copy packages to packaging server.
ansible.builtin.copy:
src: "{{ item }}"
dest: ~/public/apt/mini-dinstall/incoming/
with_fileglob: ../*.deb
- name: Ditto the changes files.
ansible.builtin.copy:
src: "{{ item }}"
dest: ~/public/apt/mini-dinstall/incoming/
with_fileglob: ../*.changes
register: copied_changes
- name: Ditto the buildinfo files.
ansible.builtin.copy:
src: "{{ item }}"
dest: ~/public/apt/mini-dinstall/incoming/
with_fileglob: ../*.buildinfo
register: copied_buildinfo
- name: Run mini-dinstall.
ansible.builtin.shell:
cmd: "mini-dinstall --batch"
- name: Cleanup
hosts: localhost
tags: cleanup
tasks:
- name: Stop the container.
containers.podman.podman_container:
name: ostree-debian-builder
state: absent

View File

@ -0,0 +1,5 @@
all:
hosts:
packaging:
ansible_host: packages.jpace121.net
ansible_user: packaging