Skip to content

agent/billing: Use autoscaling.neon.tech/billing-endpoint-id for events #1516

agent/billing: Use autoscaling.neon.tech/billing-endpoint-id for events

agent/billing: Use autoscaling.neon.tech/billing-endpoint-id for events #1516

Workflow file for this run

name: e2e-test
on:
pull_request:
push:
branches:
- main
jobs:
e2e-tests:
strategy:
fail-fast: false
matrix:
cluster:
- k3d
- kind
runs-on: [ self-hosted, gen3, small ]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # fetch all, so that we also include tags
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
# Sometimes setup-go gets stuck. Without this, it'll keep going until the job gets killed
timeout-minutes: 5
- uses: docker/setup-buildx-action@v2
- name: Install dependencies
run: |
make e2e-tools
echo $(pwd)/bin >> $GITHUB_PATH
- name: Check dependencies
run: |
kubectl version --client --output=yaml
k3d version
kind version
kuttl version
docker version
docker buildx version
# To save some time use prebuilt vm kernel instead of running `make kernel` (see .github/workflows/release.yaml)
- name: Load VM kernel
run: |
docker pull --quiet ${VM_KERNEL_IMAGE}:${VM_KERNEL_VERSION}
ID=$(docker create ${VM_KERNEL_IMAGE}:${VM_KERNEL_VERSION} true)
docker cp ${ID}:/vmlinuz neonvm/hack/vmlinuz
docker rm -f ${ID}
env:
VM_KERNEL_IMAGE: "neondatabase/vm-kernel"
VM_KERNEL_VERSION: "5.15.80"
# our docker builds use the output of 'git describe' for embedding git information
- run: git describe --long --dirty
# Explicitly build all the images beforehand. Building images while the cluster is up can
# sometimes affect the cluster. For more information:
# https://github.com/neondatabase/autoscaling/issues/120#issuecomment-1493405844
- run: make build
- run: make docker-build
- run: make docker-build-examples
- run: make ${{ matrix.cluster }}-setup
- run: make deploy
timeout-minutes: 10
- run: make example-vms
timeout-minutes: 10
- run: make e2e
timeout-minutes: 15
- name: Get k8s logs and events
if: always()
run: |
if ! kubectl config current-context; then
echo "skipping cluster logs because no cluster found in kubectl context"
exit 0
fi
namespaces=$(kubectl get namespaces -o jsonpath='{.items[*].metadata.name}')
for namespace in $namespaces; do
pods=$(kubectl get pods -n $namespace -o jsonpath='{.items[*].metadata.name}')
for pod in $pods; do
echo "*** Namespace=$namespace Pod=$pod ***"
restarts=$(
kubectl get pod -n $namespace $pod -o jsonpath='{.status.containerStatuses[0].restartCount}' || echo '0'
)
if [ "$restarts" -ne 0 ]; then
echo "CONTAINER RESTARTED $restarts TIME(S)"
echo "Previous logs:"
kubectl logs -n $namespace -p $pod || echo 'Error getting logs'
echo "Current logs:"
kubectl logs -n $namespace $pod || echo 'Error getting logs'
else
echo "Logs:"
kubectl logs -n $namespace $pod || echo 'Error getting logs'
fi
echo "Events:"
kubectl get events --namespace $namespace --field-selector involvedObject.name=$pod || echo 'Error getting events'
echo ""
done
done
- name: Cleanup
if: always()
run: make ${{ matrix.cluster }}-destroy