From 693745bfbd2867d11bee334df1557dbfc8f2f7ef Mon Sep 17 00:00:00 2001 From: Mikhail Klimko Date: Fri, 6 Jun 2025 13:33:00 +0300 Subject: [PATCH 1/7] onprem: 2.8.2 --- codefresh/Chart.yaml | 6 ++---- codefresh/README.md | 2 +- codefresh/files/postgresSeedJobScript.sh | 14 +++++++++++++- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/codefresh/Chart.yaml b/codefresh/Chart.yaml index 998529e22..d6534d482 100644 --- a/codefresh/Chart.yaml +++ b/codefresh/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 description: Helm Chart for Codefresh On-Prem name: codefresh -version: 2.8.1 +version: 2.8.2 keywords: - codefresh home: https://codefresh.io/ @@ -18,10 +18,8 @@ annotations: # artifacthub.io/containsSecurityUpdates: "true" # supported kinds are added, changed, deprecated, removed, fixed and security. artifacthub.io/changes: | - - kind: added - description: "Documentation about external MongoDB Atlas" - kind: fixed - description: "Fix postgresql seed job" + description: "Fix grantPrivileges function in seed job" dependencies: - name: cf-common repository: oci://quay.io/codefresh/charts diff --git a/codefresh/README.md b/codefresh/README.md index 2c44cc8f5..2efd0b612 100644 --- a/codefresh/README.md +++ b/codefresh/README.md @@ -1,6 +1,6 @@ ## Codefresh On-Premises -![Version: 2.8.1](https://img.shields.io/badge/Version-2.8.1-informational?style=flat-square) ![AppVersion: 2.8.0](https://img.shields.io/badge/AppVersion-2.8.0-informational?style=flat-square) +![Version: 2.8.2](https://img.shields.io/badge/Version-2.8.2-informational?style=flat-square) ![AppVersion: 2.8.0](https://img.shields.io/badge/AppVersion-2.8.0-informational?style=flat-square) Helm chart for deploying [Codefresh On-Premises](https://codefresh.io/docs/docs/getting-started/intro-to-codefresh/) to Kubernetes. diff --git a/codefresh/files/postgresSeedJobScript.sh b/codefresh/files/postgresSeedJobScript.sh index 442278a69..5f187c04b 100644 --- a/codefresh/files/postgresSeedJobScript.sh +++ b/codefresh/files/postgresSeedJobScript.sh @@ -37,7 +37,19 @@ function createUser() { } function grantPrivileges() { - psql -c "GRANT ALL ON DATABASE ${1} TO ${POSTGRES_USER}" + local db=$1 + echo "Granting privileges on $db to ${POSTGRES_USER}" + # Database-level privileges + psql -c "GRANT ALL ON DATABASE ${db} TO ${POSTGRES_USER}" + # Schema and object-level privileges + psql -d "${db}" -c "GRANT ALL ON SCHEMA public TO ${POSTGRES_USER}" + psql -d "${db}" -c "GRANT ALL ON ALL TABLES IN SCHEMA public TO ${POSTGRES_USER}" + psql -d "${db}" -c "GRANT ALL ON ALL SEQUENCES IN SCHEMA public TO ${POSTGRES_USER}" + psql -d "${db}" -c "GRANT ALL ON ALL FUNCTIONS IN SCHEMA public TO ${POSTGRES_USER}" + # Default privileges for future objects + psql -d "${db}" -c "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO ${POSTGRES_USER}" + psql -d "${db}" -c "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON SEQUENCES TO ${POSTGRES_USER}" + psql -d "${db}" -c "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON FUNCTIONS TO ${POSTGRES_USER}" } function runSeed() { From d2b3bce54e1fe1101113749417ca6adf5d4e1168 Mon Sep 17 00:00:00 2001 From: Mikhail Klimko Date: Fri, 6 Jun 2025 15:08:29 +0300 Subject: [PATCH 2/7] onprem: 2.8.2 --- codefresh/files/postgresSeedJobScript.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/codefresh/files/postgresSeedJobScript.sh b/codefresh/files/postgresSeedJobScript.sh index 5f187c04b..f24301bc6 100644 --- a/codefresh/files/postgresSeedJobScript.sh +++ b/codefresh/files/postgresSeedJobScript.sh @@ -28,7 +28,8 @@ POSTGRES_SEED_USER="${POSTGRES_SEED_USER:-$POSTGRES_USER}" POSTGRES_SEED_PASSWORD="${POSTGRES_SEED_PASSWORD:-$POSTGRES_PASSWORD}" function createDB() { - psql -tc "SELECT 1 FROM pg_database WHERE datname = '${1}'" | grep -q 1 || psql -c "CREATE DATABASE ${1}" + local db=$1 + psql -c "CREATE DATABASE ${1}" } function createUser() { From 5d058261dbbdf71a7a5e7f2c5e6bf0606cd17c91 Mon Sep 17 00:00:00 2001 From: Mikhail Klimko Date: Fri, 6 Jun 2025 15:25:18 +0300 Subject: [PATCH 3/7] onprem: 2.8.2 --- codefresh/Chart.yaml | 2 +- codefresh/files/postgresSeedJobScript.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/codefresh/Chart.yaml b/codefresh/Chart.yaml index d6534d482..6e66239a6 100644 --- a/codefresh/Chart.yaml +++ b/codefresh/Chart.yaml @@ -19,7 +19,7 @@ annotations: # supported kinds are added, changed, deprecated, removed, fixed and security. artifacthub.io/changes: | - kind: fixed - description: "Fix grantPrivileges function in seed job" + description: "Fix grantPrivileges function in postgres seed job" dependencies: - name: cf-common repository: oci://quay.io/codefresh/charts diff --git a/codefresh/files/postgresSeedJobScript.sh b/codefresh/files/postgresSeedJobScript.sh index f24301bc6..21826fdd6 100644 --- a/codefresh/files/postgresSeedJobScript.sh +++ b/codefresh/files/postgresSeedJobScript.sh @@ -29,7 +29,7 @@ POSTGRES_SEED_PASSWORD="${POSTGRES_SEED_PASSWORD:-$POSTGRES_PASSWORD}" function createDB() { local db=$1 - psql -c "CREATE DATABASE ${1}" + psql -c "CREATE DATABASE ${1} IF NOT EXISTS" } function createUser() { From 8cd75ebed2d230178b9ac3002b21722ff0392d25 Mon Sep 17 00:00:00 2001 From: Mikhail Klimko Date: Fri, 6 Jun 2025 15:44:25 +0300 Subject: [PATCH 4/7] onprem: 2.8.2 --- codefresh/files/postgresSeedJobScript.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codefresh/files/postgresSeedJobScript.sh b/codefresh/files/postgresSeedJobScript.sh index 21826fdd6..b4fd88986 100644 --- a/codefresh/files/postgresSeedJobScript.sh +++ b/codefresh/files/postgresSeedJobScript.sh @@ -29,7 +29,7 @@ POSTGRES_SEED_PASSWORD="${POSTGRES_SEED_PASSWORD:-$POSTGRES_PASSWORD}" function createDB() { local db=$1 - psql -c "CREATE DATABASE ${1} IF NOT EXISTS" + psql -c "CREATE DATABASE ${1}" 2>/dev/null || true } function createUser() { From 548799f7bd7b177a42a814743c1011e73045b7ea Mon Sep 17 00:00:00 2001 From: Mikhail Klimko Date: Fri, 6 Jun 2025 15:55:30 +0300 Subject: [PATCH 5/7] onprem: 2.8.2 --- codefresh/files/postgresSeedJobScript.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codefresh/files/postgresSeedJobScript.sh b/codefresh/files/postgresSeedJobScript.sh index b4fd88986..0a2abdd89 100644 --- a/codefresh/files/postgresSeedJobScript.sh +++ b/codefresh/files/postgresSeedJobScript.sh @@ -29,7 +29,7 @@ POSTGRES_SEED_PASSWORD="${POSTGRES_SEED_PASSWORD:-$POSTGRES_PASSWORD}" function createDB() { local db=$1 - psql -c "CREATE DATABASE ${1}" 2>/dev/null || true + psql -c "CREATE DATABASE ${1}" 2>&1 || true } function createUser() { From 26d631fba59f31d80335525818a52027f6c0bd72 Mon Sep 17 00:00:00 2001 From: Mikhail Klimko Date: Fri, 6 Jun 2025 16:04:51 +0300 Subject: [PATCH 6/7] onprem: 2.8.2 --- codefresh/files/postgresSeedJobScript.sh | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/codefresh/files/postgresSeedJobScript.sh b/codefresh/files/postgresSeedJobScript.sh index 0a2abdd89..fa4950606 100644 --- a/codefresh/files/postgresSeedJobScript.sh +++ b/codefresh/files/postgresSeedJobScript.sh @@ -29,7 +29,8 @@ POSTGRES_SEED_PASSWORD="${POSTGRES_SEED_PASSWORD:-$POSTGRES_PASSWORD}" function createDB() { local db=$1 - psql -c "CREATE DATABASE ${1}" 2>&1 || true + echo "Creating ${db} database" + psql -c "CREATE DATABASE ${db}" 2>&1 || true } function createUser() { @@ -40,17 +41,7 @@ function createUser() { function grantPrivileges() { local db=$1 echo "Granting privileges on $db to ${POSTGRES_USER}" - # Database-level privileges psql -c "GRANT ALL ON DATABASE ${db} TO ${POSTGRES_USER}" - # Schema and object-level privileges - psql -d "${db}" -c "GRANT ALL ON SCHEMA public TO ${POSTGRES_USER}" - psql -d "${db}" -c "GRANT ALL ON ALL TABLES IN SCHEMA public TO ${POSTGRES_USER}" - psql -d "${db}" -c "GRANT ALL ON ALL SEQUENCES IN SCHEMA public TO ${POSTGRES_USER}" - psql -d "${db}" -c "GRANT ALL ON ALL FUNCTIONS IN SCHEMA public TO ${POSTGRES_USER}" - # Default privileges for future objects - psql -d "${db}" -c "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO ${POSTGRES_USER}" - psql -d "${db}" -c "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON SEQUENCES TO ${POSTGRES_USER}" - psql -d "${db}" -c "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON FUNCTIONS TO ${POSTGRES_USER}" } function runSeed() { From c7dd7a339568817b7808a1dd4ae91f4ca5f4e976 Mon Sep 17 00:00:00 2001 From: Mikhail Klimko Date: Fri, 6 Jun 2025 16:10:51 +0300 Subject: [PATCH 7/7] onprem: 2.8.2 --- codefresh/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codefresh/Chart.yaml b/codefresh/Chart.yaml index 6e66239a6..939102a5f 100644 --- a/codefresh/Chart.yaml +++ b/codefresh/Chart.yaml @@ -19,7 +19,7 @@ annotations: # supported kinds are added, changed, deprecated, removed, fixed and security. artifacthub.io/changes: | - kind: fixed - description: "Fix grantPrivileges function in postgres seed job" + description: "Fix createDB function in postgres seed job" dependencies: - name: cf-common repository: oci://quay.io/codefresh/charts