Skip to content

Commit be554c0

Browse files
committed
debug docker and k8s deployment tests
1 parent 2274959 commit be554c0

File tree

4 files changed

+70
-37
lines changed

4 files changed

+70
-37
lines changed

.github/workflows/test-deployments.yml

+26-15
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ env:
2020
jobs:
2121
build-linux-packages:
2222
name: Build ${{ matrix.package_name }} ${{ matrix.arch.gox }} ${{ matrix.packager }}
23-
runs-on: ubuntu-latest
23+
runs-on: ubuntu-24.04
2424
strategy:
2525
matrix:
2626
package_name:
@@ -77,7 +77,7 @@ jobs:
7777
dry-run-linux-packages:
7878
needs: build-linux-packages
7979
name: Dry Run ${{ format('{0}:{1}', matrix.distro.name, matrix.distro.version) }} ${{ matrix.arch.gox }}
80-
runs-on: ubuntu-latest
80+
runs-on: ubuntu-24.04
8181
env:
8282
ZITI_PWD: ziggypw
8383
ZITI_CTRL_ADVERTISED_ADDRESS: linux-controller.127.21.71.0.sslip.io
@@ -136,7 +136,10 @@ jobs:
136136
- name: Install Packages
137137
shell: bash
138138
run: |
139-
set -x
139+
140+
set -o pipefail
141+
set -o xtrace
142+
140143
ls -lR ./release/
141144
case "${{ matrix.distro.type }}" in
142145
rpm)
@@ -158,7 +161,10 @@ jobs:
158161
env:
159162
DEBUG: 1
160163
run: |
161-
set -x
164+
165+
set -o pipefail
166+
set -o xtrace
167+
162168
/opt/openziti/etc/controller/bootstrap.bash <<CTRL
163169
ZITI_CTRL_ADVERTISED_ADDRESS=${ZITI_CTRL_ADVERTISED_ADDRESS}
164170
ZITI_CTRL_ADVERTISED_PORT=${ZITI_CTRL_ADVERTISED_PORT}
@@ -176,9 +182,9 @@ jobs:
176182
ZITI_ARGS="--verbose"
177183
ROUTER
178184
179-
test-linux-services:
180-
name: Test Debian Linux Services
181-
runs-on: ubuntu-latest
185+
linux-deployments:
186+
name: Test Linux Deployments
187+
runs-on: ubuntu-24.04
182188
steps:
183189
- name: Shallow checkout
184190
uses: actions/checkout@v4
@@ -192,9 +198,13 @@ jobs:
192198
- name: Install nfpm
193199
shell: bash
194200
run: |
201+
202+
set -o pipefail
203+
set -o xtrace
204+
195205
echo ~/.local/bin >> $GITHUB_PATH
196206
mkdir -p ~/.local/bin
197-
wget -qO- https://github.com/goreleaser/nfpm/releases/download/v${{ env.NFPM_VERSION }}/nfpm_${{ env.NFPM_VERSION }}_Linux_x86_64.tar.gz | tar --directory ~/.local/bin -xz nfpm
207+
wget -qO- https://github.com/goreleaser/nfpm/releases/download/v${NFPM_VERSION}/nfpm_${NFPM_VERSION}_Linux_x86_64.tar.gz | tar --directory ~/.local/bin -xz nfpm
198208
nfpm --version
199209
200210
- name: Bootstrap & Run
@@ -205,8 +215,10 @@ jobs:
205215
if: always()
206216
shell: bash
207217
run: |
208-
set -x
209-
set +e
218+
219+
set -o xtrace
220+
set +o errexit
221+
210222
sudo ss -lntp | grep -E ":(${ZITI_CTRL_ADVERTISED_PORT}|${ZITI_ROUTER_PORT})"
211223
sudo journalctl --no-pager -o cat -u ziti-controller.service
212224
sudo journalctl --no-pager -o cat -u ziti-router.service
@@ -215,7 +227,7 @@ jobs:
215227
216228
docker-deployments:
217229
name: Test Docker Deployments
218-
runs-on: ubuntu-latest
230+
runs-on: ubuntu-24.04
219231
env:
220232
ZIGGY_UID: 1001 # let container EUID run-as GHA "runner" user to share cache, etc.
221233
steps:
@@ -228,15 +240,15 @@ jobs:
228240
with:
229241
go-version-file: ./go.mod
230242

231-
- name: Run the Compose Test Script
243+
- name: Run the Docker Test Script
232244
shell: bash
233-
run: dist/docker-images/compose.test.bash
245+
run: dist/docker-images/docker.test.bash
234246
env:
235247
ZITI_GO_VERSION: ${{ steps.setup-go.outputs.go-version }}
236248

237249
kubernetes-deployments:
238250
name: Test Kubernetes Deployments
239-
runs-on: ubuntu-latest
251+
runs-on: ubuntu-24.04
240252
env:
241253
ZITI_NAMESPACE: zititest
242254
steps:
@@ -257,4 +269,3 @@ jobs:
257269
- name: Run the Kubernetes Test Script
258270
shell: bash
259271
run: ./dist/docker-images/k8s.test.bash --cpus=2 # GitHub runners have 4 vCPUs
260-

dist/dist-packages/linux/linux.test.bash

+12-4
Original file line numberDiff line numberDiff line change
@@ -182,18 +182,26 @@ else
182182
exit 1
183183
fi
184184

185+
export \
185186
ZITI_CTRL_EDGE_ADVERTISED_ADDRESS=${ZITI_CTRL_ADVERTISED_ADDRESS} \
186-
ZITI_CTRL_EDGE_ADVERTISED_PORT=${ZITI_CTRL_ADVERTISED_PORT} \
187-
go test -v -count=1 -tags="quickstart manual" ./ziti/cmd/edge/...
187+
ZITI_CTRL_EDGE_ADVERTISED_PORT=${ZITI_CTRL_ADVERTISED_PORT}
188+
189+
_test_result=$(go test -v -count=1 -tags="quickstart manual" ./ziti/run/...)
190+
191+
# check for failure modes that don't result in an error exit code
192+
if [[ "${_test_result}" =~ "no tests to run" ]]
193+
then
194+
echo "ERROR: test failed because no tests to run"
195+
exit 1
196+
fi
188197

189198
ATTEMPTS=5
190199
DELAY=3
191200

192201
# verify console is available
193202
curl_cmd="curl -skSfw '%{http_code}\t%{url}\n' -o/dev/null \"https://${ZITI_CTRL_ADVERTISED_ADDRESS}:${ZITI_CTRL_ADVERTISED_PORT}/zac/\""
194-
until ! ((ATTEMPTS)) || eval "${curl_cmd}" &> /dev/null
203+
until ! (( ATTEMPTS-- )) || eval "${curl_cmd}" &> /dev/null
195204
do
196-
(( ATTEMPTS-- ))
197205
echo "Waiting for zac"
198206
sleep ${DELAY}
199207
done

dist/docker-images/compose.test.bash dist/docker-images/docker.test.bash

+12-4
Original file line numberDiff line numberDiff line change
@@ -124,18 +124,26 @@ ziti edge create edge-router "${ZITI_ROUTER_NAME}" -to ~ziggy/.config/ziti/"${ZI
124124
docker compose up ziti-router --detach
125125

126126
unset GOOS
127+
export \
127128
ZITI_CTRL_EDGE_ADVERTISED_ADDRESS=${ZITI_CTRL_ADVERTISED_ADDRESS} \
128-
ZITI_CTRL_EDGE_ADVERTISED_PORT=${ZITI_CTRL_ADVERTISED_PORT} \
129-
go test -v -count=1 -tags="quickstart manual" ./ziti/cmd/edge/...
129+
ZITI_CTRL_EDGE_ADVERTISED_PORT=${ZITI_CTRL_ADVERTISED_PORT}
130+
131+
_test_result=$(go test -v -count=1 -tags="quickstart manual" ./ziti/run/...)
132+
133+
# check for failure modes that don't result in an error exit code
134+
if [[ "${_test_result}" =~ "no tests to run" ]]
135+
then
136+
echo "ERROR: test failed because no tests to run"
137+
exit 1
138+
fi
130139

131140
ATTEMPTS=5
132141
DELAY=3
133142

134143
# verify console is available
135144
curl_cmd="curl -skSfw '%{http_code}\t%{url}\n' -o/dev/null \"https://${ZITI_CTRL_ADVERTISED_ADDRESS}:${ZITI_CTRL_ADVERTISED_PORT}/zac/\""
136-
until ! ((ATTEMPTS)) || eval "${curl_cmd}" &> /dev/null
145+
until ! (( ATTEMPTS-- )) || eval "${curl_cmd}" &> /dev/null
137146
do
138-
(( ATTEMPTS-- ))
139147
echo "Waiting for zac"
140148
sleep ${DELAY}
141149
done

dist/docker-images/k8s.test.bash

+20-14
Original file line numberDiff line numberDiff line change
@@ -122,34 +122,40 @@ image:
122122
pullPolicy: Never
123123
ROUTER
124124

125-
./quickstart/kubernetes/miniziti.bash start \
125+
bash -x ./quickstart/kubernetes/miniziti.bash start \
126126
--profile "${ZITI_NAMESPACE}" \
127127
--no-hosts \
128-
--debug \
129128
--values-dir "${EXTRA_VALUES_DIR}"
130129

131130
MINIKUBE_IP="$(minikube --profile "${ZITI_NAMESPACE}" ip)"
131+
ZITI_CTRL_ADVERTISED_ADDRESS="miniziti-controller.${MINIKUBE_IP}.sslip.io"
132132

133133
# verify console is available
134-
curl -skSfw '%{http_code}\t%{url}\n' -o/dev/null "https://miniziti-controller.${MINIKUBE_IP}.sslip.io/zac/"
134+
curl -skSfw '%{http_code}\t%{url}\n' -o/dev/null "https://${ZITI_CTRL_ADVERTISED_ADDRESS}:${ZITI_CTRL_ADVERTISED_PORT}/zac/"
135135

136136
ZITI_PWD=$(
137-
minikube kubectl --profile "${ZITI_NAMESPACE}" -- \
138-
--context "${ZITI_NAMESPACE}" \
139-
get secrets "ziti-controller-admin-secret" \
140-
--namespace "${ZITI_NAMESPACE}" \
141-
--output go-template='{{index .data "admin-password" | base64decode }}'
137+
minikube kubectl --profile "${ZITI_NAMESPACE}" -- \
138+
--context "${ZITI_NAMESPACE}" \
139+
get secrets "ziti-controller-admin-secret" \
140+
--namespace "${ZITI_NAMESPACE}" \
141+
--output go-template='{{index .data "admin-password" | base64decode }}'
142142
)
143143

144144

145145
export \
146146
ZITI_PWD \
147147
ZITI_ROUTER_NAME="miniziti-router" \
148-
ZITI_CTRL_ADVERTISED_ADDRESS="miniziti-controller.${MINIKUBE_IP}.sslip.io"
149-
150-
ZITI_CTRL_EDGE_ADVERTISED_ADDRESS=${ZITI_CTRL_ADVERTISED_ADDRESS} \
151-
ZITI_CTRL_EDGE_ADVERTISED_PORT=${ZITI_CTRL_ADVERTISED_PORT} \
152-
ZITI_TEST_BIND_ADDRESS="ziti-controller-client.${ZITI_NAMESPACE}.svc.cluster.local" \
153-
go test -v -count=1 -tags="quickstart manual" ./ziti/cmd/edge/...
148+
ZITI_CTRL_EDGE_ADVERTISED_ADDRESS="${ZITI_CTRL_ADVERTISED_ADDRESS}" \
149+
ZITI_CTRL_EDGE_ADVERTISED_PORT="${ZITI_CTRL_ADVERTISED_PORT}" \
150+
ZITI_TEST_BIND_ADDRESS="ziti-controller-client.${ZITI_NAMESPACE}.svc.cluster.local"
151+
152+
_test_result=$(go test -v -count=1 -tags="quickstart manual" ./ziti/run/...)
153+
154+
# check for failure modes that don't result in an error exit code
155+
if [[ "${_test_result}" =~ "no tests to run" ]]
156+
then
157+
echo "ERROR: test failed because no tests to run"
158+
exit 1
159+
fi
154160

155161
cleanup

0 commit comments

Comments
 (0)