Clark Boylan 60acea0da6 Run latest ansible-lint on Ubuntu Noble
We bump the Ansible version to the version that Zuul runs. We then set
ansible-lint to the current latest version. This results in a number of
new linter violations which we fix. These violations include:

 * Needing to name plays
 * Needing to start names with a capital letter
 * Using fully qualified names for action modules
 * Quoting permissions strings to avoid octal conversion errors
 * Using explicit yaml structures for tasks

We also tell ansible-lint to mock zuul_return so that we don't get
errors from it complaining that this module is not defined.

Change-Id: Ic881313fea58f4482f70e493f3d256541d31860a
2024-10-07 12:36:32 -07:00

79 lines
2.1 KiB
YAML

- name: Install prereqs
package:
name:
- build-essential
- devscripts
- dpkg-dev
- equivs # for mk-build-deps
become: yes
- name: Make working directory
file:
path: '{{ ansible_user_dir }}/{{ infra_deb_project }}'
state: directory
mode: '0755'
- name: Build source
args:
executable: '/bin/bash'
shell: |
set -eux
# make the orig
pushd '{{ zuul.project.src_dir }}'
./make-orig.sh
# this puts a file with the version for us to use
VERSION=$(cat ./version)
# copy the result and the debian/* directory to build area
cp {{ infra_deb_project }}_${VERSION}.orig.tar.xz '{{ ansible_user_dir }}/{{ infra_deb_project }}'
cp -r debian '{{ ansible_user_dir }}/{{ infra_deb_project }}'
popd
pushd {{ infra_deb_project }}
# extract source and move into place
tar xf {{ infra_deb_project }}_${VERSION}.orig.tar.xz
mv debian ./{{ infra_deb_project }}_${VERSION}.orig
# run mk-build-deps in a separate copy, as it can leave behind
# files that wreck generating upload .debs
cp -r {{ infra_deb_project }}_${VERSION}.orig {{ infra_deb_project }}_${VERSION}.orig.deps
pushd {{ infra_deb_project }}_${VERSION}.orig.deps
# install build deps
mk-build-deps --install --root-cmd sudo --remove -t "apt-get -y"
popd
rm -rf ${VERSION}.orig.deps
# build fresh source packages
pushd {{ infra_deb_project }}_${VERSION}.orig
debuild -S -sa --no-sign
popd
# clean up orig source from build
rm -rf {{ infra_deb_project }}_${VERSION}.orig
popd
# create omnibus tar file
tar czf {{ infra_deb_project }}-debs.tar.gz ./{{ infra_deb_project }}
- name: Copy built packages
ansible.posix.synchronize:
src: '{{ ansible_user_dir }}/{{ infra_deb_project }}-debs.tar.gz'
dest: '{{ zuul.executor.log_root }}'
mode: pull
- name: Return build artifact
zuul_return:
data:
zuul:
artifacts:
- name: deb-tar
url: '{{ infra_deb_project }}-debs.tar.gz'
metadata:
type: deb.tar.gz