@@ -71,34 +71,25 @@ pipeline {
7171 DEBIAN_FRONTEND=noninteractive apt -y install figlet openjdk-11-jdk make docker.io
7272 # Make sure our kubeconfig dir exists…
7373 mkdir $HOME/.kube || true
74- '''
74+ '''
7575 }
7676 }
7777
7878 stage(' Cleaning Up' ) {
7979 steps {
8080
8181 /*
82- * Run a find and check for any stacks that currently exist with our generated stack name; this should not
83- * happen in normal operation, but could potentially happen if things break so better safe than sorry.
82+ * This is currently empty since we are building a new executor for each run. However, maintaining
83+ * here for anyone who wants to add cleanup steps for their environment
8484 *
85- * This function also tries to remove both K3S and Microk8s if they are found on the host; this is because we
86- * will be installing Microk8s and we want to both make sure we are removing any previous installations as well as
87- * ensuring this Jenkins Agent does not already have a Microk8s installation on it.
85+ * Other cleanup related functions can be placed here as well.
8886 */
8987
90- sh '''
91- # Reset our K3S Environment
92- /usr/local/bin/k3s-killall.sh || true
93- /usr/local/bin/k3s-uninstall.sh || true
94- # Reset our Microk8s Environment; true if it’s not there
95- microk8s reset --destroy-storage || true
96- # True if it’s not there…
97- snap remove microk8s || true
98- # Clean up the Pulumi stack if it exists for our run - which it shouldn\' t, but you never know.
99- find $WORKSPACE -mindepth 2 -maxdepth 7 -type f -name Pulumi.yaml -execdir $WORKSPACE/pulumi/python/venv/bin/pulumi stack rm marajenk${BUILD_NUMBER} --force --yes \\ ;
100- '''
101- }
88+ sh '''
89+ # Just return...
90+ true
91+ '''
92+ }
10293 }
10394
10495 stage(' Microk8s Setup' ) {
@@ -115,7 +106,7 @@ pipeline {
115106 snap install microk8s --classic --channel=1.23/stable
116107 microk8s.enable storage dns helm3
117108 microk8s.enable metallb 192.168.100.100/30
118- '''
109+ '''
119110 }
120111 }
121112
@@ -129,7 +120,7 @@ pipeline {
129120
130121 sh '''
131122 microk8s.config > $HOME/.kube/config
132- '''
123+ '''
133124 }
134125 }
135126
@@ -142,7 +133,7 @@ pipeline {
142133
143134 sh '''
144135 $WORKSPACE/bin/setup_venv.sh
145- '''
136+ '''
146137 }
147138 }
148139
@@ -159,21 +150,21 @@ pipeline {
159150 */
160151
161152 sh '''
162- echo "PULUMI_STACK=marajenk ${BUILD_NUMBER}" > $WORKSPACE/config/pulumi/environment
163- $WORKSPACE/pulumi/python/venv/bin/pulumi stack select --create marajenk ${BUILD_NUMBER} -C pulumi/python/config
164- $WORKSPACE/pulumi/python/venv/bin/pulumi stack select --create marajenk ${BUILD_NUMBER} -C pulumi/python/kubernetes/applications/sirius
165- $WORKSPACE/pulumi/python/venv/bin/pulumi config set certmgr:helm_timeout "600" -C pulumi/python/config -s marajenk ${BUILD_NUMBER}
166- $WORKSPACE/pulumi/python/venv/bin/pulumi config set kic-helm:fqdn "marajenks ${BUILD_NUMBER}.zathras.io" -C pulumi/python/config -s marajenk ${BUILD_NUMBER}
167- $WORKSPACE/pulumi/python/venv/bin/pulumi config set kic-helm:helm_timeout "600" -C pulumi/python/config -s marajenk ${BUILD_NUMBER}
168- $WORKSPACE/pulumi/python/venv/bin/pulumi config set kubernetes:cluster_name "microk8s-cluster" -C pulumi/python/config -s marajenk ${BUILD_NUMBER}
169- $WORKSPACE/pulumi/python/venv/bin/pulumi config set kubernetes:infra_type "kubeconfig" -C pulumi/python/config -s marajenk ${BUILD_NUMBER}
170- $WORKSPACE/pulumi/python/venv/bin/pulumi config set kubernetes:kubeconfig "$HOME/.kube/config" -C pulumi/python/config -s marajenk ${BUILD_NUMBER}
171- $WORKSPACE/pulumi/python/venv/bin/pulumi config set logagent:helm_timeout "600" -C pulumi/python/config -s marajenk ${BUILD_NUMBER}
172- $WORKSPACE/pulumi/python/venv/bin/pulumi config set logstore:helm_timeout "600" -C pulumi/python/config -s marajenk ${BUILD_NUMBER}
173- $WORKSPACE/pulumi/python/venv/bin/pulumi config set prometheus:adminpass "password" -C pulumi/python/config -s marajenk ${BUILD_NUMBER}
174- $WORKSPACE/pulumi/python/venv/bin/pulumi config set prometheus:helm_timeout "600" -C pulumi/python/config -s marajenk ${BUILD_NUMBER}
175- $WORKSPACE/pulumi/python/venv/bin/pulumi config set prometheus:helm_timeout "600" -C pulumi/python/config -s marajenk ${BUILD_NUMBER}
176- '''
153+ echo "PULUMI_STACK=marajenkmk8s ${BUILD_NUMBER}" > $WORKSPACE/config/pulumi/environment
154+ $WORKSPACE/pulumi/python/venv/bin/pulumi stack select --create marajenkmk8s ${BUILD_NUMBER} -C pulumi/python/config
155+ $WORKSPACE/pulumi/python/venv/bin/pulumi stack select --create marajenkmk8s ${BUILD_NUMBER} -C pulumi/python/kubernetes/applications/sirius
156+ $WORKSPACE/pulumi/python/venv/bin/pulumi config set certmgr:helm_timeout "600" -C pulumi/python/config -s marajenkmk8s ${BUILD_NUMBER}
157+ $WORKSPACE/pulumi/python/venv/bin/pulumi config set kic-helm:fqdn "marajenkmk8ss ${BUILD_NUMBER}.zathras.io" -C pulumi/python/config -s marajenkmk8s ${BUILD_NUMBER}
158+ $WORKSPACE/pulumi/python/venv/bin/pulumi config set kic-helm:helm_timeout "600" -C pulumi/python/config -s marajenkmk8s ${BUILD_NUMBER}
159+ $WORKSPACE/pulumi/python/venv/bin/pulumi config set kubernetes:cluster_name "microk8s-cluster" -C pulumi/python/config -s marajenkmk8s ${BUILD_NUMBER}
160+ $WORKSPACE/pulumi/python/venv/bin/pulumi config set kubernetes:infra_type "kubeconfig" -C pulumi/python/config -s marajenkmk8s ${BUILD_NUMBER}
161+ $WORKSPACE/pulumi/python/venv/bin/pulumi config set kubernetes:kubeconfig "$HOME/.kube/config" -C pulumi/python/config -s marajenkmk8s ${BUILD_NUMBER}
162+ $WORKSPACE/pulumi/python/venv/bin/pulumi config set logagent:helm_timeout "600" -C pulumi/python/config -s marajenkmk8s ${BUILD_NUMBER}
163+ $WORKSPACE/pulumi/python/venv/bin/pulumi config set logstore:helm_timeout "600" -C pulumi/python/config -s marajenkmk8s ${BUILD_NUMBER}
164+ $WORKSPACE/pulumi/python/venv/bin/pulumi config set prometheus:adminpass "password" -C pulumi/python/config -s marajenkmk8s ${BUILD_NUMBER}
165+ $WORKSPACE/pulumi/python/venv/bin/pulumi config set prometheus:helm_timeout "600" -C pulumi/python/config -s marajenkmk8s ${BUILD_NUMBER}
166+ $WORKSPACE/pulumi/python/venv/bin/pulumi config set prometheus:helm_timeout "600" -C pulumi/python/config -s marajenkmk8s ${BUILD_NUMBER}
167+ '''
177168 }
178169 }
179170
@@ -188,7 +179,7 @@ pipeline {
188179 sh '''
189180 echo $NGINX_JWT > $WORKSPACE/extras/jwt.token
190181 $WORKSPACE/bin/start_kube.sh
191- '''
182+ '''
192183 }
193184 }
194185
@@ -209,14 +200,8 @@ pipeline {
209200 microk8s reset --destroy-storage || true
210201 # True if it’s not there…
211202 sudo snap remove microk8s || true
212- find . -mindepth 2 -maxdepth 6 -type f -name Pulumi.yaml -execdir $WORKSPACE/pulumi/python/venv/bin/pulumi stack rm marajenk${BUILD_NUMBER} --force --yes \\ ;
213- # This is a hack to allow additional commands to be issued following cleanup. This is needed because the VMs
214- # that currently run as agents for K3S and Microk8s deployments need to be rebooted following some number of
215- # runs due to zombie processes and other issues. Long term we want to deploy these VM's via IaaC so the only
216- # exist for the lifetime of the project. We do it this way in order to provide some flexibility for the
217- # jenkins configuration.
218- ${POSTRUN_CMD- true}
219- '''
203+ find . -mindepth 2 -maxdepth 6 -type f -name Pulumi.yaml -execdir $WORKSPACE/pulumi/python/venv/bin/pulumi stack rm marajenkmk8s${BUILD_NUMBER} --force --yes \\ ;
204+ '''
220205
221206 }
222207 }
@@ -233,14 +218,13 @@ pipeline {
233218 */
234219
235220 sh '''
236- # Destroy our partial build...
237- $WORKSPACE/bin/destroy.sh || true
238- # Reset our Microk8s Environment; true if it’s not there
239- microk8s reset --destroy-storage || true
240- # True if it’s not there…
241- snap remove microk8s || true
242- # Clean up the Pulumi stack if it exists for our run - which it shouldn\' t, but you never know.
243- find $WORKSPACE -mindepth 2 -maxdepth 7 -type f -name Pulumi.yaml -execdir $WORKSPACE/pulumi/python/venv/bin/pulumi stack rm marajenk${BUILD_NUMBER} --force --yes \;
221+ # Destroy our partial build...
222+ $WORKSPACE/bin/destroy.sh || true
223+ # Reset our Microk8s Environment; true if it’s not there
224+ microk8s reset --destroy-storage || true
225+ # True if it’s not there…
226+ snap remove microk8s || true
227+ find $WORKSPACE -mindepth 2 -maxdepth 7 -type f -name Pulumi.yaml -execdir $WORKSPACE/pulumi/python/venv/bin/pulumi stack rm marajenkmk8s${BUILD_NUMBER} --force --yes \\ ;
244228 '''
245229 }
246230 }
0 commit comments