Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actually fix the CI workflow #79

Merged
merged 1 commit into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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