Skip to content

Commit 93df17c

Browse files
committed
Build containers and test onboarding
Signed-off-by: Miguel Martín <mmartinv@redhat.com>
1 parent fce5179 commit 93df17c

5 files changed

Lines changed: 139 additions & 0 deletions

File tree

.github.qkg1.toppose/client.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
include:
2+
- networks.yaml
3+
services:
4+
fdo_client:
5+
container_name: fdo_client
6+
hostname: fdo_client
7+
image: fdo_client
8+
#build: https://github.com/fido-device-onboard/go-fdo-client.git#main
9+
build: https://github.com/mmartinv/go-fdo-client.git#build-enhacements
10+
networks:
11+
- fdo
12+
restart: no

.github.qkg1.toppose/networks.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
networks:
2+
fdo:
3+
name: fdo
4+
driver: bridge

.github.qkg1.toppose/servers.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
include:
2+
- networks.yaml
3+
services:
4+
manufacturer:
5+
container_name: manufacturer
6+
hostname: manufacturer
7+
image: manufacturer
8+
build: ../..
9+
environment:
10+
TZ: Europe/Madrid
11+
ports:
12+
- 8038:8038
13+
command: --db=/tmp/sqlite.db --db-pass '2=,%95QF<uTLLHt' --debug serve manufacturer:8038
14+
networks:
15+
- fdo
16+
restart: unless-stopped
17+
healthcheck:
18+
test: [ "CMD", "curl --silent --output /dev/null --fail http://manufacturer:8038/health" ]
19+
interval: 5s
20+
timeout: 30s
21+
retries: 5
22+
start_period: 5s
23+
24+
rendezvous:
25+
container_name: rendezvous
26+
hostname: rendezvous
27+
image: rendezvous
28+
build: ../..
29+
environment:
30+
TZ: Europe/Madrid
31+
ports:
32+
- 8041:8041
33+
command: --db=/tmp/sqlite.db --db-pass '2=,%95QF<uTLLHt' --debug serve rendezvous:8041
34+
networks:
35+
- fdo
36+
restart: unless-stopped
37+
healthcheck:
38+
test: [ "CMD", "curl --silent --output /dev/null --fail http://rendezvous:8041/health" ]
39+
interval: 5s
40+
timeout: 30s
41+
retries: 5
42+
start_period: 5s
43+
44+
owner:
45+
container_name: owner
46+
hostname: owner
47+
image: owner
48+
build: ../..
49+
environment:
50+
TZ: Europe/Madrid
51+
ports:
52+
- 8043:8043
53+
command: --db=/tmp/sqlite.db --db-pass '2=,%95QF<uTLLHt' --debug serve owner:8043
54+
networks:
55+
- fdo
56+
restart: unless-stopped
57+
healthcheck:
58+
test: [ "CMD", "curl --silent --output /dev/null --fail http://owner:8043/health" ]
59+
interval: 5s
60+
timeout: 30s
61+
retries: 5
62+
start_period: 5s

.github/scripts/container-utils.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#! /bin/bash
2+
3+
set -xeuo pipefail
4+
shopt -s expand_aliases
5+
6+
alias go-fdo-client="docker run --rm --volume /tmp/device-credentials:/tmp/device-credentials --network fdo --workdir /tmp/device-credentials go-fdo-client"
7+
8+
source "$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/fdo-utils.sh"
9+
10+
rendezvous_ip="$(docker inspect --format='{{json .NetworkSettings.Networks}}' "rendezvous" | jq -r '.[]|.IPAddress')"
11+
12+
get_server_logs() {
13+
docker logs manufacturer
14+
docker logs rendezvous
15+
docker logs owner
16+
}
17+
18+
run_services () {
19+
return
20+
}
21+
22+
install_client() {
23+
return
24+
}

.github/workflows/ci.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,40 @@ jobs:
4040
run: |
4141
source .github/scripts/fdo-utils.sh
4242
get_server_logs
43+
44+
test-container:
45+
name: Build and test onboarding (containers)
46+
runs-on: ubuntu-latest
47+
steps:
48+
49+
- name: Check out repository code
50+
uses: actions/checkout@v4
51+
52+
- name: Build and spawn FDO server containers
53+
id: build-and-run-servers
54+
uses: hoverkraft-tech/compose-action@v2.3.0
55+
with:
56+
compose-file: ".github.qkg1.toppose/servers.yaml"
57+
services-log-level: debug
58+
up-flags: "--build"
59+
60+
- name: Make sure there are no changes after build
61+
uses: NathanielHill/fail-if-changes@master
62+
63+
- name: Build and install 'go-fdo-client'
64+
uses: hoverkraft-tech/compose-action@v2.3.0
65+
with:
66+
compose-file: ".github.qkg1.toppose/client.yaml"
67+
services-log-level: debug
68+
up-flags: "--build --no-start"
69+
70+
- name: Test FIDO Device Onboarding
71+
run: |
72+
source .github/scripts/container-utils.sh
73+
test_onboarding
74+
75+
- name: Get Manufacturer, Rendezvous and Owner server logs after a failed onboarding
76+
if: failure() && steps.build-and-run-servers.outcome == 'success'
77+
run: |
78+
source .github/scripts/container-utils.sh
79+
get_server_logs

0 commit comments

Comments
 (0)