diff --git a/playbooks/openafs-rpm-package-build/run.yaml b/playbooks/openafs-rpm-package-build/run.yaml new file mode 100644 index 00000000..0e2d4687 --- /dev/null +++ b/playbooks/openafs-rpm-package-build/run.yaml @@ -0,0 +1,3 @@ +- hosts: all + roles: + - openafs-rpm-package-build diff --git a/roles/openafs-rpm-package-build/README.rst b/roles/openafs-rpm-package-build/README.rst new file mode 100644 index 00000000..fd28281b --- /dev/null +++ b/roles/openafs-rpm-package-build/README.rst @@ -0,0 +1,3 @@ +Build OpenAFS RPM packages + +This builds RPM packages for openafs diff --git a/roles/openafs-rpm-package-build/tasks/main.yaml b/roles/openafs-rpm-package-build/tasks/main.yaml new file mode 100644 index 00000000..2f48fb2b --- /dev/null +++ b/roles/openafs-rpm-package-build/tasks/main.yaml @@ -0,0 +1,75 @@ +- name: Install prereqs + package: + name: + - rpm-build + - kernel-devel + - createrepo + become: yes + +- name: Install centos8 packages + package: + name: + - elfutils-devel + become: yes + when: ansible_distribution_major_version == '8' + +# https://wiki.openafs.org/devel/HowToBuildOpenAfsRpmPackages/ +- name: Build and install srpm + environment: + PACKAGER: "{{ (ansible_distribution_major_version == '7') | ternary('yum', 'dnf') }}" + shell: | + set -eux + + VERSION=1.8.5 + + mkdir openafs + wget https://www.openafs.org/dl/openafs/${VERSION}/openafs-${VERSION}-src.tar.bz2 + wget https://www.openafs.org/dl/openafs/${VERSION}/openafs-${VERSION}-doc.tar.bz2 + wget https://www.openafs.org/dl/openafs/${VERSION}/RELNOTES-${VERSION} + wget https://www.openafs.org/dl/openafs/${VERSION}/ChangeLog + + # Build the source RPM. + tar xf openafs-${VERSION}-src.tar.bz2 --strip-components=4 '*/makesrpm.pl' + perl makesrpm.pl openafs-${VERSION}-src.tar.bz2 openafs-${VERSION}-doc.tar.bz2 RELNOTES-${VERSION} ChangeLog + + if [[ ${PACKAGER} == "yum" ]]; then + sudo yum-builddep -y openafs-${VERSION}-1.src.rpm + else + sudo dnf builddep -y openafs-${VERSION}-1.src.rpm + fi + + rpm -i openafs-${VERSION}-1.src.rpm + + pushd ~/rpmbuild/SPECS + rpmbuild -ba ./openafs.spec + popd + + # create final repo + createrepo ~/rpmbuild/RPMS/{{ ansible_architecture }} + +- name: Copy built rpms + synchronize: + src: '{{ ansible_user_dir }}/rpmbuild/' + dest: '{{ zuul.executor.log_root }}' + mode: pull + rsync_opts: + - --include=/RPMS/** + - --include=/SRPMS/** + - --include=*/ + - --exclude=* + - --prune-empty-dirs + +- name: Return build artifact + zuul_return: + data: + zuul: + artifacts: + - name: rpms + url: RPMS + metadata: + type: rpm + - name: srpms + url: SRPMS + metadata: + type: srpm + diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 85715553..5dcd4643 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -1021,6 +1021,32 @@ tox_envlist: infra-docs sphinx_build_dir: docs-site +- job: + name: openafs-rpm-package-build + description: | + There are no official builds for AFS on Centos, hence we build + our own and publish them to tarballs.openstack.org for our + centos hosts that need access to the mirror to consume. + run: playbooks/openafs-rpm-package-build/run.yaml + files: + - playbooks/openafs-rpm-package-build + - roles/openafs-rpm-package-build + +- job: + name: openafs-rpm-package-build-centos-7-x86 + parent: openafs-rpm-package-build + nodeset: centos-7 + +- job: + name: openafs-rpm-package-build-centos-8-x86 + parent: openafs-rpm-package-build + nodeset: centos-8 + +- job: + name: openafs-rpm-package-build-centos-8-arm64 + parent: openafs-rpm-package-build + nodeset: centos-8-arm64 + - job: name: project-config-build-openafs-centos description: | diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml index ae70024f..89ccb050 100644 --- a/zuul.d/project.yaml +++ b/zuul.d/project.yaml @@ -5,6 +5,9 @@ check: jobs: + - openafs-rpm-package-build-centos-7-x86 + - openafs-rpm-package-build-centos-8-x86 + - openafs-rpm-package-build-centos-8-arm64 - openstack-infra-extra-integration-xenial - openstack-infra-extra-integration-bionic - openstack-zuul-jobs-linters