Skip to content

Commit a255030

Browse files
committed
fixing test case
1 parent 987f7e3 commit a255030

File tree

5 files changed

+49
-284
lines changed

5 files changed

+49
-284
lines changed

.github/workflows/crc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on:
1616
- 'src/main/charts/confluence/**'
1717
- 'src/main/charts/jira/**'
1818
- 'src/main/charts/crowd/**'
19-
pull_request:
19+
pull_request_target:
2020
types: [ labeled ]
2121

2222
jobs:

.github/workflows/e2e-tf-deployment.yaml

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@ on:
55
push:
66
branches:
77
- main
8-
- fix/microshift_tests
98
paths:
109
- 'src/main/charts/bamboo/**'
1110
- 'src/main/charts/bamboo-agent/**'
1211
- 'src/main/charts/bitbucket/**'
1312
- 'src/main/charts/confluence/**'
1413
- 'src/main/charts/jira/**'
1514
- 'src/main/charts/crowd/**'
16-
pull_request:
15+
pull_request_target:
1716
types: [ labeled ]
1817
workflow_dispatch:
1918

@@ -27,7 +26,6 @@ jobs:
2726
contents: read
2827
env:
2928
AWS_DEFAULT_REGION: us-east-1
30-
TF_REPO_REF: fix/crowd-db-restore
3129
TF_VAR_bamboo_license: ${{ secrets.TF_VAR_BAMBOO_LICENSE }}
3230
TF_VAR_confluence_license: ${{ secrets.TF_VAR_CONFLUENCE_LICENSE }}
3331
TF_VAR_bitbucket_license: ${{ secrets.TF_VAR_BITBUCKET_LICENSE }}
@@ -48,7 +46,7 @@ jobs:
4846
uses: actions/checkout@v4
4947
with:
5048
fetch-depth: 0
51-
ref: ${{ github.event.pull_request.head.sha || github.ref_name }}
49+
ref: ${{ github.event.pull_request.head.sha }}
5250

5351
- name: Install the latest Terraform
5452
run: |
@@ -84,20 +82,11 @@ jobs:
8482
- name: Checkout Deployment Automation
8583
run: |
8684
DEPLOYMENT_REPO='https://github.com/atlassian-labs/data-center-terraform.git'
87-
echo "TF_REPO_REF env: '${TF_REPO_REF}'"
88-
if [ -n "${TF_REPO_REF}" ]; then
89-
echo "Using override ref('${TF_REPO_REF}') of Deployment Automation repo."
90-
git clone -b "${TF_REPO_REF}" "$DEPLOYMENT_REPO" tf
91-
else
92-
LTS=$(git ls-remote --tags --exit-code --refs "$DEPLOYMENT_REPO" \
93-
| sed -E 's/^[[:xdigit:]]+[[:space:]]+refs\/tags\/(.+)/\1/g' \
94-
| grep '^[0-9]*\.[0-9]*\.[0-9]*$' | sort -V | tail -1)
95-
echo "Using LTS version('${LTS}') of Deployment Automation to provision the infrastructure for Atlassian DC Products."
96-
git clone -b "$LTS" "$DEPLOYMENT_REPO" tf
97-
fi
98-
echo "TF repo branch: $(git -C tf rev-parse --abbrev-ref HEAD)"
99-
echo "TF repo remote: $(git -C tf remote get-url origin)"
100-
echo "TF repo latest: $(git -C tf log -1 --pretty='%h %s')"
85+
LTS=$(git ls-remote --tags --exit-code --refs "$DEPLOYMENT_REPO" \
86+
| sed -E 's/^[[:xdigit:]]+[[:space:]]+refs\/tags\/(.+)/\1/g' \
87+
| grep '^[0-9]*.[0-9]*.[0-9]*$' | sort -V | tail -1)
88+
echo "Using LTS version('${LTS}') of Deployment Automation to provision the infrastructure for Atlassian DC Products."
89+
git clone -b $LTS $DEPLOYMENT_REPO tf
10190
10291
- name: Setup test environment
10392
uses: actions/setup-go@v3

.github/workflows/openshift.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ jobs:
3333
uses: actions/checkout@v4
3434
with:
3535
fetch-depth: 0
36-
ref: ${{ github.event.pull_request.head.sha || github.ref_name }}
3736

3837
- name: Write pull secret file
3938
run: |

src/test/scripts/kind/deploy_app.sh

Lines changed: 41 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,49 @@ deploy_postgres() {
1313
if ! kubectl get crd clusters.postgresql.cnpg.io >/dev/null 2>&1; then
1414
echo "[INFO]: CloudNativePG operator not found, installing..."
1515

16-
# Create namespace first to ensure it exists
17-
kubectl create namespace cnpg-system --dry-run=client -o yaml | kubectl apply -f -
18-
19-
# Use helm template + kubectl apply to completely avoid Helm client timeouts
20-
# This is the most reliable method for slow/busy clusters (e2e, MicroShift)
21-
echo "[INFO]: Rendering operator manifests from Helm chart..."
22-
helm template cnpg-operator cloudnative-pg/cloudnative-pg \
16+
# Try installing with wait first
17+
if ! helm install cnpg-operator cloudnative-pg/cloudnative-pg \
2318
--values src/test/infrastructure/cloudnativepg/operator-values.yaml \
2419
--namespace cnpg-system \
25-
--include-crds > /tmp/cnpg-operator-manifests.yaml
26-
27-
echo "[INFO]: Applying operator manifests to cluster..."
28-
# Apply with server-side apply to handle large CRD annotations
29-
if ! kubectl apply --server-side=true -f /tmp/cnpg-operator-manifests.yaml 2>&1 | tee /tmp/cnpg-apply.log; then
30-
# Check if it's just the poolers CRD annotation issue (non-fatal)
31-
if grep -q "poolers.postgresql.cnpg.io.*Too long" /tmp/cnpg-apply.log && \
32-
kubectl get deployment -n cnpg-system cnpg-operator-cloudnative-pg >/dev/null 2>&1; then
33-
echo "[WARN]: Poolers CRD has annotation size issue, but operator deployment was created"
34-
echo "[INFO]: Continuing with deployment..."
20+
--create-namespace \
21+
--wait --timeout=10m 2>&1; then
22+
23+
echo "[WARN]: Initial installation failed, checking if resources were created..."
24+
kubectl get pods -n cnpg-system || true
25+
26+
# If resources exist, the install might have partially succeeded
27+
if kubectl get deployment -n cnpg-system cnpg-cloudnative-pg >/dev/null 2>&1; then
28+
echo "[INFO]: Operator deployment exists, waiting for it to become ready..."
3529
else
36-
echo "[ERROR]: Failed to apply operator manifests"
37-
echo "[DEBUG]: Checking what was created..."
38-
kubectl get all -n cnpg-system || true
39-
exit 1
30+
# Try again without --wait flag for microshift compatibility
31+
echo "[INFO]: Retrying installation without wait flag (microshift compatibility)..."
32+
helm uninstall cnpg-operator -n cnpg-system 2>/dev/null || true
33+
sleep 5
34+
35+
# First check what would be installed
36+
echo "[DEBUG]: Checking Helm template output..."
37+
helm template cnpg-operator cloudnative-pg/cloudnative-pg \
38+
--values src/test/infrastructure/cloudnativepg/operator-values.yaml \
39+
--namespace cnpg-system | grep -A 5 "kind: Deployment" || echo "No Deployment found in template"
40+
41+
if ! helm install cnpg-operator cloudnative-pg/cloudnative-pg \
42+
--values src/test/infrastructure/cloudnativepg/operator-values.yaml \
43+
--namespace cnpg-system \
44+
--create-namespace \
45+
--timeout=10m; then
46+
echo "[ERROR]: Failed to install CloudNativePG operator even without wait flag"
47+
echo "[DEBUG]: Helm list..."
48+
helm list -n cnpg-system
49+
echo "[DEBUG]: Checking all resources in cnpg-system namespace..."
50+
kubectl get all -n cnpg-system || true
51+
echo "[DEBUG]: Checking operator deployment..."
52+
kubectl describe deployment -n cnpg-system || true
53+
echo "[DEBUG]: Getting Helm manifest..."
54+
helm get manifest cnpg-operator -n cnpg-system || true
55+
exit 1
56+
fi
4057
fi
4158
fi
42-
43-
echo "[INFO]: Operator manifests applied successfully"
4459
else
4560
echo "[INFO]: CloudNativePG operator already installed, skipping..."
4661
fi
@@ -198,9 +213,9 @@ create_secrets() {
198213
# Only create it if it doesn't exist
199214
if ! kubectl get secret ${DC_APP}-db-credentials -n atlassian >/dev/null 2>&1; then
200215
kubectl create secret generic ${DC_APP}-db-credentials \
201-
--from-literal=username="${DC_APP}" \
202-
--from-literal=password="${DC_APP}pwd" \
203-
-n atlassian
216+
--from-literal=username="${DC_APP}" \
217+
--from-literal=password="${DC_APP}pwd" \
218+
-n atlassian
204219
fi
205220
kubectl create secret generic ${DC_APP}-admin \
206221
--from-literal=username="admin" \

0 commit comments

Comments
 (0)