Skip to content

Commit

Permalink
fix in comments
Browse files Browse the repository at this point in the history
Signed-off-by: xieydd <[email protected]>
  • Loading branch information
xieydd committed Nov 25, 2024
1 parent 4c63e4d commit 1d8a9e1
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 50 deletions.
27 changes: 23 additions & 4 deletions .github/workflows/trunk-install-test.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,43 @@
name: Trunk install test workflow

on:
release:
types: [created]
workflow_dispatch:
inputs:
version:
type: string
description: Version
tag:
description: 'tag name (semver without v-prefix)'
required: true
type: string

jobs:
semver:
runs-on: ubuntu-latest
outputs:
SEMVER: ${{ steps.semver.outputs.SEMVER }}
steps:
- uses: actions/github-script@v7
id: semver
with:
script: |
const tag = "${{ github.event.inputs.tag }}" || "${{ github.event.release.tag_name }}";
console.log(`Tag: ${tag}`);
const r = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
if (!r.test(tag)) {
core.setFailed(`Action failed with an invalid semver.`);
}
core.setOutput('SEMVER', tag);
test:
name: Run tests
runs-on:
- ubuntu-latest
needs: ["semver"]
strategy:
matrix:
version: [14, 15, 16]
platform: ["amd64"]
container:
image: modelzai/vchord-cnpg:${{ matrix.version }}-v${{ github.event.inputs.version }}
image: modelzai/vchord-cnpg:${{ matrix.version }}-v${{ needs.semver.outputs.SEMVER }}
options: --user root
credentials:
username: ${{ secrets.DOCKERIO_MODELZ_USERNAME }}
Expand Down
8 changes: 4 additions & 4 deletions docker/pg-cnpg/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ RUN set -xe; \
python3-setuptools \
; \
pip3 install --upgrade pip; \
# TODO: Remove --no-deps once https://github.com/pypa/pip/issues/9644 is solved
# TODO: Remove --no-deps once https://github.com/pypa/pip/issues/9644 is solved
pip3 install --no-deps -r requirements.txt; \
apt-get autoremove -y; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*;
apt-get autoremove -y; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*;

RUN chown -R postgres:postgres ${ALTDIR}/${PG_MAJOR} && \
chmod -R 0700 ${ALTDIR}/${PG_MAJOR}
Expand Down
76 changes: 38 additions & 38 deletions docker/pg-cnpg/trunk-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,49 @@ extension_count=$(<$file wc -l)
lines=$(cat $file)
for line in $lines
do
output=$(trunk install $line 2>&1)
output=$(trunk install $line 2>&1)

if [ $? -ne 0 ]; then
if [[ $output == *"Failed to find an archive for"* || $output == *"Failed to fetch Trunk archive from"* ]]; then
version_not_found_extensions+=("$line")
else
echo "trunk install command failed"
trunk_install_failed_extensions+=("$line")
fi
if [ $? -ne 0 ]; then
if [[ $output == *"Failed to find an archive for"* || $output == *"Failed to fetch Trunk archive from"* ]]; then
version_not_found_extensions+=("$line")
else
echo "trunk install command failed"
trunk_install_failed_extensions+=("$line")
fi
echo $output
printf "\n\n"
fi
echo $output
printf "\n\n"
done
IFS=$'\n' extensions=(`psql postgres://postgres:postgres@localhost:5432 -tA postgres -c 'select name from pg_available_extensions;'`)
for ext in "${extensions[@]}"
do
# drop schema columnar if ext name is columnar
if [ "$ext" == "columnar" ]; then
psql postgres://postgres:postgres@localhost:5432 -c "drop extension if exists citus_columnar cascade;"
# drop schema columnar if ext name is columnar
if [ "$ext" == "columnar" ]; then
psql postgres://postgres:postgres@localhost:5432 -c "drop extension if exists citus_columnar cascade;"
fi
# drop type semver if ext name is semver
if [ "$ext" == "semver" ]; then
psql postgres://postgres:postgres@localhost:5432 -c "drop extension if exists pg_text_semver cascade;"
fi
# if extension name is meta_triggers, create extension meta first and create extension meta_triggers
if [ "$ext" == "meta_triggers" ]; then
psql postgres://postgres:postgres@localhost:5432 -c "create extension if not exists hstore cascade;"
psql postgres://postgres:postgres@localhost:5432 -c "create extension if not exists meta cascade;"
psql postgres://postgres:postgres@localhost:5432 -c "create extension if not exists meta_triggers cascade;"
fi
output=$(psql postgres://postgres:postgres@localhost:5432 -c "create extension if not exists \"$ext\" cascade;" 2>&1)
if [ $? -ne 0 ]; then
if [[ $output == *"shared_preload_libraries"* ]]; then
need_load_shared_preload_libraries_extensions+=("$ext")
elif [[ $output == *"already exists"* ]]; then
echo "extension \"$ext\" already exists"
else
echo "CREATE EXTENSION command failed"
failed_extensions+=("$ext")
fi
# drop type semver if ext name is semver
if [ "$ext" == "semver" ]; then
psql postgres://postgres:postgres@localhost:5432 -c "drop extension if exists pg_text_semver cascade;"
fi
# if extension name is meta_triggers, create extension meta first and create extension meta_triggers
if [ "$ext" == "meta_triggers" ]; then
psql postgres://postgres:postgres@localhost:5432 -c "create extension if not exists hstore cascade;"
psql postgres://postgres:postgres@localhost:5432 -c "create extension if not exists meta cascade;"
psql postgres://postgres:postgres@localhost:5432 -c "create extension if not exists meta_triggers cascade;"
fi
output=$(psql postgres://postgres:postgres@localhost:5432 -c "create extension if not exists \"$ext\" cascade;" 2>&1)
if [ $? -ne 0 ]; then
if [[ $output == *"shared_preload_libraries"* ]]; then
need_load_shared_preload_libraries_extensions+=("$ext")
elif [[ $output == *"already exists"* ]]; then
echo "extension \"$ext\" already exists"
else
echo "CREATE EXTENSION command failed"
failed_extensions+=("$ext")
fi
fi
echo $output
printf "\n\n"
fi
echo $output
printf "\n\n"
done
available_extensions_count=${#extensions[@]}
failure_count=${#failed_extensions[@]}
Expand All @@ -70,11 +70,11 @@ echo "$need_load_shared_preload_libraries_count / $extension_count"
printf "\n\n***NEED TO LOAD shared_preload_libraries EXTENSIONS***\n"
for need in "${need_load_shared_preload_libraries_extensions[@]}"
do
echo $need
echo $need
done

printf "\n\n***FAILED EXTENSIONS***\n"
for failed in "${failed_extensions[@]}"
do
echo $failed
echo $failed
done
8 changes: 4 additions & 4 deletions docker/pg-slim/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ FROM ubuntu:22.04

# 14, 15, 16, 17
ARG PG_MAJOR
ARG DEBIAN_FRONTEND=noninteractive
ARG ALTDIR=/var/lib/postgresql/data/tensorchord
ENV TZ=Etc/UTC
ENV PGDATA /var/lib/postgresql/data
ENV DEBIAN_FRONTEND=noninteractive \
TZ=Etc/UTC \
PGDATA=/var/lib/postgresql/data

# Get latest package updates
RUN set -eux; \
Expand All @@ -27,7 +27,7 @@ RUN set -eux; \
locales curl ca-certificates gnupg lsb-release lbzip2 git cmake \
; \
rm -rf /var/lib/apt/lists/*; \
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LANG en_US.utf8

RUN mkdir /docker-entrypoint-initdb.d
Expand Down

0 comments on commit 1d8a9e1

Please sign in to comment.