Skip to content

Commit

Permalink
Actually fix the CI workflow (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
dtantsur authored Mar 9, 2023
1 parent 487e02c commit 47a8344
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 11 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,14 @@ 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

- 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
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
17 changes: 17 additions & 0 deletions hack/collect_logs.sh
Original file line number Diff line number Diff line change
@@ -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
28 changes: 24 additions & 4 deletions hack/local_ironic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 47a8344

Please sign in to comment.