Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sam/oriole17 #1298

Merged
merged 121 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from 115 commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
cdc6452
feat: build and flake check of pg 16.3 with exts/wrappers
samrose Oct 7, 2024
91ec362
pg_partman test 15/16 compat
olirice Oct 7, 2024
0321dfa
merge sql interface test
olirice Oct 7, 2024
aa5dd9a
tests: build test and cache both versions
samrose Oct 7, 2024
65fdc5d
chore: run checks individually
samrose Oct 7, 2024
f10881b
pg 15 and 16 packer/ansible/ghactions (#1268)
samrose Oct 10, 2024
7f7730e
chore: rm dead code
samrose Oct 10, 2024
3454b62
chore: resolve versions from ansible/vars.yml instead of packer file
samrose Oct 15, 2024
d576b01
feat: WIP orioledb 16
samrose Oct 15, 2024
ce43530
feat: intro into CI building psql16 bundle oriole version
samrose Oct 15, 2024
b6fdd11
test: working through build compat for oriole
samrose Oct 16, 2024
859cbca
working orioledb build
samrose Oct 17, 2024
a4b4998
fix: update value
samrose Oct 17, 2024
6336dba
Merge branch 'develop' into sam/oriole16
samrose Oct 17, 2024
8c13a58
chore: cut staging only release for oriole16
samrose Oct 17, 2024
07117e3
narrow down to just oriole staging ami here
samrose Oct 17, 2024
9f4b869
Merge branch 'develop' into sam/oriole16
samrose Oct 17, 2024
2ea1e90
fix: make sure name lines up with gh action convention
samrose Oct 17, 2024
c7f68df
fix: get correct naming convention in here too for oriole bundle
samrose Oct 17, 2024
870f591
chore: bump to cut release
samrose Oct 17, 2024
d483a07
fix: make sure src and debug builds available for oriole too
samrose Oct 17, 2024
5e69b00
chore: bump to staging release
samrose Oct 17, 2024
b62e770
fix: when oriole16 rm timescale from supautils conf
samrose Oct 17, 2024
889dc70
fix: also remove from postgresql conf
samrose Oct 18, 2024
a67d8e1
fix: find all instances and remove in this condition for tiemscaledb
samrose Oct 18, 2024
67382a6
fix: maybe broke pgsodium with too many spaces
samrose Oct 18, 2024
c08b661
fix: create a symlink for missing path
samrose Oct 18, 2024
59b44b6
fix: try a more universal way to deactivate pgsodium at this stage
samrose Oct 18, 2024
f961371
chore: when oriole16 rm timescale plv8 postgis pgvector pgrouting
samrose Oct 18, 2024
a8f1a6b
fix: more handling of oriole16 differences
samrose Oct 18, 2024
c35fa68
chore more oriole16 handling
samrose Oct 18, 2024
d1e06d4
fix: refine sed regex
samrose Oct 18, 2024
304aa68
fix: also cond rm actual files
samrose Oct 18, 2024
55b9763
fix: correct dir
samrose Oct 18, 2024
292327e
chore: bump to release
samrose Oct 18, 2024
32163be
feat: parse and handle oropledb-16 in start-server
samrose Oct 21, 2024
e1c199c
feat: start-client for oriole16
samrose Oct 21, 2024
6a5648b
wip for orioledb push to build on linux
samrose Oct 22, 2024
049010a
fix: running server
samrose Oct 22, 2024
c2e2801
chore: consolidate nix code that handles building of postgres versions
samrose Oct 23, 2024
1cd2063
fix: update name for bundle
samrose Oct 23, 2024
0e23e7d
chore: small cleanup
samrose Oct 24, 2024
f6cbbe7
Merge branch 'develop' into sam/oriole16
samrose Oct 24, 2024
9d48e50
chore: bump version release
samrose Oct 24, 2024
25e1b3b
Merge branch 'develop' into sam/oriole16
samrose Oct 24, 2024
fed90a0
chore: cleanup names
samrose Oct 24, 2024
9b078d0
chore: correct names
samrose Oct 24, 2024
bc2b4cc
fix: var name
samrose Oct 24, 2024
12dc397
fix: one more var name
samrose Oct 24, 2024
73944e1
chore: bump to release
samrose Oct 24, 2024
9ae9c9f
fix: reformatting metadata for clikchouse dep as git was not able to …
samrose Oct 24, 2024
fa05170
feat: wip refactor to pg 17 for orioledb
samrose Oct 24, 2024
0e283e6
feat: working orioledb-17
samrose Oct 25, 2024
051c9fd
fix: increase role duration to avoid expiration
samrose Oct 27, 2024
33b8948
fix: correct version
samrose Oct 27, 2024
230c7c7
fix: clickhouse needs git in build inputs
samrose Oct 28, 2024
ee4ce32
fix: install and then remove git for clickhouse dep
samrose Oct 28, 2024
2ccb5ac
fix: correct rules for version
samrose Oct 28, 2024
f9cadcc
fix: db_user_namespace was deprecated starting in pg 16.4 and higher
samrose Oct 28, 2024
1c9c1f1
apply fix for wrappers build, deactivate ext in unit test
samrose Oct 28, 2024
d02197e
Merge branch 'develop' into sam/oriole17
samrose Oct 28, 2024
2f0186f
chore: deactivate more tests due to deactivated extensions
samrose Oct 28, 2024
4ac77c4
fix: also remove from sql file
samrose Oct 28, 2024
61434e0
fix: regex
samrose Oct 28, 2024
24b7442
fix: also remove ref here
samrose Oct 29, 2024
9ec0bfa
fix: graphql_public schema too
samrose Oct 29, 2024
37d6e49
chore: correct dir
samrose Oct 29, 2024
45de660
chore: staging release
samrose Oct 29, 2024
dd649cc
feat: re-introduce wal2json rum and pgvector
samrose Oct 29, 2024
a1efc9b
fix: also restore pgvector in start-server
samrose Oct 29, 2024
feec1e5
chore: bump staging release
samrose Oct 29, 2024
1444882
feat: oriole specific default settings
samrose Oct 30, 2024
2fb7958
feat: use icu for locales only if building orioledb
samrose Oct 30, 2024
2ff3c01
fix: need var in stage 1 too
samrose Oct 30, 2024
18d9116
fix: settings must be in db init
samrose Oct 30, 2024
1d6c728
fix: ansible args
samrose Oct 30, 2024
376f8d9
fix: PostgreSQL uses ICU for all locale-related operations, so we don…
samrose Oct 30, 2024
c2312c3
chore: add a migration for orioledb activation by default
samrose Oct 31, 2024
cbcb962
feat: turn on oriole if oriole ext exists
samrose Oct 31, 2024
c11d2e9
test: conditional on test for orioledb
samrose Oct 31, 2024
5bc0e33
fix: salt changed repo and method for adding apt package
samrose Oct 31, 2024
a822ca4
fix: udpate salt minion setup
samrose Oct 31, 2024
5af2b29
Merge branch 'develop' into sam/oriole17
samrose Oct 31, 2024
2b3df4b
fix: silent skip if oriole not in the install
samrose Nov 4, 2024
1f955df
test: check if oriole is available and if so then enable
samrose Nov 4, 2024
b55c025
Merge branch 'develop' into sam/oriole17
samrose Nov 4, 2024
8ff1419
chore: build and cache src and debug pkgs as well
samrose Nov 4, 2024
c9da3ec
fix: tmp supress build of src and debug
samrose Nov 4, 2024
78491e2
chore: tmp disable src and debug
samrose Nov 4, 2024
41f291e
fix: activate oriole first in the oriole context
samrose Nov 4, 2024
c1962cb
fix: pgroonga build on macos
samrose Nov 4, 2024
d58f7e6
fix: restore flake check for now
samrose Nov 4, 2024
9abe2c9
fixing flake check for darwin + passing check until pg_net
samrose Nov 4, 2024
e510e12
fix: start-server macos
samrose Nov 4, 2024
8cfa69c
fix: src yq from apt
samrose Nov 5, 2024
bdf3122
fix: all instances yq
samrose Nov 5, 2024
a1b483f
fix: jq invoke
samrose Nov 5, 2024
53b5f3f
fix: nix profile install
samrose Nov 5, 2024
ec022a1
fix: nix run
samrose Nov 5, 2024
18661bf
fix: sudo nix run
samrose Nov 5, 2024
39827b2
chore: cut staging release
samrose Nov 5, 2024
7dd46e9
chore: rm debugging
samrose Nov 5, 2024
b26114d
Merge branch 'develop' into sam/oriole17
samrose Nov 6, 2024
4775b44
fix: still need CURRENT_SYSTEM
samrose Nov 6, 2024
f075b02
test: re-introduce flake checks for 15 and 16
samrose Nov 6, 2024
d29bd9c
chore: bump versions of patched pg for oriole to 17_4 and ext to beta6
samrose Nov 15, 2024
9a2d617
Merge branch 'develop' into sam/oriole17
samrose Nov 15, 2024
a5ca7b2
chore: bump var to release ami
samrose Nov 15, 2024
3216091
chore: break down into functions
samrose Nov 21, 2024
4281edb
Merge branch 'develop' into sam/oriole17
samrose Nov 21, 2024
84d78d6
fix: skip x86 darwin for oriole nix builds
samrose Nov 22, 2024
a0f32b4
chore: cleanup repo for final review, rebase and merge
samrose Nov 22, 2024
af742b1
fix: try to properly init db in non oriole context
samrose Nov 22, 2024
4a29ae0
Merge branch 'develop' into sam/oriole17
samrose Nov 22, 2024
25da7c3
chore: restore installation of debug and src for all versions`
samrose Nov 22, 2024
adc0db8
chore: newline
samrose Nov 25, 2024
0dca87f
Merge branch 'develop' into sam/oriole17-backup
samrose Nov 25, 2024
cb075b7
chore: cleaning up and restoring missing code
samrose Nov 25, 2024
9260c02
chore: cleanup
samrose Nov 25, 2024
cdbc06f
chore: fix gh action conditonal for oriole
samrose Nov 25, 2024
b04925c
fix: filter orioledb-17 from test on read
samrose Nov 25, 2024
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
7 changes: 3 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:

build:
needs: prepare
if: ${{ !contains(needs.prepare.outputs.postgres_versions, 'orioledb-17') }}
strategy:
matrix:
postgres_version: ${{ fromJson(needs.prepare.outputs.postgres_versions) }}
Expand Down Expand Up @@ -63,14 +64,13 @@ jobs:

- name: Generate common-nix.vars.pkr.hcl
run: |

PG_VERSION=$(nix run nixpkgs#yq -- '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
PG_VERSION=$(echo $PG_VERSION | tr -d '"') # Remove any surrounding quotes
echo 'postgres-version = "'$PG_VERSION'"' > common-nix.vars.pkr.hcl
# Ensure there's a newline at the end of the file
echo "" >> common-nix.vars.pkr.hcl

- id: settings
# Remove spaces and quotes to get the raw version string
run: sed -r 's/(\s|\")+//g' common-nix.vars.pkr.hcl >> $GITHUB_OUTPUT

- name: Generate args
Expand All @@ -81,7 +81,6 @@ jobs:
echo "$ARGS" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

#TODO PR Convert to develop branch flakeurl
- name: verify schema.sql is committed
run: |
GIT_SHA=${{github.sha}}
Expand All @@ -90,4 +89,4 @@ jobs:
echo "Detected changes in schema.sql:"
git diff migrations/schema-${{ env.PGMAJOR }}.sql
exit 1
fi
fi
3 changes: 2 additions & 1 deletion .github/workflows/testinfra-nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set PostgreSQL versions
id: set-versions
run: |
VERSIONS=$(nix run nixpkgs#yq -- '.postgres_major[]' ansible/vars.yml | nix run nixpkgs#jq -- -R -s -c 'split("\n")[:-1]')
VERSIONS=$(nix run nixpkgs#yq -- '.postgres_major[]' ansible/vars.yml | nix run nixpkgs#jq -- -R -s -c 'split("\n")[:-1]')
echo "postgres_versions=$VERSIONS" >> $GITHUB_OUTPUT

test-ami-nix:
Expand Down Expand Up @@ -61,6 +61,7 @@ jobs:

- name: Set PostgreSQL version environment variable
run: echo "POSTGRES_MAJOR_VERSION=${{ matrix.postgres_version }}" >> $GITHUB_ENV


- name: Generate common-nix.vars.pkr.hcl
run: |
Expand Down
44 changes: 42 additions & 2 deletions ansible/files/postgres_prestart.sh.j2
Original file line number Diff line number Diff line change
@@ -1,9 +1,49 @@
#!/bin/bash

check_orioledb_enabled() {
local pg_conf="/etc/postgresql/postgresql.conf"
if [ ! -f "$pg_conf" ]; then
return 0
fi
grep "^shared_preload_libraries" "$pg_conf" | grep -c "orioledb" || return 0
}

get_shared_buffers() {
local opt_conf="/etc/postgresql-custom/generated-optimizations.conf"
if [ ! -f "$opt_conf" ]; then
return 0
fi
grep "^shared_buffers = " "$opt_conf" | cut -d "=" -f2 | tr -d ' ' || return 0
}

update_orioledb_buffers() {
local pg_conf="/etc/postgresql/postgresql.conf"
local value="$1"
if grep -q "^orioledb.main_buffers = " "$pg_conf"; then
sed -i "s/^orioledb.main_buffers = .*/orioledb.main_buffers = $value/" "$pg_conf"
else
echo "orioledb.main_buffers = $value" >> "$pg_conf"
fi
}

main() {
local has_orioledb=$(check_orioledb_enabled)
if [ "$has_orioledb" -lt 1 ]; then
return 0
fi
local shared_buffers_value=$(get_shared_buffers)
if [ ! -z "$shared_buffers_value" ]; then
update_orioledb_buffers "$shared_buffers_value"
fi
}

# Initial locale setup
if [ $(cat /etc/locale.gen | grep -c en_US.UTF-8) -eq 0 ]; then
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
fi

if [ $(locale -a | grep -c en_US.utf8) -eq 0 ]; then
locale-gen
locale-gen
fi

main
60 changes: 43 additions & 17 deletions ansible/tasks/setup-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,23 +204,49 @@
ansible_command_timeout: 60
when: debpkg_mode

- name: Initialize the database stage2_nix
become: yes
become_user: postgres
shell: source /var/lib/postgresql/.bashrc && /usr/lib/postgresql/bin/pg_ctl -D /var/lib/postgresql/data initdb -o "--allow-group-access" -o "--username=supabase_admin"
args:
executable: /bin/bash
environment:
LANG: en_US.UTF-8
LANGUAGE: en_US.UTF-8
LC_ALL: en_US.UTF-8
LC_CTYPE: en_US.UTF-8
LOCALE_ARCHIVE: /usr/lib/locale/locale-archive
vars:
ansible_command_timeout: 60
# Circumvents the following error:
# "Timeout (12s) waiting for privilege escalation prompt"
when: stage2_nix
- name: Check psql_version and modify supautils.conf and postgresql.conf if necessary
block:
- name: Check if psql_version is psql_orioledb
set_fact:
is_psql_oriole: "{{ psql_version in ['psql_orioledb-16', 'psql_orioledb-17'] }}"

- name: Initialize the database stage2_nix (non-orioledb)
become: yes
become_user: postgres
shell: source /var/lib/postgresql/.bashrc && /usr/lib/postgresql/bin/pg_ctl -D /var/lib/postgresql/data initdb -o "--allow-group-access" -o "--username=supabase_admin"
args:
executable: /bin/bash
environment:
LANG: en_US.UTF-8
LANGUAGE: en_US.UTF-8
LC_ALL: en_US.UTF-8
LC_CTYPE: en_US.UTF-8
LOCALE_ARCHIVE: /usr/lib/locale/locale-archive
vars:
ansible_command_timeout: 60
when: stage2_nix and not is_psql_oriole

- name: Initialize the database stage2_nix (orioledb)
become: yes
become_user: postgres
shell: >
source /var/lib/postgresql/.bashrc && initdb -D /var/lib/postgresql/data
--allow-group-access
--username=supabase_admin
--locale-provider=icu
--encoding=UTF-8
--icu-locale=en_US.UTF-8
args:
executable: /bin/bash
environment:
LANG: en_US.UTF-8
LANGUAGE: en_US.UTF-8
LC_ALL: en_US.UTF-8
LC_CTYPE: en_US.UTF-8
LOCALE_ARCHIVE: /usr/lib/locale/locale-archive
vars:
ansible_command_timeout: 60
when: stage2_nix and is_psql_oriole

- name: copy PG systemd unit
template:
Expand Down
79 changes: 69 additions & 10 deletions ansible/tasks/stage2-setup-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,52 @@
# sudo -u postgres bash -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix profile install nixpkgs#openjdk11"
# It was decided to leave pljava disabled at https://github.com/supabase/postgres/pull/690 therefore removing this task

- name: Check psql_version and modify supautils.conf and postgresql.conf if necessary
block:
- name: Check if psql_version is psql_orioledb-16
set_fact:
is_psql_oriole: "{{ psql_version in ['psql_orioledb-16', 'psql_orioledb-17'] }}"

- name: Remove specified extensions from postgresql.conf if oriole-16 build
ansible.builtin.command:
cmd: >
sed -i 's/ timescaledb,//g'
/etc/postgresql/postgresql.conf
when: is_psql_oriole and stage2_nix
become: yes

- name: Remove specified extensions from supautils.conf if oriole-16 build
ansible.builtin.command:
cmd: >
sed -i 's/ timescaledb,//g; s/ vector,//g; s/ plv8,//g; s/ postgis,//g; s/ pgrouting,//g'
/etc/postgresql-custom/supautils.conf
when: is_psql_oriole and stage2_nix
become: yes

- name: Remove db_user_namespace from postgresql.conf if oriole-xx build
ansible.builtin.command:
cmd: >
sed -i 's/db_user_namespace = off/#db_user_namespace = off/g;'
/etc/postgresql/postgresql.conf
when: is_psql_oriole and stage2_nix
become: yes

- name: Append orioledb to shared_preload_libraries append within closing quote
ansible.builtin.command:
cmd: >
sed -i 's/\(shared_preload_libraries.*\)'\''\(.*\)$/\1, orioledb'\''\2/'
samrose marked this conversation as resolved.
Show resolved Hide resolved
/etc/postgresql/postgresql.conf
when: is_psql_oriole and stage2_nix
become: yes

- name: Add default_table_access_method setting
ansible.builtin.lineinfile:
path: /etc/postgresql/postgresql.conf
line: "default_table_access_method = 'orioledb'"
state: present
when: is_psql_oriole and stage2_nix
become: yes

- name: Install Git for Nix package management
become: yes
apt:
Expand All @@ -16,7 +62,6 @@
become: yes
shell: |
sudo -u postgres bash -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix profile install github:supabase/postgres/{{ git_commit_sha }}#{{psql_version}}/bin"
#TODO (samrose) switch pg_prove sourcing to develop branch once PR is merged
when: stage2_nix

- name: Install pg_prove from nix binary cache
Expand Down Expand Up @@ -51,7 +96,7 @@
autoremove: yes
purge: yes
when: stage2_nix

- name: Set ownership and permissions for /etc/ssl/private
become: yes
file:
Expand Down Expand Up @@ -216,13 +261,19 @@
recurse: yes
when: stage2_nix

- name: Recursively create symbolic links and set permissions for the contrib/postgis-* dir
shell: >
sudo mkdir -p /usr/lib/postgresql/share/postgresql/contrib && \
sudo find /var/lib/postgresql/.nix-profile/share/postgresql/contrib/ -mindepth 1 -type d -exec sh -c 'for dir do sudo ln -s "$dir" "/usr/lib/postgresql/share/postgresql/contrib/$(basename "$dir")"; done' sh {} + \
&& chown -R postgres:postgres "/usr/lib/postgresql/share/postgresql/contrib/"
become: yes
when: stage2_nix
- name: Check psql_version and run postgis linking if not oriole-16
block:
- name: Check if psql_version is psql_orioledb-17
set_fact:
is_psql_oriole: "{{ psql_version == 'psql_orioledb-17' }}"

- name: Recursively create symbolic links and set permissions for the contrib/postgis-* dir
shell: >
sudo mkdir -p /usr/lib/postgresql/share/postgresql/contrib && \
sudo find /var/lib/postgresql/.nix-profile/share/postgresql/contrib/ -mindepth 1 -type d -exec sh -c 'for dir do sudo ln -s "$dir" "/usr/lib/postgresql/share/postgresql/contrib/$(basename "$dir")"; done' sh {} + \
&& chown -R postgres:postgres "/usr/lib/postgresql/share/postgresql/contrib/"
become: yes
when: stage2_nix and not is_psql_oriole

- name: Create symbolic links from /var/lib/postgresql/.nix-profile/share/postgresql/timezonesets to /usr/lib/postgresql/share/postgresql/timeszonesets
file:
Expand Down Expand Up @@ -257,8 +308,16 @@
line: pgsodium.getkey_script= '{{ pg_bindir }}/pgsodium_getkey.sh'
when: stage2_nix

- name: Create symbolic link for pgsodium_getkey script
file:
src: "/usr/lib/postgresql/bin/pgsodium_getkey.sh"
dest: "/usr/lib/postgresql/share/postgresql/extension/pgsodium_getkey"
state: link
become: yes
when: stage2_nix

- name: Append GRN_PLUGINS_DIR to /etc/environment.d/postgresql.env
ansible.builtin.lineinfile:
path: /etc/environment.d/postgresql.env
line: 'GRN_PLUGINS_DIR=/var/lib/postgresql/.nix-profile/lib/groonga/plugins'
become: yes
become: yes
71 changes: 70 additions & 1 deletion ansible/tasks/test-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,22 @@
- libtap-parser-sourcehandler-pgtap-perl
when: debpkg_mode

# - name: Temporarily disable PG Sodium references in config
# become: yes
# become_user: postgres
# shell:
# cmd: sed -i.bak -e "s/pg_net,\ pgsodium,\ timescaledb/pg_net,\ timescaledb/g" -e "s/pgsodium.getkey_script=/#pgsodium.getkey_script=/g" /etc/postgresql/postgresql.conf
# when: debpkg_mode or stage2_nix

- name: Temporarily disable PG Sodium references in config
become: yes
become_user: postgres
shell:
cmd: sed -i.bak -e "s/pg_net,\ pgsodium,\ timescaledb/pg_net,\ timescaledb/g" -e "s/pgsodium.getkey_script=/#pgsodium.getkey_script=/g" /etc/postgresql/postgresql.conf
cmd: >
sed -i.bak
-e 's/\(shared_preload_libraries = '\''.*\)pgsodium,\(.*'\''\)/\1\2/'
-e 's/pgsodium.getkey_script=/#pgsodium.getkey_script=/'
/etc/postgresql/postgresql.conf
when: debpkg_mode or stage2_nix

- name: Start Postgres Database to load all extensions.
Expand Down Expand Up @@ -46,6 +57,64 @@
LOCALE_ARCHIVE: /usr/lib/locale/locale-archive
when: stage2_nix


- name: Check psql_version and modify migrations if oriole-xx
block:
- name: Check if psql_version is psql_orioledb-xx
set_fact:
is_psql_oriole: "{{ psql_version in ['psql_orioledb-16', 'psql_orioledb-17'] }}"

- name: Remove specified extensions from SQL file
ansible.builtin.command:
cmd: >
sed -i '/\\ir.*\(timescaledb\|postgis\|pgrouting\|plv8\|pg_jsonschema\|pg_graphql\).*\.sql/d' /tmp/migrations/tests/extensions/test.sql
when: is_psql_oriole
become: yes

- name: Remove specified extension files from extensions directory
ansible.builtin.find:
paths: /tmp/migrations/tests/extensions
patterns:
- '*timescaledb*.sql'
- '*postgis*.sql'
- '*pgrouting*.sql'
- '*plv8*.sql'
- '*pg_jsonschema*.sql'
- '*pg_graphql*.sql'
register: files_to_remove
when: is_psql_oriole

- name: Delete matched extension files
ansible.builtin.file:
path: "{{ item.path }}"
state: absent
loop: "{{ files_to_remove.files }}"
when: is_psql_oriole
become: yes

- name: Remove specified extensions from SQL file
ansible.builtin.command:
cmd: >
sed -i "/'pg_graphql',/d" /tmp/unit-tests/unit-test-01.sql
when: is_psql_oriole
become: yes

- name: Remove graphql schema test
lineinfile:
path: /tmp/migrations/tests/database/exists.sql
regexp: "^SELECT has_schema\\('graphql'\\);$"
state: absent
become: yes
when: is_psql_oriole

- name: Remove graphql schema test
lineinfile:
path: /tmp/migrations/tests/database/exists.sql
regexp: "^SELECT has_schema\\('graphql_public'\\);$"
state: absent
become: yes
when: is_psql_oriole

- name: Run Unit tests (with filename unit-test-*) on Postgres Database
shell: /usr/bin/pg_prove -U postgres -h localhost -d postgres -v /tmp/unit-tests/unit-test-*.sql
register: retval
Expand Down
Loading