Skip to content
Merged
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
13 changes: 8 additions & 5 deletions .github/workflows/pr-size.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
permissions:
contents: read
pull-requests: write
issues: write

jobs:
size-label:
Expand Down Expand Up @@ -43,11 +44,13 @@ jobs:

echo "PR #${PR_NUMBER}: +${ADDITIONS} -${DELETIONS} = ${TOTAL} lines -> ${SIZE}"

# Remove any existing size labels, then add the correct one
for label in size/xs size/s size/m size/l size/xl; do
gh pr edit "$PR_NUMBER" --repo "${{ github.repository }}" --remove-label "$label" 2>/dev/null || true
done
gh pr edit "$PR_NUMBER" --repo "${{ github.repository }}" --add-label "$SIZE"
# Fetch current labels, swap the size/* label in one API call
REPO="${{ github.repository }}"
KEEP=$(gh api "repos/${REPO}/issues/${PR_NUMBER}" --jq \
'[.labels[].name | select(startswith("size/") | not)]')
FINAL=$(echo "$KEEP" | jq --arg s "$SIZE" '. + [$s]')
echo "$FINAL" | jq '{labels: .}' | \
gh api "repos/${REPO}/issues/${PR_NUMBER}/labels" --method PUT --input -

# Post a warning comment for XL PRs
if [ "$SIZE" = "size/xl" ]; then
Expand Down
32 changes: 28 additions & 4 deletions test/e2e/recommend-mode/chainsaw-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,32 @@ spec:
status:
readyReplicas: 1
- name: verify-status
try:
- script:
timeout: 3m
content: |
# The operator may transition quickly from InsufficientData to Monitoring
# when minimumDataPoints is 1 and Prometheus scrapes fast. Accept either
# state as valid — both prove the policy discovered the workload and
# the controller reconciled it.
for i in $(seq 1 36); do
reason=$(kubectl get attunepolicy recommend-test -n e2e-recommend-mode \
-o jsonpath='{.status.conditions[?(@.type=="Ready")].reason}' 2>/dev/null)
discovered=$(kubectl get attunepolicy recommend-test -n e2e-recommend-mode \
-o jsonpath='{.status.workloads.discovered}' 2>/dev/null)
if [ "$discovered" = "1" ]; then
if [ "$reason" = "InsufficientData" ] || [ "$reason" = "Monitoring" ]; then
echo "OK: workloads discovered=$discovered, Ready reason=$reason"
exit 0
fi
fi
echo "Waiting... discovered=$discovered reason=$reason"
sleep 5
done
echo "FAIL: timed out waiting for policy to discover workloads"
kubectl get attunepolicy recommend-test -n e2e-recommend-mode -o yaml
exit 1
- name: verify-no-resizes
try:
- assert:
resource:
Expand All @@ -103,10 +129,8 @@ spec:
name: recommend-test
namespace: e2e-recommend-mode
status:
conditions:
- type: Ready
status: "False"
reason: InsufficientData
workloads:
resized: 0
catch:
- describe:
apiVersion: attune.io/v1alpha1
Expand Down
Loading