|
| 1 | +name: Nightly PostgreSQL Upgrade Test |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + schedule: |
| 6 | + - cron: "25 0 * * *" |
| 7 | + |
| 8 | +jobs: |
| 9 | + postgresql-upgrade: |
| 10 | + name: E2E PostgreSQL ${{ matrix.from_branch }} to ${{ matrix.to_branch }} |
| 11 | + concurrency: |
| 12 | + group: ${{ github.workflow }}-${{ matrix.from_branch }}-${{ matrix.to_branch }} |
| 13 | + cancel-in-progress: true |
| 14 | + runs-on: ubuntu-latest |
| 15 | + timeout-minutes: 90 |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + matrix: |
| 19 | + include: |
| 20 | + - from_branch: release-1.10 |
| 21 | + to_branch: main |
| 22 | + permissions: |
| 23 | + contents: read |
| 24 | + env: |
| 25 | + CONTAINER_ENGINE: docker |
| 26 | + FROM_OPERATOR_MANIFEST: https://raw.githubusercontent.com/${{ github.repository }}/refs/heads/${{ matrix.from_branch }}/dist/rhdh/install.yaml |
| 27 | + TO_OPERATOR_MANIFEST: ${{ github.workspace }}/dist/rhdh/install.yaml |
| 28 | + |
| 29 | + steps: |
| 30 | + - name: Checkout |
| 31 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 32 | + with: |
| 33 | + ref: ${{ matrix.to_branch }} |
| 34 | + fetch-depth: 0 |
| 35 | + persist-credentials: false |
| 36 | + |
| 37 | + - name: Setup Go |
| 38 | + uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7 |
| 39 | + with: |
| 40 | + go-version-file: 'go.mod' |
| 41 | + |
| 42 | + - name: Resolve source operator image |
| 43 | + run: | |
| 44 | + FROM_OPERATOR_IMAGE=$(curl --proto '=https' --proto-redir '=https' -fsSL "$FROM_OPERATOR_MANIFEST" | yq 'select(.kind == "Deployment" and .metadata.labels.app == "rhdh-operator") | .spec.template.spec.containers[0].image') |
| 45 | + test -n "$FROM_OPERATOR_IMAGE" |
| 46 | + skopeo inspect "docker://$FROM_OPERATOR_IMAGE" > /dev/null |
| 47 | + echo "FROM_OPERATOR_IMAGE=$FROM_OPERATOR_IMAGE" >> "$GITHUB_ENV" |
| 48 | +
|
| 49 | + - name: Remove unnecessary files to free up disk space |
| 50 | + uses: endersonmenezes/free-disk-space@2a22f8c59cae9cddae7194b33e6b92d023b2b4b8 # v4 |
| 51 | + with: |
| 52 | + remove_android: true |
| 53 | + remove_dotnet: true |
| 54 | + remove_haskell: true |
| 55 | + rm_cmd: "rmz" |
| 56 | + |
| 57 | + - name: Build target operator image and manifest |
| 58 | + env: |
| 59 | + TO_OPERATOR_IMAGE: localhost/rhdh-operator:nightly-${{ matrix.from_branch }}-to-${{ matrix.to_branch }}-${{ github.run_id }} |
| 60 | + run: | |
| 61 | + make image-build build-installer PROFILE=rhdh IMG="$TO_OPERATOR_IMAGE" |
| 62 | + MANIFEST_IMAGE=$(yq 'select(.kind == "Deployment" and .metadata.labels.app == "rhdh-operator") | .spec.template.spec.containers[0].image' "$TO_OPERATOR_MANIFEST") |
| 63 | + test "$MANIFEST_IMAGE" = "$TO_OPERATOR_IMAGE" |
| 64 | + echo "TO_OPERATOR_IMAGE=$TO_OPERATOR_IMAGE" >> "$GITHUB_ENV" |
| 65 | +
|
| 66 | + - name: Generate Kind config |
| 67 | + run: | |
| 68 | + cat <<EOF > "$RUNNER_TEMP/kind-config.yaml" |
| 69 | + apiVersion: kind.x-k8s.io/v1alpha4 |
| 70 | + kind: Cluster |
| 71 | + nodes: |
| 72 | + - role: control-plane |
| 73 | + extraPortMappings: |
| 74 | + - containerPort: 80 |
| 75 | + hostPort: 80 |
| 76 | + protocol: TCP |
| 77 | + - containerPort: 443 |
| 78 | + hostPort: 443 |
| 79 | + protocol: TCP |
| 80 | + kubeadmConfigPatches: |
| 81 | + - | |
| 82 | + apiVersion: kubelet.config.k8s.io/v1beta1 |
| 83 | + kind: KubeletConfiguration |
| 84 | + imageGCHighThresholdPercent: 70 |
| 85 | + imageGCLowThresholdPercent: 50 |
| 86 | + imageMinimumGCAge: 2m |
| 87 | + EOF |
| 88 | +
|
| 89 | + - name: Create Kind cluster |
| 90 | + uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0 |
| 91 | + with: |
| 92 | + cluster_name: test-cluster |
| 93 | + config: ${{ runner.temp }}/kind-config.yaml |
| 94 | + ignore_failed_clean: true |
| 95 | + |
| 96 | + - name: Load target operator image |
| 97 | + run: kind load docker-image --name test-cluster "$TO_OPERATOR_IMAGE" |
| 98 | + |
| 99 | + - name: Install Ingress Controller |
| 100 | + run: | |
| 101 | + kubectl apply -f https://kind.sigs.k8s.io/examples/ingress/deploy-ingress-nginx.yaml |
| 102 | + kubectl wait --namespace ingress-nginx \ |
| 103 | + --for=condition=ready pod \ |
| 104 | + --selector=app.kubernetes.io/component=controller \ |
| 105 | + --timeout=90s |
| 106 | +
|
| 107 | + - name: Run PostgreSQL upgrade E2E test |
| 108 | + env: |
| 109 | + BACKSTAGE_OPERATOR_TESTS_PLATFORM: kind |
| 110 | + BACKSTAGE_OPERATOR_TESTS_POSTGRESQL_UPGRADE: 'true' |
| 111 | + PROFILE: 'rhdh' |
| 112 | + OPERATOR_MANIFEST: ${{ env.TO_OPERATOR_MANIFEST }} |
| 113 | + IMG: ${{ env.TO_OPERATOR_IMAGE }} |
| 114 | + run: make test-e2e-upgrade |
0 commit comments