diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c8a26e9c..7a331f04 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: go-version: 1.19 - name: Install dependencies - run: sudo apt-get install -y genisoimage docker netcat + run: sudo apt-get install -y genisoimage podman netcat - name: Start Ironic and Inspector run: ./hack/local_ironic.sh @@ -41,10 +41,6 @@ jobs: - name: Run tests run: make acceptance - - name: Collect Ironic logs + - name: Collect logs if: always() - run: docker logs ironic - - - name: Collect Inspector logs - if: always() - run: docker logs inspector + run: ./hack/collect_logs.sh diff --git a/Makefile b/Makefile index 38a59950..3ccbf5c9 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ LDFLAGS += -X main.version=$$(git describe --always --abbrev=40 --dirty) TEST?=$$(go list ./... |grep -v 'vendor') PKG_NAME=ironic TERRAFORM_PLUGINS=$(HOME)/.terraform.d/plugins +GOPATH?=$$(go env GOPATH) ifeq ("$(IRONIC_ENDPOINT)", "") IRONIC_ENDPOINT := http://127.0.0.1:6385/ diff --git a/hack/collect_logs.sh b/hack/collect_logs.sh new file mode 100755 index 00000000..8229c54d --- /dev/null +++ b/hack/collect_logs.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +set -xe + +if $(which podman > /dev/null 2>&1); then + CONTAINER_RUNTIME=podman +else + CONTAINER_RUNTIME=docker +fi + +set +x + +echo "******************** IRONIC LOGS ********************" +sudo $CONTAINER_RUNTIME logs ironic || true +echo +echo "******************* INSPECTOR LOGS ******************" +sudo $CONTAINER_RUNTIME logs ironic-inspector || true diff --git a/hack/local_ironic.sh b/hack/local_ironic.sh index fedac13b..ca8eafd0 100755 --- a/hack/local_ironic.sh +++ b/hack/local_ironic.sh @@ -8,11 +8,31 @@ else CONTAINER_RUNTIME=docker fi +IMAGE=${IMAGE:-quay.io/metal3-io/ironic:main} + sudo $CONTAINER_RUNTIME run -d --net host --privileged --name ironic \ - --entrypoint /bin/runironic -e "PROVISIONING_IP=127.0.0.1" quay.io/metal3-io/ironic:master + --entrypoint /bin/runironic -e "PROVISIONING_IP=127.0.0.1" $IMAGE sudo $CONTAINER_RUNTIME run -d --net host --privileged --name ironic-inspector \ - -e "PROVISIONING_IP=127.0.0.1" quay.io/metal3-io/ironic-inspector:master + --entrypoint /bin/runironic-inspector -e "PROVISIONING_IP=127.0.0.1" $IMAGE + +for attempt in {1..30}; do + sleep 2 + + if ! curl -I http://127.0.0.1:6385; then + if [[ $attempt == 30 ]]; then + exit 1 + else + continue + fi + fi + + if ! curl -I http://127.0.0.1:5050; then + if [[ $attempt == 30 ]]; then + exit 1 + else + continue + fi + fi -for p in 6385 5050; do - nc -z -w 60 127.0.0.1 ${p} + break done