mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-10 20:42:26 +00:00
List and diff GCP resources before/after in Jenkins
This currently won't fail runs if there is a diff. Additionally, clean up some unnecessary symlinking of JUnit test reports.
This commit is contained in:
parent
004c3bc7ad
commit
0024bfd1d5
@ -807,6 +807,9 @@ cd kubernetes
|
|||||||
ARTIFACTS=${WORKSPACE}/_artifacts
|
ARTIFACTS=${WORKSPACE}/_artifacts
|
||||||
mkdir -p ${ARTIFACTS}
|
mkdir -p ${ARTIFACTS}
|
||||||
export E2E_REPORT_DIR=${ARTIFACTS}
|
export E2E_REPORT_DIR=${ARTIFACTS}
|
||||||
|
declare -r gcp_resources_before="${ARTIFACTS}/gcp-resources-before.txt"
|
||||||
|
declare -r gcp_resources_cluster_up="${ARTIFACTS}/gcp-resources-cluster-up.txt"
|
||||||
|
declare -r gcp_resources_after="${ARTIFACTS}/gcp-resources-after.txt"
|
||||||
|
|
||||||
### Pre Set Up ###
|
### Pre Set Up ###
|
||||||
# Install gcloud from a custom path if provided. Used to test GKE with gcloud
|
# Install gcloud from a custom path if provided. Used to test GKE with gcloud
|
||||||
@ -826,8 +829,14 @@ fi
|
|||||||
### Set up ###
|
### Set up ###
|
||||||
if [[ "${E2E_UP,,}" == "true" ]]; then
|
if [[ "${E2E_UP,,}" == "true" ]]; then
|
||||||
go run ./hack/e2e.go ${E2E_OPT} -v --down
|
go run ./hack/e2e.go ${E2E_OPT} -v --down
|
||||||
|
if [[ ${KUBERNETES_PROVIDER} == "gce" || ${KUBERNETES_PROVIDER} == "gke" ]]; then
|
||||||
|
./cluster/gce/list-resources.sh > "${gcp_resources_before}"
|
||||||
|
fi
|
||||||
go run ./hack/e2e.go ${E2E_OPT} -v --up
|
go run ./hack/e2e.go ${E2E_OPT} -v --up
|
||||||
go run ./hack/e2e.go -v --ctl="version --match-server-version=false"
|
go run ./hack/e2e.go -v --ctl="version --match-server-version=false"
|
||||||
|
if [[ ${KUBERNETES_PROVIDER} == "gce" || ${KUBERNETES_PROVIDER} == "gke" ]]; then
|
||||||
|
./cluster/gce/list-resources.sh > "${gcp_resources_cluster_up}"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Run tests ###
|
### Run tests ###
|
||||||
@ -862,14 +871,6 @@ if [[ "${USE_KUBEMARK:-}" == "true" ]]; then
|
|||||||
unset NUM_MINIONS_BKP
|
unset NUM_MINIONS_BKP
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TODO(zml): We have a bunch of legacy Jenkins configs that are
|
|
||||||
# expecting junit*.xml to be in ${WORKSPACE} root and it's Friday
|
|
||||||
# afternoon, so just put the junit report where it's expected.
|
|
||||||
# If link already exists, non-zero return code should not cause build to fail.
|
|
||||||
for junit in ${ARTIFACTS}/junit*.xml; do
|
|
||||||
ln -s -f ${junit} ${WORKSPACE} || true
|
|
||||||
done
|
|
||||||
|
|
||||||
### Clean up ###
|
### Clean up ###
|
||||||
if [[ "${E2E_DOWN,,}" == "true" ]]; then
|
if [[ "${E2E_DOWN,,}" == "true" ]]; then
|
||||||
# Sleep before deleting the cluster to give the controller manager time to
|
# Sleep before deleting the cluster to give the controller manager time to
|
||||||
@ -880,4 +881,11 @@ if [[ "${E2E_DOWN,,}" == "true" ]]; then
|
|||||||
# for the wait between attempts.
|
# for the wait between attempts.
|
||||||
sleep 30
|
sleep 30
|
||||||
go run ./hack/e2e.go ${E2E_OPT} -v --down
|
go run ./hack/e2e.go ${E2E_OPT} -v --down
|
||||||
|
if [[ ${KUBERNETES_PROVIDER} == "gce" || ${KUBERNETES_PROVIDER} == "gke" ]]; then
|
||||||
|
./cluster/gce/list-resources.sh > "${gcp_resources_after}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f "${gcp_resources_before}" && -f "${gcp_resources_after}" ]]; then
|
||||||
|
diff -sw -U0 -F'^\[.*\]$' "${gcp_resources_before}" "${gcp_resources_after}" || true
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user