@@ -48,6 +48,17 @@ if [[ "${VERSION}" == "3.7.8" ]] ;then
4848 " ghcr.io/zalando/spilo-16:3.2-p3" \
4949 )
5050 NETBOX_HELM_CHART=" https://github.com/netbox-community/netbox-chart/releases/download/netbox-5.0.0-beta5/netbox-5.0.0-beta5.tgz"
51+
52+ # perform patching, as we need different demo data and adapt to the database schema
53+ # to avoid accidental check-in of the files, the base file is renamed to xx.orig.yy, and the xx.yy is added to .gitignore
54+ # patch load-data.sh
55+ sed ' s/netbox-demo-v4.1.sql/netbox-demo-v3.7.sql/g' $( dirname " $0 " ) /load-data-job/load-data.orig.sh > $( dirname " $0 " ) /load-data-job/load-data.sh && chmod +x $( dirname " $0 " ) /load-data-job/load-data.sh
56+
57+ # patch local-demo-data.sql
58+ sed \
59+ -e ' s/related_object_type_id/object_type_id/g' \
60+ -e ' s/, comments, \"unique\", related_object_filter//g' \
61+ -e " s/, '', false, NULL//g" $( dirname " $0 " ) /load-data-job/local-demo-data.orig.sql > $( dirname " $0 " ) /load-data-job/local-demo-data.sql
5162elif [[ " ${VERSION} " == " 4.0.11" ]] ; then
5263 echo " Using version ${VERSION} "
5364 # need to align with netbox-chart otherwise the creation of the cluster will hang
@@ -60,6 +71,14 @@ elif [[ "${VERSION}" == "4.0.11" ]] ;then
6071 " ghcr.io/zalando/spilo-16:3.2-p3" \
6172 )
6273 NETBOX_HELM_CHART=" https://github.com/netbox-community/netbox-chart/releases/download/netbox-5.0.0-beta.84/netbox-5.0.0-beta.84.tgz"
74+
75+ # patch load-data.sh
76+ sed ' s/netbox-demo-v4.1.sql/netbox-demo-v4.0.sql/g' $( dirname " $0 " ) /load-data-job/load-data.orig.sh > $( dirname " $0 " ) /load-data-job/load-data.sh && chmod +x $( dirname " $0 " ) /load-data-job/load-data.sh
77+
78+ # patch local-demo-data.sql
79+ sed \
80+ -e " s/comments, \" unique\" , related_object_filter)/comments)/g" \
81+ -e " s/'', false, NULL);/'');/g" $( dirname " $0 " ) /load-data-job/local-demo-data.orig.sql > $( dirname " $0 " ) /load-data-job/local-demo-data.sql
6382elif [[ " ${VERSION} " == " 4.1.7" ]] ; then
6483 echo " Using version ${VERSION} "
6584 # need to align with netbox-chart otherwise the creation of the cluster will hang
@@ -106,3 +125,7 @@ helm upgrade --install --namespace="${NAMESPACE}" netbox \
106125 ${NETBOX_HELM_CHART}
107126
108127kubectl rollout status --namespace=" ${NAMESPACE} " deployment netbox
128+
129+ # clean up
130+ rm $( dirname " $0 " ) /load-data-job/load-data.sh
131+ rm $( dirname " $0 " ) /load-data-job/local-demo-data.sql
0 commit comments