From 537f11417bef52d28305dbde2445a7e1f474b724 Mon Sep 17 00:00:00 2001 From: James Pace Date: Mon, 26 Dec 2022 20:30:16 -0500 Subject: [PATCH] Add ci instructions. --- j7s-build-files/build.yaml | 92 ++++++++++++++++++++++++++++++++++ j7s-build-files/inventory.yaml | 5 ++ 2 files changed, 97 insertions(+) create mode 100644 j7s-build-files/build.yaml create mode 100644 j7s-build-files/inventory.yaml diff --git a/j7s-build-files/build.yaml b/j7s-build-files/build.yaml new file mode 100644 index 00000000..6e07d43f --- /dev/null +++ b/j7s-build-files/build.yaml @@ -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 \ No newline at end of file diff --git a/j7s-build-files/inventory.yaml b/j7s-build-files/inventory.yaml new file mode 100644 index 00000000..981dadcf --- /dev/null +++ b/j7s-build-files/inventory.yaml @@ -0,0 +1,5 @@ +all: + hosts: + packaging: + ansible_host: packages.jpace121.net + ansible_user: packaging \ No newline at end of file