Skip to content

Commit

Permalink
feat: Make it possible to define the used PostgreSQL version
Browse files Browse the repository at this point in the history
  • Loading branch information
ZPascal committed Nov 28, 2023
1 parent 03bb0c3 commit d16903a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions ci/tasks/bump-postgres-packages/task.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ pushd postgres-release
fi

if ${NEED_COMMIT}; then
# TODO Adjust the update part and patch the default version in case of an update
eval $(grep "^current_version=" jobs/postgres/templates/pgconfig.sh.erb)
new_version=$(echo "${FILENAME}" | egrep -o "[0-9.]+[0-9]")

# If new version is greater than current version, update the current_version variables
if printf '%s\n' "$current_version" "$new_version" | sort -V -C; then
sed -i "s/^current_version=.*/current_version=\"${new_version}\"/" jobs/postgres/templates/pgconfig.sh.erb
sed -i "s/^current_version=.*/current_version=\"${new_version}\"/" jobs/bbr-postgres-db/templates/config.sh.erb
sed -i "s/^current_version=.*/current_version=\"${new_version}\"/" jobs/postgres/spec
sed -i "s/^current_version=.*/current_version=\"${new_version}\"/" jobs/bbr-postgres-db/spec
fi

echo "-----> $(date): Creating git commit"
Expand Down
3 changes: 1 addition & 2 deletions jobs/bbr-postgres-db/templates/config.sh.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ if_link("database") do |data|
port = data.p("databases.port")
databases = data.p("databases.databases")
end

%>
current_version="15.5"
current_version="<%=p('databases.version')%>"
JOB_DIR="/var/vcap/jobs/bbr-postgres-db"
PACKAGE_DIR="/var/vcap/packages/postgres-${current_version%.*}"
PORT="<%= port %>"
Expand Down
3 changes: 3 additions & 0 deletions jobs/postgres/spec
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ provides:
- databases.tls.ca

properties:
databases.version:
description: "The database version e.g. 11.22, 13.13 or 15.5"
default: "15.5"
databases.port:
description: "The database port"
default: 5432
Expand Down
2 changes: 1 addition & 1 deletion jobs/postgres/templates/pgconfig.sh.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -x # if you want tracing disabled, set 'databases.enable_traces: false' in t
ENABLE_TRACE=0
# set -x # uncomment it if you want to enable tracing in all control scripts
<% end %>
current_version="15.5"
current_version="<%=p('databases.version')%>"
pgversion_current="postgres-${current_version}"

JOB_DIR=/var/vcap/jobs/postgres
Expand Down

0 comments on commit d16903a

Please sign in to comment.