Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 92 additions & 34 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ variables:
DOCKER_CLI_EXPERIMENTAL: enabled
CMAKE_BUILD_OPTS: "--parallel 16"
CMAKE_EXTRA_OPTS: "-DCMAKE_BUILD_TYPE=Release -DVILLAS_COMPILE_WARNING_AS_ERROR=ON"
CACHIX_CACHE_NAME: villas

stages:
- prepare
Expand All @@ -21,9 +22,41 @@ stages:
- deploy
- latest

# Anchors

.nix: &nix
image: docker.nix-community.org/nixpkgs/cachix-flakes

parallel:
matrix:
- SYSTEM: [x86_64-linux, aarch64-linux]

before_script:
- cachix use "$CACHIX_CACHE_NAME"

.nix_packaging: &nix_packaging
<<: *nix

stage: packaging
needs:
- job: build:nix
parallel:
matrix:
- SYSTEM: [x86_64-linux, aarch64-linux]

.nix_packaging_artifacts: &nix_packaging_artifacts
<<: *nix_packaging

artifacts:
when: on_success
access: all
expire_in: "1 year"
paths:
- artifacts/*

# Stage: prepare

# Build docker image which is used to build & test VILLASnode
# Build Docker image which is used to build & test VILLASnode
prepare:docker:
stage: prepare
before_script:
Expand Down Expand Up @@ -88,42 +121,16 @@ build:source:
-DCMAKE_PREFIX_PATH=/usr/local

build:nix:
<<: *nix

stage: build
image: docker.nix-community.org/nixpkgs/cachix-flakes
needs: []
variables:
CACHIX_CACHE_NAME: villas

parallel:
matrix:
- SYSTEM: [x86_64-linux, aarch64-linux]

artifacts:
when: on_success
access: all
expire_in: "1 year"
paths:
- artifacts/*

before_script:
- cachix use "$CACHIX_CACHE_NAME"

- | # Create directories
mkdir -p artifacts /var/tmp/

- | # Login at Docker registry
nix run nixpkgs#skopeo -- login \
--username ${CI_REGISTRY_USER} \
--password ${CI_REGISTRY_PASSWORD} \
${CI_REGISTRY}

script:
- cachix watch-exec $CACHIX_CACHE_NAME -- nix build --print-build-logs ".#villas-node-${SYSTEM}"
- cachix watch-exec $CACHIX_CACHE_NAME -- nix bundle --print-build-logs --out-link bundle ".#villas-node-${SYSTEM}"
- cachix watch-exec $CACHIX_CACHE_NAME -- nix build --print-build-logs --out-link docker ".#dockerImage-${SYSTEM}"

- cp -L bundle artifacts/villas-${SYSTEM}
- nix run nixpkgs#skopeo -- --tmpdir=${TMPDIR} --insecure-policy copy "docker-archive:./docker" "docker://${DOCKER_IMAGE}:${DOCKER_TAG}-nix-${SYSTEM}"
- cachix watch-exec $CACHIX_CACHE_NAME --
nix build
--print-build-logs
".#villas-node-${SYSTEM}"

# Stage: test

Expand Down Expand Up @@ -207,6 +214,7 @@ test:reuse:

pkg:docker:
stage: packaging
needs: []
before_script:
- docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
script:
Expand Down Expand Up @@ -236,7 +244,57 @@ pkg:docker:
ARCH: arm64
TRIPLET: aarch64-linux-gnu
TAG: pi5
needs: []

pkg:nix:arx:
<<: *nix_packaging_artifacts

script:
- cachix watch-exec $CACHIX_CACHE_NAME --
nix bundle
--print-build-logs
--out-link bundle-arx
--bundler github:NixOS/bundlers#toArx
".#villas-node-${SYSTEM}"

- mkdir -p artifacts
- cp -L bundle-arx artifacts/villas-${SYSTEM}

pkg:nix:rpm:
<<: *nix_packaging_artifacts

script:
- cachix watch-exec $CACHIX_CACHE_NAME --
nix bundle
--print-build-logs
--out-link bundle-rpm
--bundler github:NixOS/bundlers#toRPM
".#villas-node-${SYSTEM}"

- mkdir -p artifacts
- cp -L bundle-rpm/*.rpm artifacts/villas-${SYSTEM}.rpm

pkg:nix:docker:
<<: *nix_packaging

script:
- mkdir -p /var/tmp/
- cachix watch-exec $CACHIX_CACHE_NAME --
nix bundle
--print-build-logs
--out-link bundle-docker
--bundler github:NixOS/bundlers#toDockerImage
".#villas-node-${SYSTEM}"

- nix run nixpkgs#skopeo --
login
--username ${CI_REGISTRY_USER}
--password ${CI_REGISTRY_PASSWORD}
${CI_REGISTRY}

- nix run nixpkgs#skopeo --
--tmpdir=${TMPDIR}
--insecure-policy
copy "docker-archive:./bundle-docker" "docker://${DOCKER_IMAGE}:${DOCKER_TAG}-nix-${SYSTEM}"

# Stage: deploy

Expand Down
8 changes: 4 additions & 4 deletions lib/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,14 +289,14 @@ int Node::read(struct Sample *smps[], unsigned cnt) {
if (stats != nullptr)
stats->update(Stats::Metric::SMPS_SKIPPED, skipped);

logger->debug("Received {} samples of which {} have been skipped", nread,
logger->trace("Received {} samples of which {} have been skipped", nread,
skipped);
} else
logger->debug("Received {} samples", nread);
logger->trace("Received {} samples", nread);

return rread;
#else
logger->debug("Received {} samples", nread);
logger->trace("Received {} samples", nread);

return nread;
#endif // WITH_HOOKS
Expand Down Expand Up @@ -330,7 +330,7 @@ int Node::write(struct Sample *smps[], unsigned cnt) {
return sent;

nsent += sent;
logger->debug("Sent {} samples", sent);
logger->trace("Sent {} samples", sent);
}

return nsent;
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/can.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ int villas::node::can_read(NodeCompat *n, struct Sample *const smps[],
if (!found_id)
throw RuntimeError("Did not find signal for can id {}", frame.can_id);

n->logger->debug("Received {} signals", c->sample_buf_num);
n->logger->trace("Received {} signals", c->sample_buf_num);

// Copy signal data to sample only when all signals have been received
if (c->sample_buf_num == n->getInputSignals(false)->size()) {
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/infiniband.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ int villas::node::ib_read(NodeCompat *n, struct Sample *const smps[],
// Get time directly after something arrived in Completion Queue
ts_receive = time_now();

n->logger->debug("Received {} Work Completions", wcs);
n->logger->trace("Received {} Work Completions", wcs);

read_values = wcs; // Value to return
max_wr_post = wcs; // Make space free in smps[]
Expand Down
12 changes: 8 additions & 4 deletions lib/nodes/webrtc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ WebRTCNode::WebRTCNode(const uuid_t &id, const std::string &name)
dci.reliability.maxRetransmits = 0;
dci.reliability.unordered = true;
#endif

rtcConf.enableIceTcp = true;
}

WebRTCNode::~WebRTCNode() {
Expand Down Expand Up @@ -110,8 +112,6 @@ int WebRTCNode::parse(json_t *json) {

if (tcp > 0)
rtcConf.enableIceTcp = tcp > 0;
else
rtcConf.enableIceTcp = true;
}
}

Expand Down Expand Up @@ -185,8 +185,12 @@ std::vector<int> WebRTCNode::getPollFDs() {
}

const std::string &WebRTCNode::getDetails() {
// TODO
details = fmt::format("");
details = fmt::format("session={}, server={}, peer={}, wait_seconds={}, "
"max_retransmits={}, ordered={}, ice.tcp={}, ",
session, server, peer, wait_seconds,
*dci.reliability.maxRetransmits,
dci.reliability.unordered, rtcConf.enableIceTcp);

return details;
}

Expand Down
11 changes: 9 additions & 2 deletions lib/nodes/webrtc/peer_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ void PeerConnection::onSignalingDisconnected() {
}

void PeerConnection::onSignalingError(std::string err) {
logger->debug("Signaling connection error: {}", err);
logger->error("Signaling connection error: {}", err);

auto lock = std::unique_lock{mutex};

Expand All @@ -281,12 +281,19 @@ void PeerConnection::onSignalingMessage(SignalingMessage msg) {

std::visit(
villas::utils::overloaded{
[&](RelayMessage &c) { extraServers = std::move(c.servers); },
[&](RelayMessage &c) {
for (auto &server : c.servers) {
logger->debug("Received ICE server: {}", server.hostname);
}

extraServers = std::move(c.servers);
},

[&](ControlMessage &c) {
auto const &id = c.peerID;

if (c.peers.size() < 2) {
logger->warn("Not enough peers connected. Waiting for more.");
resetConnectionAndStandby(lock);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/nodes/websocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ int villas::node::websocket_protocol_cb(struct lws *wsi,
if (ret < 0)
return ret;

c->node->logger->debug("Send {} samples to connection: {}, bytes={}",
c->node->logger->trace("Sent {} samples to connection: {}, bytes={}",
pulled, c->toString(), ret);
}

Expand Down Expand Up @@ -317,7 +317,7 @@ int villas::node::websocket_protocol_cb(struct lws *wsi,
break;
}

c->node->logger->debug("Received {} samples from connection: {}", recvd,
c->node->logger->trace("Received {} samples from connection: {}", recvd,
c->toString());

// Set receive timestamp
Expand Down
6 changes: 3 additions & 3 deletions lib/path_destination.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void PathDestination::enqueueAll(Path *p, const struct Sample *const smps[],
// Increase reference counter of these samples as they are now also owned by the queue
sample_incref_many(clones, cloned);

p->logger->debug("Enqueued {} samples to destination {} of path {}",
p->logger->trace("Enqueued {} samples to destination {} of path {}",
enqueued, pd->node->getName(), p->toString());
}

Expand All @@ -78,7 +78,7 @@ void PathDestination::write() {
"Queue underrun for path {}: allocated={} expected={}",
path->toString(), allocated, cnt);

path->logger->debug(
path->logger->trace(
"Dequeued {} samples from queue of node {} which is part of path {}",
allocated, node->getName(), path->toString());

Expand All @@ -93,7 +93,7 @@ void PathDestination::write() {

int released = sample_decref_many(smps, allocated);

path->logger->debug("Released {} samples back to memory pool", released);
path->logger->trace("Released {} samples back to memory pool", released);
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/path_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ int PathSource::read(int i) {
} else if (toenqueue != tomux) {
int skipped = tomux - toenqueue;

path->logger->debug("Hooks skipped {} out of {} samples for path {}",
path->logger->trace("Hooks skipped {} out of {} samples for path {}",
skipped, tomux, path->toString());
}
#else
Expand Down