Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
0c6ccd8
chore: update (and refactor) flake inputs
jfroche Jul 7, 2025
27f5598
chore: replace (deprecated) `substituteAll` by `replaceVars`
jfroche Jul 7, 2025
a18642a
chore: fix missing required `teams` meta attribute
jfroche Jul 7, 2025
ef8855b
chore: update old (unsupported) version of nix used in script
jfroche Jul 7, 2025
ed07522
fix: overlay and use our `buildPgrxExtension` function
jfroche Jul 7, 2025
ba09c8d
chore: `v8` has been removed from nixpkgs and replaced with `nodejs.l…
jfroche Jul 7, 2025
f75f757
chore: fix formatting
jfroche Jul 7, 2025
a0f843c
chore: bump `pgrouting` version to 3.8.0
yvan-sraka Jul 11, 2025
87d5e4f
Backport tzdata fixes for postgresql 15
jfroche Jul 18, 2025
6f10d04
fix: plv8 3.1 requires older v8
jfroche Jul 21, 2025
588f2f2
chore: remove deprecated appl_sdk frameworks
jfroche Jul 21, 2025
99adaed
chore: update cargo-pgrx 1.14.3 cargo hash
jfroche Jul 21, 2025
e501fbe
chore(postgresql): add isOrioleDB condition
jfroche Jul 21, 2025
7676043
Fix pgregress tests
jfroche Jul 21, 2025
018bf3c
fix: update schema for dbmate schema_migrations table
jfroche Jul 22, 2025
9c3322f
chore: update nixpkgs flake inputs
jfroche Aug 10, 2025
2614aec
chore: update fmt
jfroche Aug 10, 2025
e266435
Structured attributes are now required when building with separateDeb…
jfroche Aug 11, 2025
ca41f46
fix: pgroonga should test for all version
samrose Aug 21, 2025
134e133
chore: version bump
samrose Sep 2, 2025
a33cf5d
fix: rebase on develop and fix code api changes from nixpkgs
samrose Sep 9, 2025
4becde2
chore: bump to test
samrose Sep 10, 2025
68f882a
tests: try to get passing tests
samrose Sep 10, 2025
ce6f5eb
feat: pin icu75 for postgres build to maintain compat with existing
samrose Sep 11, 2025
b1730fc
chore: remove commented out code not needed in latest changes to pg
samrose Sep 11, 2025
684c4b7
chore: version bump to test
samrose Sep 11, 2025
ef01882
feat: add ansible task testing infrastructure based on Docker and pytest
jfroche Aug 4, 2025
3c92f1c
feat: deploy nginx using system manager
jfroche Aug 4, 2025
273a860
chore: simplify system manager tests
jfroche Aug 11, 2025
a394449
chore: formatting
jfroche Aug 12, 2025
a07b348
Test system manager deployment triggered by Ansible
jfroche Aug 12, 2025
1e498d8
Create default system manager configuration
jfroche Aug 12, 2025
fc77a26
ci: make sure we cache system manager and its test dependencies
jfroche Aug 12, 2025
f478f94
chores: add nix run .#ansible-test and .#check-system-module to githu…
yvan-sraka Sep 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/ansible-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Ansible Test

on:
push:
branches:
- feat/ansible-testing
pull_request:
branches:
- feat/ansible-testing

jobs:
ansible-test:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: supabase/postgres/.github/actions/shared-checkout@HEAD

- name: Install nix
uses: cachix/install-nix-action@v27
with:
install_url: https://releases.nixos.org/nix/nix-2.29.1/install
extra_nix_config: |
substituters = https://cache.nixos.org https://nix-postgres-artifacts.s3.amazonaws.com
trusted-public-keys = nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI=% cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=

- name: Run Ansible Test
run: nix run .#ansible-test
27 changes: 27 additions & 0 deletions .github/workflows/check-system-manager.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Check System Manager

on:
push:
branches:
- feat/ansible-testing
pull_request:
branches:
- feat/ansible-testing

jobs:
check-system-manager:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: supabase/postgres/.github/actions/shared-checkout@HEAD

- name: Install nix
uses: cachix/install-nix-action@v27
with:
install_url: https://releases.nixos.org/nix/nix-2.29.1/install
extra_nix_config: |
substituters = https://cache.nixos.org https://nix-postgres-artifacts.s3.amazonaws.com
trusted-public-keys = nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI=% cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=

- name: Run check-system-manager
run: nix run .#check-system-manager
1 change: 1 addition & 0 deletions ansible/tasks/files
11 changes: 11 additions & 0 deletions ansible/tasks/setup-nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
- name: Check if nix is installed
ansible.builtin.command: which nix
register: nix_installed
failed_when: nix_installed.rc != 0
ignore_errors: true

- name: Install nix
ansible.builtin.shell: curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --no-confirm --extra-conf 'substituters = https://cache.nixos.org https://nix-postgres-artifacts.s3.amazonaws.com' --extra-conf 'trusted-public-keys = nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI=% cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY='
when: nix_installed.rc != 0
become: true
Comment on lines +2 to +11
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of ignore_errors, why not use a block/rescue

Suggested change
- name: Check if nix is installed
ansible.builtin.command: which nix
register: nix_installed
failed_when: nix_installed.rc != 0
ignore_errors: true
- name: Install nix
ansible.builtin.shell: curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --no-confirm --extra-conf 'substituters = https://cache.nixos.org https://nix-postgres-artifacts.s3.amazonaws.com' --extra-conf 'trusted-public-keys = nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI=% cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY='
when: nix_installed.rc != 0
become: true
- name: Install nix if needed
block:
- name: Check if nix is installed
ansible.builtin.command: which nix
register: nix_installed
failed_when: nix_installed.rc != 0
rescue:
- name: Install nix
ansible.builtin.shell: curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --no-confirm --extra-conf 'substituters = https://cache.nixos.org https://nix-postgres-artifacts.s3.amazonaws.com' --extra-conf 'trusted-public-keys = nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI=% cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY='
become: true

7 changes: 7 additions & 0 deletions ansible/tasks/setup-system-manager.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- name: Deploy system manager
ansible.builtin.shell: |
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
cd /tmp
nix run /flake#system-manager -- switch --flake /flake
become: true
79 changes: 79 additions & 0 deletions ansible/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import pytest
import subprocess
import testinfra
from rich.console import Console

console = Console()


def pytest_addoption(parser):
parser.addoption(
"--flake-dir",
action="store",
help="Directory containing the current flake",
)

parser.addoption(
"--docker-image",
action="store",
help="Docker image and tag to use for testing",
)


@pytest.fixture(scope="module")
def host(request):
flake_dir = request.config.getoption("--flake-dir")
docker_id = (
subprocess.check_output(
[
"docker",
"run",
"--privileged",
"--cap-add",
"SYS_ADMIN",
"--security-opt",
"seccomp=unconfined",
"--cgroup-parent=docker.slice",
"--cgroupns",
"private",
"-v",
f"{flake_dir}:/flake",
"-d",
"ubuntu-cloudimg-with-tools:0.1",
]
)
.decode()
.strip()
)
yield testinfra.get_host("docker://" + docker_id)
subprocess.check_call(["docker", "rm", "-f", docker_id], stdout=subprocess.DEVNULL)


@pytest.fixture(scope="module")
def run_ansible_playbook(host):
def _run_playbook(playbook_name, verbose=False):
cmd = [
"ANSIBLE_HOST_KEY_CHECKING=False",
"ansible-playbook",
"--connection=local",
]
if verbose:
cmd.append("-vvv")
cmd.extend(
[
"-i",
"localhost,",
"--extra-vars",
"@/flake/ansible/vars.yml",
f"/flake/ansible/tests/{playbook_name}",
]
)
result = host.run(" ".join(cmd))
if result.failed:
console.log(result.stdout)
console.log(result.stderr)
raise pytest.fail(
f"Ansible playbook {playbook_name} failed with return code {result.rc}"
)

return _run_playbook
14 changes: 14 additions & 0 deletions ansible/tests/nginx.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- hosts: localhost
tasks:
- name: Install dependencies
apt:
pkg:
- build-essential
update_cache: yes
- import_tasks: ../tasks/setup-nginx.yml
- name: Start Nginx service
service:
name: nginx
state: started
enabled: yes
5 changes: 5 additions & 0 deletions ansible/tests/nix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- hosts: localhost
tasks:
- import_tasks: ../tasks/setup-nix.yml
- import_tasks: ../tasks/setup-system-manager.yml
11 changes: 11 additions & 0 deletions ansible/tests/test_nginx.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import pytest


@pytest.fixture(scope="module", autouse=True)
def run_ansible(run_ansible_playbook):
run_ansible_playbook("nginx.yaml")


def test_nginx_service(host):
assert host.service("nginx.service").is_valid
assert host.service("nginx.service").is_running
14 changes: 14 additions & 0 deletions ansible/tests/test_nix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import pytest


@pytest.fixture(scope="module", autouse=True)
def run_ansible(run_ansible_playbook):
run_ansible_playbook("nix.yaml", verbose=True)


def test_nix_service(host):
assert host.service("nix-daemon.service").is_running


def test_envoy_service(host):
assert host.service("envoy.service").is_running
6 changes: 3 additions & 3 deletions ansible/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ postgres_major:

# Full version strings for each major version
postgres_release:
postgresorioledb-17: "17.5.1.024-orioledb"
postgres17: "17.6.1.003"
postgres15: "15.14.1.003"
postgresorioledb-17: "17.5.1.024-orioledb-nixpkgs-4"
postgres17: "17.6.1.003-nixpkgs-4"
postgres15: "15.14.1.003-nixpkgs-4"

# Non Postgres Extensions
pgbouncer_release: "1.19.0"
Expand Down
Loading
Loading