From fe2e1bc7a48902c86a9006692088405c13c9813d Mon Sep 17 00:00:00 2001 From: Robin Portigliatti Date: Thu, 24 Oct 2024 17:24:25 +0200 Subject: [PATCH 1/6] Adding nfpm for packaging the extension --- .gitignore | 5 ++++- README.md | 2 -- Vagrantfile | 42 ++++++++++++++++++++++++++++++++++++++++++ nfpm.yaml | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 Vagrantfile create mode 100644 nfpm.yaml diff --git a/.gitignore b/.gitignore index cd72e41..c054852 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ results/ regression.diffs -regression.out \ No newline at end of file +regression.out +.vagrant/ +*.deb +*.rpm \ No newline at end of file diff --git a/README.md b/README.md index 6231834..e9636cf 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -Voici la traduction en anglais : - # restore_points ## Description diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..96da776 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,42 @@ +Vagrant.configure("2") do |config| + + # Configuration pour la VM Debian + config.vm.define "debian" do |debian| + debian.vm.box = "generic/debian12" # Utilise Debian 11 Bullseye + debian.vm.hostname = "debian-vm" + debian.vm.network "private_network", type: "dhcp" + debian.vm.provider "virtualbox" do |vb| + vb.memory = "1024" + vb.cpus = 2 + end + + # Partage NFS de ./ vers /app + debian.vm.synced_folder "./", "/app", type: "nfs", nfs_version: 4, nfs_udp: false + + debian.vm.provision "shell", inline: <<-SHELL + apt update + apt install -y build-essential + SHELL + end + + # Configuration pour la VM Rocky Linux 9 + config.vm.define "rocky9" do |rocky| + rocky.vm.box = "generic/rocky9" # Utilise Rocky Linux 9 + rocky.vm.hostname = "rocky-vm" + rocky.vm.network "private_network", type: "dhcp" + rocky.vm.provider "virtualbox" do |vb| + vb.memory = "1024" + vb.cpus = 2 + end + + # Partage NFS de ./ vers /app + rocky.vm.synced_folder "./", "/app", type: "nfs", nfs_version: 4, nfs_udp: false + + rocky.vm.provision "shell", inline: <<-SHELL + dnf update -y + dnf groupinstall -y "Development Tools" + SHELL + end + + end + \ No newline at end of file diff --git a/nfpm.yaml b/nfpm.yaml new file mode 100644 index 0000000..2ebfdf8 --- /dev/null +++ b/nfpm.yaml @@ -0,0 +1,33 @@ +# nfpm example configuration file +# +# check https://nfpm.goreleaser.com/configuration for detailed usage +# +name: "restore_points" +arch: "amd64" +platform: "linux" +version: "v1.5" +section: "database" +priority: "optional" +provides: +- restore_points +maintainer: "Robin Portigliatti " +description: | + `restore_points` is a PostgreSQL extension that allows managing restore points in a PostgreSQL instance. It creates a schema, table, sequence, and function to facilitate the management and tracking of restore points. +vendor: "Prometheus" +homepage: "https://dalibo.com/" +license: "Apache License 2.0" +contents: + - src: ./restore_points--1.5.sql + dst: /usr/share/postgresql/17/extension/restore_points--1.5.sql + file_info: + mode: 0644 + owner: postgres + group: postgres + - src: ./restore_points.control + dst: /usr/share/postgresql/17/extension/restore_points.control + file_info: + mode: 0644 + owner: postgres + group: postgres +rpm: + summary: PostgreSQL extension that allows managing restore points in a PostgreSQL instance. \ No newline at end of file From bde696cd473863e0e2f52b2751f672cc0d41434c Mon Sep 17 00:00:00 2001 From: Robin Portigliatti Date: Thu, 24 Oct 2024 17:57:02 +0200 Subject: [PATCH 2/6] Making a test for creating packages --- .github/workflows/ci.yml | 21 +++++++++++++++++++++ nfpm.yaml => nfpm/17/deb.yaml | 7 ++----- nfpm/17/rpm.yaml | 30 ++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 5 deletions(-) rename nfpm.yaml => nfpm/17/deb.yaml (85%) create mode 100644 nfpm/17/rpm.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f893210..ab0ed27 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,3 +39,24 @@ jobs: run: | make install PGUSER=postgres make installcheck + + nfpm: + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' + needs: installcheck + steps: + - name: Create restore_points DEB 17 Package + uses: docker://goreleaser/nfpm:latest + with: + args: package --config=./nfpm/17/deb.yaml --target ./restore_points_17_1.5_amd64.deb + - name: Create restore_points RPM 17 Package + uses: docker://goreleaser/nfpm:latest + with: + args: package --config=./nfpm/17/rpm.yaml --target ./restore_points_17_1.5.x86_64.rpm + - name: Archive Prometheus Package + uses: actions/upload-artifact@v3 + with: + name: packages + path: | + *_amd64.deb + *.x86_64.rpm \ No newline at end of file diff --git a/nfpm.yaml b/nfpm/17/deb.yaml similarity index 85% rename from nfpm.yaml rename to nfpm/17/deb.yaml index 2ebfdf8..c349afb 100644 --- a/nfpm.yaml +++ b/nfpm/17/deb.yaml @@ -2,18 +2,17 @@ # # check https://nfpm.goreleaser.com/configuration for detailed usage # -name: "restore_points" +name: "restore_points_17" arch: "amd64" platform: "linux" version: "v1.5" section: "database" priority: "optional" provides: -- restore_points +- restore_points_17 maintainer: "Robin Portigliatti " description: | `restore_points` is a PostgreSQL extension that allows managing restore points in a PostgreSQL instance. It creates a schema, table, sequence, and function to facilitate the management and tracking of restore points. -vendor: "Prometheus" homepage: "https://dalibo.com/" license: "Apache License 2.0" contents: @@ -29,5 +28,3 @@ contents: mode: 0644 owner: postgres group: postgres -rpm: - summary: PostgreSQL extension that allows managing restore points in a PostgreSQL instance. \ No newline at end of file diff --git a/nfpm/17/rpm.yaml b/nfpm/17/rpm.yaml new file mode 100644 index 0000000..25271b6 --- /dev/null +++ b/nfpm/17/rpm.yaml @@ -0,0 +1,30 @@ +# nfpm example configuration file +# +# check https://nfpm.goreleaser.com/configuration for detailed usage +# +name: "restore_points_17" +arch: "amd64" +platform: "linux" +version: "v1.5" +section: "database" +priority: "optional" +provides: +- restore_points_17 +maintainer: "Robin Portigliatti " +description: | + `restore_points` is a PostgreSQL extension that allows managing restore points in a PostgreSQL instance. It creates a schema, table, sequence, and function to facilitate the management and tracking of restore points. +homepage: "https://dalibo.com/" +license: "Apache License 2.0" +contents: + - src: ./restore_points--1.5.sql + dst: /usr/pgsql-17/share/extension/restore_points--1.5.sql + file_info: + mode: 0644 + owner: postgres + group: postgres + - src: ./restore_points.control + dst: /usr/pgsql-17/share/extension/restore_points.control + file_info: + mode: 0644 + owner: postgres + group: postgres From 50263ac340e6ef5a0a9b99fc531eac2a63d71560 Mon Sep 17 00:00:00 2001 From: Robin Portigliatti Date: Thu, 24 Oct 2024 17:59:58 +0200 Subject: [PATCH 3/6] Without nfpm directory --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab0ed27..5100a19 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,11 +48,11 @@ jobs: - name: Create restore_points DEB 17 Package uses: docker://goreleaser/nfpm:latest with: - args: package --config=./nfpm/17/deb.yaml --target ./restore_points_17_1.5_amd64.deb + args: package --config=17/deb.yaml --target ./restore_points_17_1.5_amd64.deb - name: Create restore_points RPM 17 Package uses: docker://goreleaser/nfpm:latest with: - args: package --config=./nfpm/17/rpm.yaml --target ./restore_points_17_1.5.x86_64.rpm + args: package --config=17/rpm.yaml --target ./restore_points_17_1.5.x86_64.rpm - name: Archive Prometheus Package uses: actions/upload-artifact@v3 with: From c287820e3fdbb54c93664506404efddee33fcdd4 Mon Sep 17 00:00:00 2001 From: Robin Portigliatti Date: Thu, 24 Oct 2024 18:03:34 +0200 Subject: [PATCH 4/6] adding checkout --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5100a19..fccde3f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,14 +45,16 @@ jobs: if: github.ref == 'refs/heads/main' needs: installcheck steps: + - name: Check out the repository to the runner + uses: actions/checkout@v4 - name: Create restore_points DEB 17 Package uses: docker://goreleaser/nfpm:latest with: - args: package --config=17/deb.yaml --target ./restore_points_17_1.5_amd64.deb + args: package --config=./nfpm/17/deb.yaml --target ./restore_points_17_1.5_amd64.deb - name: Create restore_points RPM 17 Package uses: docker://goreleaser/nfpm:latest with: - args: package --config=17/rpm.yaml --target ./restore_points_17_1.5.x86_64.rpm + args: package --config=./nfpm/17/rpm.yaml --target ./restore_points_17_1.5.x86_64.rpm - name: Archive Prometheus Package uses: actions/upload-artifact@v3 with: From 24722ff79e14fda83edda0527799f2eaa097ed8d Mon Sep 17 00:00:00 2001 From: Robin Portigliatti Date: Thu, 24 Oct 2024 18:06:42 +0200 Subject: [PATCH 5/6] Adding Alexandre Pereira --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e9636cf..c4b3a65 100644 --- a/README.md +++ b/README.md @@ -86,8 +86,9 @@ Here is the "Contributors" section translated to English: - [Robin Portigliatti](https://www.linkedin.com/in/robin-portigliatti-464838a7/) ; - [Guillaume Armede](https://www.linkedin.com/in/guillaume-armede-811304147/) ; -- [Franck Boudehen](https://www.linkedin.com/in/franck-boudehen-35754b65) ; -- [Guillaume Lelarge](https://github.com/gleu). +- [Guillaume Lelarge](https://github.com/gleu) ; +- [Alexandre Pereira](https://www.linkedin.com/in/alexpereira-5/) ; +- [Franck Boudehen](https://www.linkedin.com/in/franck-boudehen-35754b65). ### Instructions From 7765d817c2bcffc8fe18157a7839b480d2f26931 Mon Sep 17 00:00:00 2001 From: Robin Portigliatti Date: Thu, 24 Oct 2024 18:08:54 +0200 Subject: [PATCH 6/6] Adding retention days --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fccde3f..1e653dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,4 +61,5 @@ jobs: name: packages path: | *_amd64.deb - *.x86_64.rpm \ No newline at end of file + *.x86_64.rpm + retention-days: 30 # Conserve les artefacts pendant 30 jours \ No newline at end of file