Skip to content
Merged
1 change: 1 addition & 0 deletions .github/workflows/nightly-upgrade-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,5 @@ jobs:
TO_OPERATOR_MANIFEST: ${{ env.TO_OPERATOR_MANIFEST }}
OPERATOR_MANIFEST: ${{ env.TO_OPERATOR_MANIFEST }}
IMG: ${{ env.TO_OPERATOR_IMAGE }}
BACKSTAGE_OPERATOR_TESTS_POSTGRESQL_UPGRADE: ${{ matrix.to_branch == 'main' }}
run: make test-e2e-upgrade
119 changes: 119 additions & 0 deletions .github/workflows/pr-postgresql-upgrade-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: PR PostgreSQL Upgrade Test

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- 'main'
paths:
- '.github/workflows/pr-postgresql-upgrade-test.yaml'
- '.github/workflows/nightly-upgrade-test.yaml'
- '**/*.go'
- 'config/**'
- 'dist/rhdh/install.yaml'
- 'Dockerfile'
- 'go.mod'
- 'go.sum'
- 'Makefile'

concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}
cancel-in-progress: true

jobs:
postgresql-upgrade:
name: E2E PostgreSQL 15 to 18
runs-on: ubuntu-latest
timeout-minutes: 90
permissions:
contents: read
env:
CONTAINER_ENGINE: docker
FROM_OPERATOR_MANIFEST: https://raw.githubusercontent.com/redhat-developer/rhdh-operator/refs/heads/release-1.10/dist/rhdh/install.yaml
TO_OPERATOR_MANIFEST: ${{ github.workspace }}/dist/rhdh/install.yaml

steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version-file: 'go.mod'

- name: Resolve source operator image
run: |
FROM_OPERATOR_IMAGE=$(curl -fsSL "$FROM_OPERATOR_MANIFEST" | yq 'select(.kind == "Deployment" and .metadata.labels.app == "rhdh-operator") | .spec.template.spec.containers[0].image')

Check warning on line 49 in .github/workflows/pr-postgresql-upgrade-test.yaml

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Not enforcing HTTPS here might allow for redirections to insecure websites. Make sure it is safe here.

See more on https://sonarcloud.io/project/issues?id=redhat-developer_rhdh-operator&issues=AaCzjqBmAiSrZ4WoqzYb&open=AaCzjqBmAiSrZ4WoqzYb&pullRequest=3569
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
test -n "$FROM_OPERATOR_IMAGE"
skopeo inspect "docker://$FROM_OPERATOR_IMAGE" > /dev/null
echo "FROM_OPERATOR_IMAGE=$FROM_OPERATOR_IMAGE" >> "$GITHUB_ENV"

- name: Remove unnecessary files to free up disk space
uses: endersonmenezes/free-disk-space@2a22f8c59cae9cddae7194b33e6b92d023b2b4b8 # v4
with:
remove_android: true
remove_dotnet: true
remove_haskell: true
rm_cmd: "rmz"

- name: Build target operator image and manifest
env:
TO_OPERATOR_IMAGE: localhost/rhdh-operator:pr-${{ github.event.pull_request.head.sha }}
run: |
make image-build build-installer PROFILE=rhdh IMG="$TO_OPERATOR_IMAGE"
MANIFEST_IMAGE=$(yq 'select(.kind == "Deployment" and .metadata.labels.app == "rhdh-operator") | .spec.template.spec.containers[0].image' "$TO_OPERATOR_MANIFEST")
test "$MANIFEST_IMAGE" = "$TO_OPERATOR_IMAGE"
echo "TO_OPERATOR_IMAGE=$TO_OPERATOR_IMAGE" >> "$GITHUB_ENV"

- name: Generate Kind config
run: |
cat <<EOF > "$RUNNER_TEMP/kind-config.yaml"
apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
nodes:
- role: control-plane
extraPortMappings:
- containerPort: 80
hostPort: 80
protocol: TCP
- containerPort: 443
hostPort: 443
protocol: TCP
kubeadmConfigPatches:
- |
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
imageGCHighThresholdPercent: 70
imageGCLowThresholdPercent: 50
imageMinimumGCAge: 2m
EOF

- name: Create Kind cluster
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0
with:
cluster_name: test-cluster
config: ${{ runner.temp }}/kind-config.yaml
ignore_failed_clean: true

- name: Load target operator image
run: kind load docker-image --name test-cluster "$TO_OPERATOR_IMAGE"

- name: Install Ingress Controller
run: |
kubectl apply -f https://kind.sigs.k8s.io/examples/ingress/deploy-ingress-nginx.yaml
kubectl wait --namespace ingress-nginx \
--for=condition=ready pod \
--selector=app.kubernetes.io/component=controller \
--timeout=90s

- name: Run PostgreSQL upgrade E2E test
env:
BACKSTAGE_OPERATOR_TESTS_PLATFORM: kind
BACKSTAGE_OPERATOR_TESTS_POSTGRESQL_UPGRADE: 'true'
PROFILE: 'rhdh'
OPERATOR_MANIFEST: ${{ env.TO_OPERATOR_MANIFEST }}
IMG: ${{ env.TO_OPERATOR_IMAGE }}
run: make test-e2e-upgrade
4 changes: 2 additions & 2 deletions .rhdh/scripts/prepare-restricted-environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1481,8 +1481,8 @@ EOF
spec:
imageDigestMirrors:
- mirrors:
- ${registry_url_internal}/rhel9/postgresql-15
source: registry.redhat.io/rhel9/postgresql-15
- ${registry_url_internal}/rhel10/postgresql-18
source: registry.redhat.io/rhel10/postgresql-18
- mirrors:
- ${registry_url_internal}/rhdh
source: registry.redhat.io/rhdh
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions bundle/rhdh/manifests/rhdh-default-config_v1_configmap.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bundle/rhdh/manifests/rhdh-plugin-deps_v1_configmap.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ spec:
value: /var/lib/pgsql/data
- name: PGDATA
value: /var/lib/pgsql/data/userdata
image: quay.io/fedora/postgresql-15:latest # will be replaced with the actual image
image: quay.io/fedora/postgresql-18:latest # will be replaced with the actual image
imagePullPolicy: IfNotPresent
securityContext:
# runAsUser:26 does not work for Openshift but looks work for AKS/EKS
Expand Down Expand Up @@ -108,4 +108,4 @@ spec:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storage: 1Gi
4 changes: 2 additions & 2 deletions config/profile/rhdh/default-config/db-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ spec:
value: /var/lib/pgsql/data
- name: PGDATA
value: /var/lib/pgsql/data/userdata
image: quay.io/fedora/postgresql-15:latest # will be replaced with the actual image
image: quay.io/fedora/postgresql-18:latest # will be replaced with the actual image
Comment thread
rm3l marked this conversation as resolved.
Resolved
imagePullPolicy: IfNotPresent
securityContext:
# runAsUser:26 does not work for Openshift but looks work for AKS/EKS
Expand Down Expand Up @@ -108,4 +108,4 @@ spec:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storage: 1Gi
2 changes: 1 addition & 1 deletion config/profile/rhdh/patches/deployment-patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
- name: OPERATOR_DP_PROCESSING
value: "{{OPERATOR_DP_PROCESSING}}"
- name: RELATED_IMAGE_postgresql
value: quay.io/fedora/postgresql-15:latest
value: quay.io/fedora/postgresql-18:latest
- name: RELATED_IMAGE_backstage
value: quay.io/rhdh-community/rhdh:next
- name: RELATED_IMAGE_plugin_installer
Expand Down
2 changes: 1 addition & 1 deletion config/profile/rhdh/plugin-deps/sonataflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
spec:
containers:
- name: psql
image: quay.io/fedora/postgresql-15:latest
image: quay.io/fedora/postgresql-18:latest
resources:
limits:
cpu: "100m"
Expand Down
4 changes: 2 additions & 2 deletions dist/backstage.io/install.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions dist/rhdh/install.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/model/db-statefulset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package model

import (
"context"
"os"
"testing"

"github.com/redhat-developer/rhdh-operator/pkg/platform"
Expand Down Expand Up @@ -41,6 +40,7 @@ func TestDefault(t *testing.T) {
dbStatefulSet := model.GetRuntimeObject(DbStatefulSetKey).(*DbStatefulSet)
assert.Equal(t, dbService.service.Name, dbStatefulSet.statefulSet.Spec.ServiceName)
assert.Equal(t, corev1.ClusterIPNone, dbService.service.Spec.ClusterIP)
assert.Equal(t, "quay.io/fedora/postgresql-18:latest", dbStatefulSet.statefulSet.Spec.Template.Spec.Containers[0].Image)
}

// It tests the overriding image feature
Expand All @@ -52,7 +52,7 @@ func TestOverrideDbImage(t *testing.T) {
testObj := createBackstageTest(bs).withDefaultConfig(true).
addToDefaultConfig("db-statefulset.yaml", "rhdh-db-statefulset.yaml").withLocalDb(true)

_ = os.Setenv(LocalDbImageEnvVar, "dummy")
t.Setenv(LocalDbImageEnvVar, "dummy")

model, err := InitObjects(context.TODO(), bs, testObj.externalConfig, platform.Default, testObj.scheme)
assert.NoError(t, err)
Expand Down
4 changes: 2 additions & 2 deletions pkg/model/testdata/default-config/db-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
value: /var/lib/pgsql/data
- name: PGDATA
value: /var/lib/pgsql/data/userdata
image: quay.io/fedora/postgresql-15:latest
image: quay.io/fedora/postgresql-18:latest
imagePullPolicy: IfNotPresent
securityContext:
runAsNonRoot: true
Expand Down Expand Up @@ -98,4 +98,4 @@ spec:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storage: 1Gi
3 changes: 1 addition & 2 deletions pkg/model/testdata/ips-db-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ spec:
- name: ips-db2
automountServiceAccountToken: false
containers:
- image: quay.io/fedora/postgresql-15:latest
- image: quay.io/fedora/postgresql-18:latest
name: postgres

4 changes: 2 additions & 2 deletions pkg/model/testdata/rhdh-db-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
value: /var/lib/pgsql/data
- name: PGDATA
value: /var/lib/pgsql/data/userdata
image: quay.io/fedora/postgresql-15:latest # will be replaced with the actual image
image: quay.io/fedora/postgresql-18:latest # will be replaced with the actual image
imagePullPolicy: IfNotPresent
securityContext:
runAsNonRoot: true
Expand Down Expand Up @@ -95,4 +95,4 @@ spec:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storage: 1Gi
Loading
Loading