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

Update fork. #3

Merged
merged 4 commits into from
Jul 18, 2020
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
93 changes: 93 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#
# Copyright (c) 2020, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#

name: Docker

on: [push, pull_request]

jobs:

cancel-previous-runs:
runs-on: ubuntu-latest
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/master'"

buildx:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set up Docker Buildx
uses: crazy-max/ghaction-docker-buildx@v3
- name: Prepare
id: prepare
run: |
DOCKER_IMAGE=openthread/otbr
DOCKER_PLATFORMS=linux/amd64,linux/arm/v7,linux/arm64
VERSION=latest

TAGS="--tag ${DOCKER_IMAGE}:${VERSION}"

echo ::set-output name=docker_image::${DOCKER_IMAGE}
echo ::set-output name=version::${VERSION}
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
--build-arg VERSION=${VERSION} \
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
--build-arg VCS_REF=${GITHUB_SHA::8} \
${TAGS} --file etc/docker/Dockerfile .

- name: Docker Buildx (build)
run: |
docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }}

- name: Docker Login
if: success() && github.repository == 'openthread/ot-br-posix' && github.event_name != 'pull_request'
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin

- name: Docker Buildx (push)
if: success() && github.repository == 'openthread/ot-br-posix' && github.event_name != 'pull_request'
run: |
docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }}

- name: Docker Check Manifest
if: always() && github.repository == 'openthread/ot-br-posix' && github.event_name != 'pull_request'
run: |
docker run --rm mplatform/mquery ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}

- name: Clear
if: always() && github.repository == 'openthread/ot-br-posix' && github.event_name != 'pull_request'
run: |
rm -f ${HOME}/.docker/config.json
10 changes: 7 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ cmake_minimum_required(VERSION 3.10.2)
project(openthread-br VERSION 0.2.0)


add_library(otbr-config INTERFACE)

option(OTBR_DBUS "Build DBus support" OFF)
option(OTBR_OPENWRT "Build OpenWrt support" OFF)
option(OTBR_UNSECURE_JOIN "Enable unsecure joining" OFF)
Expand All @@ -50,8 +52,8 @@ set(CMAKE_CXX_EXTENSIONS OFF)

if (OTBR_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
message(STATUS "Coverage: ON")
add_compile_options(-g -O0 --coverage)
add_link_options(--coverage)
target_compile_options(otbr-config INTERFACE -g -O0 --coverage)
target_link_libraries(otbr-config INTERFACE --coverage)
endif()

add_compile_options(-Wall -Wextra -Werror -Wfatal-errors -Wno-missing-braces)
Expand All @@ -72,7 +74,6 @@ endif()
message(STATUS "Version: ${OTBR_VERSION}")


add_library(otbr-config INTERFACE)
target_include_directories(otbr-config INTERFACE
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/src
Expand All @@ -82,6 +83,9 @@ target_compile_definitions(otbr-config INTERFACE
"OTBR_PACKAGE_VERSION=\"${OTBR_VERSION}\""
)

if(BUILD_SHARED_LIBS)
target_link_libraries(otbr-config INTERFACE -Wl,--unresolved-symbols=ignore-in-shared-libs)
endif()

find_package(PkgConfig)
include(GNUInstallDirs)
Expand Down
3 changes: 2 additions & 1 deletion etc/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# POSSIBILITY OF SUCH DAMAGE.
#

FROM ubuntu
FROM ubuntu:bionic


ARG OTBR_OPTIONS
Expand All @@ -35,6 +35,7 @@ ENV PLATFORM ubuntu
ENV RELEASE 1
ENV NAT64 1
ENV DNS64 1
ENV DOCKER 1

COPY . /app
WORKDIR /app
Expand Down
12 changes: 9 additions & 3 deletions script/_dns64
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ dns64_install()

service_name="$(_detect_service_name)"

[ -f /.dockerenv ] || sudo sh -c "echo \"nameserver $DNS64_NAMESERVER_ADDR\" >> $RESOLV_CONF_HEAD"
if without DOCKER; then
sudo sh -c "echo \"nameserver $DNS64_NAMESERVER_ADDR\" >> $RESOLV_CONF_HEAD"
fi

if have systemctl; then
sudo systemctl stop dnsmasq || true
Expand All @@ -92,7 +94,9 @@ dns64_install()
sudo systemctl start "${service_name}" || die 'Failed to start bind9!'
fi

[ -f /.dockerenv ] || dns64_update_resolvconf
if without DOCKER; then
dns64_update_resolvconf
fi
}

dns64_uninstall()
Expand All @@ -112,7 +116,9 @@ dns64_uninstall()

sudo sed -i '/^nameserver '$DNS64_NAMESERVER_ADDR'/d' $RESOLV_CONF_HEAD || true

[ -f /.dockerenv ] || dns64_update_resolvconf
if without DOCKER; then
dns64_update_resolvconf
fi

if have systemctl; then
sudo systemctl stop "${service_name}" || true
Expand Down
4 changes: 2 additions & 2 deletions script/_nat64
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ nat64_start()
{
with NAT64 || return 0

if [ -f /.dockerenv ]; then
if with DOCKER; then
service tayga start || die 'Failed to start tayga'
elif have systemctl; then
sudo systemctl start tayga || die 'Failed to start tayga!'
Expand All @@ -164,7 +164,7 @@ nat64_stop()
{
with NAT64 || return 0

if [ -f /.dockerenv ]; then
if with DOCKER; then
service tayga stop || true
elif have systemctl; then
sudo systemctl stop tayga || true
Expand Down
4 changes: 3 additions & 1 deletion script/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ install_packages_apt()
without DNS64 || {
sudo apt-get install --no-install-recommends -y bind9
# Resolvconf cannot be installed inside docker environment
[ -f /.dockerenv ] || sudo apt-get install --no-install-recommends -y resolvconf
if without DOCKER; then
sudo apt-get install --no-install-recommends -y resolvconf
fi
}

# network-manager
Expand Down
2 changes: 1 addition & 1 deletion src/dbus/server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ file(WRITE introspect.hpp "R\"INTROSPECT(")
file(APPEND introspect.hpp ${OTBR_DBUS_INTROSPECT})
file(APPEND introspect.hpp ")INTROSPECT\"")

add_library(otbr-dbus-server
add_library(otbr-dbus-server STATIC
dbus_agent.cpp
dbus_object.cpp
dbus_thread_object.cpp
Expand Down