35 Commits

Author SHA1 Message Date
Andreas Karlsson
b7dfa6897f Only enable TDE_MODE for the tests with global TDE
The TDE_MODE environment variable disables tests we actually want to run
in our Github Actions. This change is also necessary to in a future
commit disable the pg_tde tests in the global TDE mode.
2025-04-28 09:42:37 +02:00
Andreas Karlsson
e979ab71c2 Harmonize the different Github Actions entry points
The meson and the make scripts had diverged a lot, so this commit fixes
that plus some other inconsistencies.
2025-04-28 09:42:37 +02:00
Artem Gavrilov
082cc11c8c Run simple tests for code coverage needs 2025-04-25 16:46:11 +02:00
Artem Gavrilov
198af9e357 Extract code coverage jobs into separate CI workflow 2025-04-25 16:46:11 +02:00
Anders Åstrand
681b9ff1cd Run pgperltidy in github actions
Just as we use pgindent to validate that our c files conform to postgres
coding standards, we also run pgperltidy to do the same for perl files.
We only run it on our own code in contrib/pg_tde/

This doesn't actually run pgperltidy as we need to inject some options
in a way that didn't seem possible in that script. Instead it does the
same thing with some slight changes.

We also bump the ubuntu version for this google actions job to the
newest LTS as the older ubuntu version seems to have a version of
perltidy that doesn't support the options used by pgperltidy.
2025-04-22 11:40:24 +02:00
Andreas Karlsson
14a3d36ae1 Only check pg_tde with the combined typedefs
The reason to do this is that the old approach created an unnecessary
diff against upstream where they had forgot SinglePartitionSpec in
typedefs.list.

Additionally add two new structs from our SMGR patch to the list.
2025-04-17 11:04:54 +02:00
Andreas Karlsson
2131faf17d Use PostgreSQL's find_typedef script instead of our own
Since the PostgreSQL repo already contains a script extracting typedefs
from object files let's use it.
2025-04-17 11:04:54 +02:00
Naeem Akhter
dcdcebbf92
PG-1482, PG-1289 Add coverage to repo and percona server version check. (#212)
- Added code coverage to link repo to codecov.io for coverage stats on
PR and merge.
- Added coverage badge on the landing page (readme) of the repo. 
- Updated GH action to run on PUSH/MERGE, as this is required for code
coverage.
- Updated bash files in ci_scripts folder to accommodate tde
installcheck only.
- Added percona server version scheme verification TAP test case.
2025-04-15 19:42:57 +05:00
Artem Gavrilov
959a6b65c1
PG-1457 Rename principal key on user API level to just a key (#154)
PG-1457

Replace `principal key` with just a `key` on user API level, as it's the only key that user can directly interact with.
2025-04-10 19:56:54 +02:00
Artem Gavrilov
3b8a234d3e
PG-1457 Key management funcs renaming (#126)
* PG-1457 Rename some key management funcions

* PG-1457 Fix some tests

* PG-1457 Hit CI

* PG-1457 Rename key in CI setup

* PG-1457 Rename pg_tde_verify_global_principal_key to pg_tde_verify_server_principal_key

* PG-1457 Rename keys in tests

* PG-1457 Renaming

* PG-1457 Renaming

* PG-1457 Fix tests

* PG-1457 Fix tests

* PG-1457 Fix tabs

* PG-1457 Fix tests

* PG-1457 Fix tests

* PG-1457 Fix

* PG-1457 Fix test

* PG-1457 Fix test

* PG-1457 Hit CI

* PG-1457 Fix after rebase

* PG-1457 Fix

* PG-1457 Fix

* PG-1457 Fix

* PG-1457 Fix test

* PG-1457 Fix tests

* PG-1457 Fix tests

* PG-1457 Fix
2025-04-08 10:20:16 +02:00
Andreas Karlsson
c5a8eea6ca Make tde_setup.sql friendlies to run manually
If we schema qualify the functions we call users do not always need
to set the search path.
2025-03-14 11:29:49 +01:00
Andreas Karlsson
ef5900d0d3 Make make test output easier to read in Github Actions
Pass -s to make to get cleaner test output.
2025-03-12 15:36:19 +01:00
Zsolt Parragi
f0d7d847ca CI should execute correctly with wal encryption 2025-02-28 08:55:09 +00:00
Andreas Karlsson
54d4598619 PG-1380 Make pg_tde_is_encrypted() take a regclass
By changing the parameter to regclass you can pass any parameter of
the following types to it: text, oid, regclass; and there will be
an automatic cast. More user freindly than accepting text.
2025-02-24 15:25:22 +01:00
Zsolt Parragi
4b5a5688d7 Modify the pg_tde full regression run to install pg_tde in the tde schema.
Also modify the earthdistance test to only list objects from the
public schema.

This way it doesn't need modification every time pg_tde has modifiations
in the public interface.
2025-02-19 17:37:58 +00:00
Shahid Ullah
3e3bbea82a
[PG-1367] Update configure server script that can accept data directory and port as an argument (#68) 2025-02-18 00:48:41 +05:00
Zsolt Parragi
0a451edbcc Removing the pg_tde_global enum
As this causes issues with overload resolution, this commit instead
separates global and local key handling into differently named
functions. From now on, functions that deal with global keys have
"global" in the name.
2025-02-17 12:12:36 +00:00
Andreas Karlsson
747d93f039 Do not create extra database in configure-tde-server.sh
The postgres database is good enough for this use.
2025-02-17 11:46:29 +01:00
Andreas Karlsson
4e848ea9f4 Simplify logic for stopping the server in configure-tde-server.sh
I run multiple instances of PostgreSQL on my machine so I would rather
not have it rely on using pgrep to detect if the server is running.

To make this new code more reliable we add set -e so the script aborts
directly e.g. if the port is already in use.
2025-02-17 11:46:29 +01:00
Andreas Karlsson
c35778b45b Improve how we set GUCs in configure-tde-server.sh
To simplify the code we first use --set at initdb tine and then only
use ALTER SYSTEM for GUCs we need to set after initdb.
2025-02-17 11:46:29 +01:00
Andreas Karlsson
a3fde4e52d Quote shell variables in configure-tde-server.sh 2025-02-17 11:46:29 +01:00
Shahid Ullah
43f4804ba5
[PG-938] Bash script to verify backup/restore functionality using pg_basebackup (#63)
* [PG-938] - Add automated bash script to verify pg_tde backup/restore functionality using pg_basebackup
* [PG-1367] Create separate script for server and tde configuration
2025-02-13 19:23:49 +05:00
Andreas Karlsson
7266847592 Sync development dependecies in Github Actions with offical package
New dependencies have been added since we last updated this list, e.g.
zstd and icu. And additionally we just fix diffs where Ubuntu packages
have been renamed or the official package thinks we should install
some package.
2025-02-12 16:01:38 +01:00
Andreas Karlsson
5b55af8279 Do not install ninja-build directly
It is a dependency of meson so we only need to install meson.
2025-02-12 16:01:38 +01:00
Andreas Karlsson
71bac8ded6 Do not de-armor key used by apt
Apt does not require keys to be de-armored if they use the correct
extension. Additional put the key in the directory recommended by
Debian and Ubuntu.
2025-02-12 16:01:38 +01:00
Andreas Karlsson
0c410a6cb1 List Github worker dependencies in a nicer way
By not having everything on one line it is easier to see what we
actually install and why.
2025-02-12 16:01:38 +01:00
Andreas Karlsson
65ab529e6b Use apt instead of apt-get in Github scripts
The apt executable gives the following warning.

    WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
2025-02-12 16:01:38 +01:00
Andreas Karlsson
88eb65a4fa Do not install any CI packages from CPAN
Run::IPC is already installed via APT and Text::Trim does not seem
like it is even used. While at it we update the comment.
2025-02-05 22:11:14 +01:00
Andreas Karlsson
2c54d8213c Stop downloading duplicate KMIP policy files in CI
There is no reason to download two versions of the same KMIP policy
file for the CI tests. Either file should be good.
2025-02-05 22:11:14 +01:00
Andreas Karlsson
d60abd33ea Remove pointless trailing slashes in paths in CI scripts 2025-02-05 22:11:14 +01:00
Andreas Karlsson
2a3bd28fdd Add missing bash shebangs to CI scripts 2025-02-05 22:11:14 +01:00
Andreas Karlsson
7f464a5cbe Make whitespace of CI scripts consistent 2025-02-05 22:11:14 +01:00
Zsolt Parragi
f22350ce22
PG-1002: WAL encryption requires explicit configuration (#36)
Instead of automatically creating a default keyring, from now on
we require users to expicitly create a WAL key. Most of these
steps were required even without change anyway, as the default
configuration was highly unsecore.

This eliminates the possiblity of users forgetting to change the
unsecure default, ending up with an encryption that doesn't work
in practice.

The required steps are outlined in the new tap test, that tries
to enable wal encryption:

* Enable the extension in at least one database
* Create a global key provider
* Create a global principal key
* Create the WAL key using the new `pg_tde_create_wal_key()` function
* Set `pg_tde.wal_encrypt = 1` in the conf file or with `ALTER SYSTEM`
* Restart the server

Setting the GUC variable to ON without the previous steps results
in the startup failing with an error message explaining the requirements.
2025-02-03 16:45:05 +00:00
Zsolt Parragi
4842a99090 Added scripts and github CI action for formatting / format checking 2025-01-22 18:46:32 +00:00
Zsolt Parragi
5e3f82c785
Fixing issues with running installcheck-world with pg_tde (#31)
* The make CI action now also runs the entire installcheck-world
  with pg_tde setup for all tests
* The meson CI runner doesn't do this yet
* Tools that only worked with the heap am based on an OID check now
  also check for the tde_heap OID
* The get_tde_table_am_oid helper function is now moved inside the core,
  as it is required by other contrib modules, which do not have access
  to the tde code otherwise.
* A few tests that do a custom server setup was disabled based on the
  TDE_MODE environment variable. These tests would fail because they
  expect that after an initdb and start, the regression suite works,
  but that's not the case with tde_heap. These tests can be re-enabled
  again after we have options to do this with initdb
2025-01-22 17:32:24 +00:00