diff --git a/.github/workflows/rpm.yml b/.github/workflows/rpm.yml index 03352e5..5d83b78 100644 --- a/.github/workflows/rpm.yml +++ b/.github/workflows/rpm.yml @@ -18,7 +18,7 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 - + - name: Create tag based on metadata.rb id: create_tag run: | @@ -26,38 +26,55 @@ jobs: echo "TAG=$TAG" >> $GITHUB_ENV shell: bash + - name: Check if Tag Exists + id: check_tag + run: | + if git rev-parse "refs/tags/${{ env.TAG }}" >/dev/null 2>&1; then + echo "Tag ${{ env.TAG }} already exists, exiting." + exit 1 + fi + shell: bash + - name: Set Version + if: success() run: echo "VERSION=${{ env.TAG }}" >> $GITHUB_ENV - name: Run Docker Container + if: success() run: docker run --privileged -d --name builder --network host rockylinux:9 /bin/sleep infinity - name: Install build tools RPM + if: success() run: | docker cp ./ builder:/build docker exec builder bash -c "yum install -y epel-release && yum install -y make git mock" docker exec builder bash -c "rm -rf /etc/mock/default.cfg" - name: Setup SDK + if: success() run: | docker exec builder bash -c "curl https://raw.githubusercontent.com/redBorder/repoinit/master/sdk9.cfg > /build/sdk9.cfg" docker exec builder bash -c "echo \"config_opts['use_host_resolv'] = True\" >> /build/sdk9.cfg" docker exec builder bash -c "ln -s /build/sdk9.cfg /etc/mock/default.cfg" - name: Build RPM using mock + if: success() run: | docker exec builder bash -c "git config --global --add safe.directory /build" docker exec builder bash -c "cd /build/ && VERSION=${{ env.TAG }} make rpm" - name: Copy RPMS + if: success() run: | docker cp builder:/build/packaging/rpm/pkgs/. ./rpms - name: Delete non-.rpm files + if: success() run: | find ./rpms -type f -not -name '*.rpm' -exec rm {} \; - name: Release + if: success() uses: softprops/action-gh-release@v1 with: files: ./rpms/* diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c19528..202ef29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ -cookbook rb-arubacentral CHANGELOG -================================== +cookbook-rb-arubacentral CHANGELOG +=============== + +## 0.0.3 + + - Miguel Negrón + - [0bcd71f] Add pre and postun to clean the cookbook + - [4f262f7] Update README.md + - [53a29ed] Update rpm.yml + - [8431854] Update metadata.rb + - Miguel Negrón + - [4f262f7] Update README.md + - [53a29ed] Update rpm.yml + - [8431854] Update metadata.rb 0.0.2 ----- diff --git a/README.md b/README.md index 9271848..04091b6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,17 @@ -# rb-arubacentral cookbook +# cookbook-rb-arubacentral +[![Build Status][build-shield]][build-url] +[![Linters][linters-shield]][linters-url] +[![License][license-shield]][license-url] -cookbook to install and configure redborder rb-arubacentral + +[build-shield]: https://github.com/redBorder/cookbook-rb-arubacentral/actions/workflows/rpm.yml/badge.svg?branch=master +[build-url]: https://github.com/redBorder/cookbook-rb-arubacentral/actions/workflows/rpm.yml?query=branch%3Amaster +[linters-shield]: https://github.com/redBorder/cookbook-rb-arubacentral/actions/workflows/lint.yml/badge.svg?event=push +[linters-url]: https://github.com/redBorder/cookbook-rb-arubacentral/actions/workflows/lint.yml +[license-shield]: https://img.shields.io/badge/license-AGPLv3-blue.svg +[license-url]: https://github.com/cookbook-rb-arubacentral/blob/HEAD/LICENSE + +Chef cookbook to install and configure redborder rb-arubacentral ### Platforms @@ -8,7 +19,7 @@ cookbook to install and configure redborder rb-arubacentral ### Chef -- Chef 12.0 or later +- Chef 15.7.0 or later ## Contributing @@ -19,8 +30,6 @@ cookbook to install and configure redborder rb-arubacentral 5. Run the tests, ensuring they all pass 6. Submit a Pull Request using Github -## License and Authors - -Authors: Enrique Jimenez +## License -LICENSE: AFFERO GENERAL PUBLIC LICENSE, Version 3, 19 November 2007 +GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 diff --git a/packaging/rpm/cookbook-rb-arubacentral.spec b/packaging/rpm/cookbook-rb-arubacentral.spec index e671ec3..5a354e4 100644 --- a/packaging/rpm/cookbook-rb-arubacentral.spec +++ b/packaging/rpm/cookbook-rb-arubacentral.spec @@ -25,6 +25,9 @@ chmod -R 0755 %{buildroot}/var/chef/cookbooks/rb-arubacentral install -D -m 0644 README.md %{buildroot}/var/chef/cookbooks/rb-arubacentral/README.md %pre +if [ -d /var/chef/cookbooks/rb-arubacentral ]; then + rm -rf /var/chef/cookbooks/rb-arubacentral +fi %post case "$1" in @@ -38,6 +41,12 @@ case "$1" in ;; esac +%postun +# Deletes directory when uninstall the package +if [ "$1" = 0 ] && [ -d /var/chef/cookbooks/rb-arubacentral ]; then + rm -rf /var/chef/cookbooks/rb-arubacentral +fi + %files %defattr(0755,root,root) /var/chef/cookbooks/rb-arubacentral @@ -47,5 +56,8 @@ esac %doc %changelog -* Mon Jan 15 2024 David Vanhoucke - 0.0.1-1 +* Thu Oct 10 2024 Miguel Negrón +- Add pre and postun + +* Mon Jan 15 2024 David Vanhoucke - first spec version diff --git a/resources/metadata.rb b/resources/metadata.rb index 502d7df..a85a3c0 100644 --- a/resources/metadata.rb +++ b/resources/metadata.rb @@ -1,7 +1,7 @@ unified_mode true name 'rb-arubacentral' -maintainer 'redborder' -maintainer_email 'dvanhoucke@redborder.com' -license 'All rights reserved' +maintainer 'Eneo Tecnología S.L.' +maintainer_email 'git@redborder.com' +license 'AGPL-3.0' description 'Installs/Configures rb-arubacentral service' -version '0.0.2' +version '0.0.3'