Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion ci/dockerfiles/main-postgres/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ RUN echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg m
"postgresql-${DB_VERSION}" \
"postgresql-client-${DB_VERSION}"

RUN sed -i 's/port = 5433/port = 5432/g' "/etc/postgresql/${DB_VERSION}/main/postgresql.conf"
RUN config="/etc/postgresql/${DB_VERSION}/main/postgresql.conf"; \
if [ -f "$config" ]; then \
sed -i 's/port = 5433/port = 5432/g' "$config"; \
fi
174 changes: 160 additions & 14 deletions ci/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ groups:
- unit-release
- unit-director-sqlite
- unit-director-mysql-8
- unit-director-postgres-13
- unit-director-postgres-17
- unit-director-postgres-15
- run-bundle-audit
- integration-postgres
Expand All @@ -25,6 +25,10 @@ groups:
- bats-fips
- bats-fips-cleanup-leftovers
- brats-acceptance
- brats-postgres-15
- brats-postgres-16
- brats-postgres-17
- brats-postgres-18
Comment thread
coderabbitai[bot] marked this conversation as resolved.
- brats-utils
- brats-performance
- bosh-disaster-recovery-acceptance-tests
Expand All @@ -44,7 +48,7 @@ groups:

- name: container-images
jobs:
- build-main-postgres-13
- build-main-postgres-17
- build-main-postgres-15
- build-main-mysql-8-0
- build-integration
Expand All @@ -67,7 +71,7 @@ jobs:
- unit-release
- unit-director-sqlite
- unit-director-mysql-8
- unit-director-postgres-13
- unit-director-postgres-17
- unit-director-postgres-15
- run-bundle-audit
plan:
Expand Down Expand Up @@ -202,10 +206,10 @@ jobs:
DB: mysql
RAKE_TASK: spec:unit:director

- name: unit-director-postgres-13
- name: unit-director-postgres-17
public: true
serial: true
serial_groups: [ unit-director-postgres-13 ]
serial_groups: [ unit-director-postgres-17 ]
Comment thread
coderabbitai[bot] marked this conversation as resolved.
build_log_retention:
builds: 250
plan:
Expand All @@ -214,16 +218,17 @@ jobs:
- get: bosh
passed: [ gate ]
trigger: true
- get: integration-postgres-13-image
- get: integration-postgres-17-image
- task: test-rake-task
file: bosh-ci/ci/tasks/test-rake-task.yml
image: integration-postgres-13-image
image: integration-postgres-17-image
timeout: 2h
privileged: true
params:
COVERAGE: false
DB: postgresql
RAKE_TASK: spec:unit:director
PG_VERSION: "17"

- name: unit-director-postgres-15
public: true
Expand All @@ -247,6 +252,7 @@ jobs:
COVERAGE: false
DB: postgresql
RAKE_TASK: spec:unit:director
PG_VERSION: "15"

- name: run-bundle-audit
public: true
Expand Down Expand Up @@ -311,8 +317,9 @@ jobs:
params:
COVERAGE: false
DB: postgresql
PG_VERSION: "15"
RAKE_TASK: spec:integration
PARALLEL_TEST_MULTIPLY_PROCESSES: "0.5"
PARALLEL_TEST_MULTIPLY_PROCESSES: &parallel_test_multiplier "0.6"

- name: integration-postgres-hotswap
public: true
Expand Down Expand Up @@ -340,8 +347,10 @@ jobs:
privileged: true
params:
DB: postgresql
PG_VERSION: "15"
RAKE_TASK: spec:integration
UPDATE_VM_STRATEGY: create-swap-delete
PARALLEL_TEST_MULTIPLY_PROCESSES: *parallel_test_multiplier

- name: integration-mysql
public: true
Expand Down Expand Up @@ -371,6 +380,7 @@ jobs:
COVERAGE: false
DB: mysql
RAKE_TASK: spec:integration
PARALLEL_TEST_MULTIPLY_PROCESSES: *parallel_test_multiplier

- name: candidate-release
plan:
Expand All @@ -385,7 +395,7 @@ jobs:
- unit-release
- unit-director-sqlite
- unit-director-mysql-8
- unit-director-postgres-13
- unit-director-postgres-17
- unit-director-postgres-15
- integration-mysql
- integration-postgres
Expand Down Expand Up @@ -674,6 +684,138 @@ jobs:
vars: *brats-terraform-vars
action: destroy

- name: brats-postgres-15
serial: true
plan:
- in_parallel:
- get: bosh-ci
- get: integration-image
- get: bosh
passed: [ create-bosh-candidate-release-compiled ]
- get: bosh-dns-release
- get: stemcell
resource: warden-stemcell
- get: director-stemcell
resource: warden-stemcell
- get: bosh-candidate-release-tarballs
passed: [ create-bosh-candidate-release-compiled ]
- get: bosh-release
resource: bosh-candidate-release-tarballs
passed: [ create-bosh-candidate-release-compiled ]
- get: bosh-candidate-release-compiled
trigger: true
passed: [ create-bosh-candidate-release-compiled ]
- get: bosh-deployment
- get: docker-cpi-image
- task: test-brats-postgres-15
file: bosh-ci/ci/shared/brats/test-acceptance.yml
image: docker-cpi-image
privileged: true
params:
STEMCELL_OS: ubuntu-noble
DIRECTOR_STEMCELL_OS: ubuntu-noble
PG_VERSION: "15"
BRATS_FOCUS_REGEXP: "postgres-release"

- name: brats-postgres-16
serial: true
plan:
- in_parallel:
- get: bosh-ci
- get: integration-image
- get: bosh
passed: [ create-bosh-candidate-release-compiled ]
- get: bosh-dns-release
- get: stemcell
resource: warden-stemcell
- get: director-stemcell
resource: warden-stemcell
- get: bosh-candidate-release-tarballs
passed: [ create-bosh-candidate-release-compiled ]
- get: bosh-release
resource: bosh-candidate-release-tarballs
passed: [ create-bosh-candidate-release-compiled ]
- get: bosh-candidate-release-compiled
trigger: true
passed: [ create-bosh-candidate-release-compiled ]
- get: bosh-deployment
- get: docker-cpi-image
- task: test-brats-postgres-16
file: bosh-ci/ci/shared/brats/test-acceptance.yml
image: docker-cpi-image
privileged: true
params:
STEMCELL_OS: ubuntu-noble
DIRECTOR_STEMCELL_OS: ubuntu-noble
PG_VERSION: "16"
BRATS_FOCUS_REGEXP: "postgres-release"

- name: brats-postgres-17
serial: true
plan:
- in_parallel:
- get: bosh-ci
- get: integration-image
- get: bosh
passed: [ create-bosh-candidate-release-compiled ]
- get: bosh-dns-release
- get: stemcell
resource: warden-stemcell
- get: director-stemcell
resource: warden-stemcell
- get: bosh-candidate-release-tarballs
passed: [ create-bosh-candidate-release-compiled ]
- get: bosh-release
resource: bosh-candidate-release-tarballs
passed: [ create-bosh-candidate-release-compiled ]
- get: bosh-candidate-release-compiled
trigger: true
passed: [ create-bosh-candidate-release-compiled ]
- get: bosh-deployment
- get: docker-cpi-image
- task: test-brats-postgres-17
file: bosh-ci/ci/shared/brats/test-acceptance.yml
image: docker-cpi-image
privileged: true
params:
STEMCELL_OS: ubuntu-noble
DIRECTOR_STEMCELL_OS: ubuntu-noble
PG_VERSION: "17"
BRATS_FOCUS_REGEXP: "postgres-release"

- name: brats-postgres-18
serial: true
plan:
- in_parallel:
- get: bosh-ci
- get: integration-image
- get: bosh
passed: [ create-bosh-candidate-release-compiled ]
- get: bosh-dns-release
- get: stemcell
resource: warden-stemcell
- get: director-stemcell
resource: warden-stemcell
- get: bosh-candidate-release-tarballs
passed: [ create-bosh-candidate-release-compiled ]
- get: bosh-release
resource: bosh-candidate-release-tarballs
passed: [ create-bosh-candidate-release-compiled ]
- get: bosh-candidate-release-compiled
trigger: true
passed: [ create-bosh-candidate-release-compiled ]
- get: bosh-deployment
- get: docker-cpi-image
- task: test-brats-postgres-18
file: bosh-ci/ci/shared/brats/test-acceptance.yml
image: docker-cpi-image
privileged: true
params:
STEMCELL_OS: ubuntu-noble
DIRECTOR_STEMCELL_OS: ubuntu-noble
PG_VERSION: "18"
BRATS_FOCUS_REGEXP: "postgres-release"

- name: brats-performance
serial: true
plan:
Expand Down Expand Up @@ -954,6 +1096,10 @@ jobs:
passed:
- bats
- brats-acceptance
- brats-postgres-15
- brats-postgres-16
- brats-postgres-17
- brats-postgres-18
- bosh-disaster-recovery-acceptance-tests
- upgrade-postgres
- upgrade-mysql
Expand Down Expand Up @@ -1176,7 +1322,7 @@ jobs:
params:
image: image/image.tar

- name: build-main-postgres-13
- name: build-main-postgres-17
public: true
serial: true
plan:
Expand All @@ -1200,11 +1346,11 @@ jobs:
- name: image
params:
CONTEXT: bosh-ci-dockerfiles/ci/dockerfiles/main-postgres
BUILD_ARG_DB_VERSION: "13"
BUILD_ARG_DB_VERSION: "17"
IMAGE_ARG_BASE_IMAGE: integration-image/image.tar
run:
path: build
- put: integration-postgres-13-image
- put: integration-postgres-17-image
no_get: true
params:
image: image/image.tar
Expand Down Expand Up @@ -1959,10 +2105,10 @@ resources:
username: ((github_read_write_packages.username))
password: ((github_read_write_packages.password))

- name: integration-postgres-13-image
- name: integration-postgres-17-image
type: registry-image
source:
repository: ghcr.io/cloudfoundry/bosh/main-postgres-13
repository: ghcr.io/cloudfoundry/bosh/main-postgres-17
tag: *branch_name
username: ((github_read_write_packages.username))
password: ((github_read_write_packages.password))
Expand Down
79 changes: 79 additions & 0 deletions src/brats/acceptance/postgres_release_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package acceptance_test

import (
"fmt"
"os"
"strconv"
"time"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"

"brats/utils"
)

var _ = Describe("postgres-release version matrix", func() {
const deployTimeout = 20 * time.Minute

manifest := utils.AssetPath("postgres-release-manifest.yml")

type pgEntry struct {
version int
previous int
}

pgVersionFilter := func() int {
v := os.Getenv("PG_VERSION")
if v == "" {
return 0
}
n, _ := strconv.Atoi(v)
return n
}()

DescribeTable("PostgreSQL version",
func(e pgEntry) {
if pgVersionFilter != 0 && e.version != pgVersionFilter {
Skip(fmt.Sprintf("PG_VERSION=%d; skipping version %d", pgVersionFilter, e.version))
}
deploymentName := fmt.Sprintf("postgres-release-%d-%x", e.version, GinkgoT().RandomSeed())

By(fmt.Sprintf("deploying postgres-release at version %d", e.version))
session := utils.OuterBosh("deploy", "-n", manifest,
"-d", deploymentName,
"-v", fmt.Sprintf("stemcell-os=%s", utils.StemcellOS()),
"-v", fmt.Sprintf("deployment-name=%s", deploymentName),
"-v", fmt.Sprintf("pg-version=%d", e.version),
)
Eventually(session, deployTimeout).Should(gexec.Exit(0))

if e.previous > 0 {
By(fmt.Sprintf("upgrading from postgres-release version %d to %d", e.previous, e.version))
previousDeploymentName := fmt.Sprintf("postgres-release-%d-to-%d-%x", e.previous, e.version, GinkgoT().RandomSeed())

By(fmt.Sprintf("deploying at version %d first", e.previous))
session = utils.OuterBosh("deploy", "-n", manifest,
"-d", previousDeploymentName,
"-v", fmt.Sprintf("stemcell-os=%s", utils.StemcellOS()),
"-v", fmt.Sprintf("deployment-name=%s", previousDeploymentName),
"-v", fmt.Sprintf("pg-version=%d", e.previous),
)
Eventually(session, deployTimeout).Should(gexec.Exit(0))

By(fmt.Sprintf("upgrading to version %d", e.version))
session = utils.OuterBosh("deploy", "-n", manifest,
"-d", previousDeploymentName,
"-v", fmt.Sprintf("stemcell-os=%s", utils.StemcellOS()),
"-v", fmt.Sprintf("deployment-name=%s", previousDeploymentName),
"-v", fmt.Sprintf("pg-version=%d", e.version),
)
Eventually(session, deployTimeout).Should(gexec.Exit(0))
}
},
Entry("deploys version 15", pgEntry{version: 15}),
Entry("upgrades 15 -> 16", pgEntry{version: 16, previous: 15}),
Entry("upgrades 16 -> 17", pgEntry{version: 17, previous: 16}),
Entry("upgrades 17 -> 18", pgEntry{version: 18, previous: 17}),
Comment thread
coderabbitai[bot] marked this conversation as resolved.
)
})
Loading