Welcome to Smee! We are really excited to have you. Please use the following guide on your contributing journey. Thanks for contributing!
Smee is a DHCP and PXE (TFTP & HTTP) service. It is part of the Tinkerbell stack and provides the first interaction for any machines being provisioned through Tinkerbell.
Details and diagrams for Smee are found here.
Details on Smee's code structure is found here (WIP)
Please read and understand the DCO found here.
Please read and understand the code of conduct found here.
At runtime Smee needs to communicate with a Tink server. Follow this guide for running Tink server.
At the moment, these instructions are only stable on Linux environments
To build Smee, run:
# build all ipxe files, embed them, and build the Go binary
# Built binary can be found in the top level directory.
make build
To build the amd64 Smee container image, run:
# make the amd64 container image
# Built image will be named smee:latest
make image
To build the IPXE binaries and embed them into Go, run:
# Note, this will not build the Smee binary
make bindata
To build Smee binaries for all distro
To execute the unit tests, run:
make test
# to get code coverage numbers, run:
make coverage
To execute linting, run:
# runs golangci-lint
make lint
# runs goimports
make goimports
# runs go vet
make vet
# lints non Go files like shell scripts, markdown files, etc
# this script is used in CI run, so be sure it passes before submitting a PR
./.github/workflows/ci-non-go.sh
- Create a hardware record in Tink server - follow the guide here
- boot the machine
-
Be sure all documented runtime dependencies are satisfied.
-
Define all environment variables.
# MIRROR_HOST is for downloading kernel, initrd export MIRROR_HOST=192.168.2.3 # PUBLIC_FQDN is for phone home endpoint export PUBLIC_FQDN=192.168.2.4 # DOCKER_REGISTRY, REGISTRY_USERNAME, REGISTRY_PASSWORD, TINKERBELL_GRPC_AUTHORITY, TINKERBELL_CERT_URL are needed for auto.ipxe file generation # TINKERBELL_GRPC_AUTHORITY, TINKERBELL_CERT_URL are needed for getting hardware data export DOCKER_REGISTRY=192.168.2.1:5000 export REGISTRY_USERNAME=admin export REGISTRY_PASSWORD=secret export TINKERBELL_GRPC_AUTHORITY=tinkerbell.tinkerbell:42113 export TINKERBELL_CERT_URL=http://tinkerbell.tinkerbell:42114/cert # FACILITY_CODE is needed for ? export FACILITY_CODE=onprem export DATA_MODEL_VERSION=1 # API_AUTH_TOKEN, API_CONSUMER_TOKEN are needed to by pass panicking in main.go main func export API_AUTH_TOKEN=none export API_CONSUMER_TOKEN=none
-
Run Smee
# Run the compiled smee sudo ./smee -http-addr 192.168.2.225:80 -tftp-addr 192.168.2.225:69 -dhcp-addr 192.168.2.225:67
-
Faster iterating via
go run
# after the ipxe binaries have been compiled you can use `go run` to iterate a little more quickly than building the binary every time sudo go run ./smee -http-addr 192.168.2.225:80 -tftp-addr 192.168.2.225:69 -dhcp-addr 192.168.2.225:67
Smee uses a fork and pull request model. See this doc for more details.
Smee uses GitHub Actions for CI. The workflow is found in .github/workflows/ci.yaml. It is run for each commit and PR.
Smee does run code coverage with each PR. Coverage thresholds are not currently enforced. It is always nice and very welcomed to add tests and keep or increase the code coverage percentage.
This checklist is a helper to make sure there's no gotchas that come up when you submit a PR.
- You've reviewed the code of conduct
- All commits are DCO signed off
- Code is formatted and linted
- Code builds successfully
- All tests are passing
- Code coverage percentage. (main line is the base with which to compare)