Skip to content

Commit

Permalink
fix: Adjust the setup
Browse files Browse the repository at this point in the history
  • Loading branch information
ZPascal committed May 19, 2024
1 parent 76be3d4 commit f58e208
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion ci/tasks/bump-postgres-packages/task.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pushd postgres-release
if ${NEED_COMMIT}; then
echo "-----> $(date): Update the PostgreSQL version inside the used_postgresql_versions.yml file"
current_minor_version=$(cat config/blobs.yml | grep "postgresql-${MAJOR_VERSION}" | cut -f1 -d: | sed "s/postgres\/postgresql-//g" | sed "s/.tar.gz//g")
CURRENT_MINOR_VERSION=$current_minor_version /tmp/yq -i '.postgresql.major_version[env(MAJOR_VERSION)].minor_version = strenv(CURRENT_MINOR_VERSION)' jobs/postgres/used_postgresql_versions.yml
CURRENT_MINOR_VERSION=$current_minor_version /tmp/yq -i '.postgresql.major_version[env(MAJOR_VERSION)].minor_version = strenv(CURRENT_MINOR_VERSION)' jobs/postgres/config/used_postgresql_versions.yml

echo "-----> $(date): Creating git commit"
git config user.name "$GIT_USER_NAME"
Expand Down
4 changes: 2 additions & 2 deletions ci/tasks/create-final-release/task.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ curl -s -L https://github.com/mikefarah/yq/releases/download/v${latest_yq_versio
bosh -n create-release --final
new_release_version="$(find releases -regex ".*postgres-[0-9]*.yml" | egrep -o "[0-9]+" | sort -n | tail -n 1)"

current_major_version=$(/tmp/yq '.postgresql.default' jobs/postgres/used_postgresql_versions.yml)
current_minor_version=$(CURRENT_MAJOR_VERSION=$current_major_version /tmp/yq '.postgresql.major_version[env(CURRENT_MAJOR_VERSION)].minor_version' jobs/postgres/used_postgresql_versions.yml)
current_major_version=$(/tmp/yq '.postgresql.default' jobs/postgres/config/used_postgresql_versions.yml)
current_minor_version=$(CURRENT_MAJOR_VERSION=$current_major_version /tmp/yq '.postgresql.major_version[env(CURRENT_MAJOR_VERSION)].minor_version' jobs/postgres/config/used_postgresql_versions.yml)
sed -i "/^versions:/a\ \ ${new_release_version}: \"PostgreSQL ${current_minor_version}\"" versions.yml
git add versions.yml

Expand Down
4 changes: 2 additions & 2 deletions ci/tasks/run-acceptance-tests/task.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ function main() {
install_bbr
upload_release
bosh upload-stemcell stemcell/stemcell.tgz
current_major_version=$(/tmp/yq '.postgresql.default' jobs/postgres/used_postgresql_versions.yml)
current_minor_version=$(CURRENT_MAJOR_VERSION=$current_major_version /tmp/yq '.postgresql.major_version[env(CURRENT_MAJOR_VERSION)].minor_version' jobs/postgres/used_postgresql_versions.yml)
current_major_version=$(/tmp/yq '.postgresql.default' jobs/postgres/config/used_postgresql_versions.yml)
current_minor_version=$(CURRENT_MAJOR_VERSION=$current_major_version /tmp/yq '.postgresql.major_version[env(CURRENT_MAJOR_VERSION)].minor_version' jobs/postgres/config/used_postgresql_versions.yml)
echo "current_version=${current_minor_version}" > ${root}/pgconfig.sh
source ${root}/pgconfig.sh
config_file="${root}/pgats_config.yml"
Expand Down
4 changes: 2 additions & 2 deletions jobs/bbr-postgres-db/templates/config.sh.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ end

%>

current_version=postgres-$(MAJOR_VERSION=<%=p('databases.version')%> ${JOB_DIR}/packages/yq-4/bin/yq '.postgresql.major_version[env(MAJOR_VERSION)].minor_version' /var/vcap/jobs/postgres/used_postgresql_versions.yml)
current_version=postgres-$(MAJOR_VERSION=<%=p('databases.version')%> ${JOB_DIR}/packages/yq-4/bin/yq '.postgresql.major_version[env(MAJOR_VERSION)].minor_version' /var/vcap/jobs/postgres/config/used_postgresql_versions.yml)
JOB_DIR="/var/vcap/jobs/bbr-postgres-db"
PACKAGE_DIR="/var/vcap/packages/${current_version}"
PACKAGE_DIR="/var/vcap/packages/${current_version%.*}"
PORT="<%= port %>"
DATABASES=(<%= databases.map{|d| d["name"]}.join(' ')%>)
DBHOST=<%= dbhost %>
Expand Down
1 change: 1 addition & 0 deletions jobs/postgres/spec
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ templates:
hooks/postgres-pre-stop.sh.erb: bin/hooks/postgres-pre-stop.sh
hooks/postgres-post-start.sh.erb: bin/hooks/postgres-post-start.sh
hooks/postgres-post-stop.sh.erb: bin/hooks/postgres-post-stop.sh
used_postgresql_versions.yml: config/used_postgresql_versions.yml

packages:
- postgres-common
Expand Down
4 changes: 2 additions & 2 deletions jobs/postgres/templates/pgconfig.sh.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ ENABLE_TRACE=0
<% end %>
JOB_DIR=/var/vcap/jobs/postgres
current_version="<%=p('databases.version')%>"
pgversion_current=postgres-$(MAJOR_VERSION=<%=p('databases.version')%> ${JOB_DIR}/packages/yq-4/bin/yq '.postgresql.major_version[env(MAJOR_VERSION)].minor_version' /var/vcap/jobs/postgres/used_postgresql_versions.yml)
pgversion_current=postgres-$(MAJOR_VERSION=<%=p('databases.version')%> ${JOB_DIR}/packages/yq-4/bin/yq '.postgresql.major_version[env(MAJOR_VERSION)].minor_version' /var/vcap/jobs/postgres/config/used_postgresql_versions.yml)

PACKAGE_DIR="/var/vcap/packages/${pgversion_current}"
PACKAGE_DIR="/var/vcap/packages/${pgversion_current%.*}"
STORE_DIR=/var/vcap/store
PG_STORE_DIR=${STORE_DIR}/postgres
VERSION_FILE=${PG_STORE_DIR}/POSTGRES_DATA_VERSION
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/yq-4/packaging
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function install() {

echo "Install yq..."
mkdir -p "${BOSH_INSTALL_TARGET}/bin"
cp -a yq/yq-4-* "${BOSH_INSTALL_TARGET}/bin/yq"
cp -a yq/yq-4.* "${BOSH_INSTALL_TARGET}/bin/yq"
chmod +x "${BOSH_INSTALL_TARGET}/bin/yq"

}
Expand Down

0 comments on commit f58e208

Please sign in to comment.