Skip to content

Commit

Permalink
fixup! Migrate device provisioning service
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielius1922 committed Sep 8, 2024
1 parent 46b7650 commit f215496
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 37 deletions.
33 changes: 21 additions & 12 deletions .github/workflows/docker-build-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@ concurrency:
cancel-in-progress: ${{ github.ref_name != 'master' }}

on:
# push:
# branches:
# - "master"
# tags:
# - "*"
# pull_request:
# branches:
# - master
push:
branches:
- "master"
tags:
- "*"
pull_request:
branches:
- master
workflow_dispatch:

env:
REGISTRY: ghcr.io
CLOUD_SERVER_BUILD_ARGS: -DOC_DEBUG_ENABLED=ON -DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_OSCORE_ENABLED=OFF -DOC_RESOURCE_ACCESS_IN_RFOTM_ENABLED=ON -DPLGD_DEV_TIME_ENABLED=ON -DOC_ETAG_ENABLED=ON -DOC_SOFTWARE_UPDATE_ENABLED=ON

jobs:
build-and-push-images:
Expand All @@ -31,20 +32,28 @@ jobs:
include:
- name: cloud-server
build_type: Release
build_args: ""
build_args: ${{ env.CLOUD_SERVER_BUILD_ARGS }}
file: docker/apps/Dockerfile.cloud-server
- name: cloud-server-debug
build_type: Debug
build_args: ""
build_args: ${{ env.CLOUD_SERVER_BUILD_ARGS }}
file: docker/apps/Dockerfile.cloud-server-debug
- name: cloud-server-discovery-resource-observable
build_type: Release
build_args: "-DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON"
build_args: ${{ env.CLOUD_SERVER_BUILD_ARGS }} -DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON
file: docker/apps/Dockerfile.cloud-server
- name: cloud-server-discovery-resource-observable-debug
build_type: Debug
build_args: "-DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON"
build_args: ${{ env.CLOUD_SERVER_BUILD_ARGS }} -DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON
file: docker/apps/Dockerfile.cloud-server-debug
- name: dps-cloud-server
build_type: Release
build_args:
file: docker/apps/Dockerfile.dps-cloud-server
- name: dps-cloud-server-debug
build_type: Debug
build_args: -DOC_DEBUG_ENABLED=ON -DOC_LOG_MAXIMUM_LOG_LEVEL=DEBUG -DPLGD_DEV_DEVICE_PROVISIONING_TEST_PROPERTIES_ENABLED=ON
file: docker/apps/Dockerfile.dps-cloud-server
uses: ./.github/workflows/docker-build-publish-with-cfg.yml
with:
name: ${{ matrix.name }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/doxygen-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ concurrency:
cancel-in-progress: ${{ github.ref_name != 'master' }}

on:
# push:
# branches: [master]
# pull_request:
# branches: [master]
# types: [closed]
push:
branches: [master]
pull_request:
branches: [master]
types: [closed]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/doxygen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ concurrency:
cancel-in-progress: ${{ github.ref_name != 'master' }}

on:
# push:
# branches: [master]
# pull_request:
# branches: [master]
push:
branches: [master]
pull_request:
branches: [master]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/plgd-dps-test-with-cfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
chmod -R 0777 "/tmp/data/coverage";
docker run --privileged -d --network=host --log-driver local
-v /tmp/data/certs/device:/device-provisioning-client/build/apps/pki_certs
-v /tmp/data/certs/device:/dps/pki_certs
-v /tmp/data/coverage:/data/coverage
--name dps-devsim
dps-dbg:latest
Expand All @@ -99,7 +99,7 @@ jobs:
- name: Run dps cloud server docker image for onboarding
run: >
docker run --privileged -d --network=host --log-driver local
-v /tmp/data/certs/device:/device-provisioning-client/build/apps/pki_certs
-v /tmp/data/certs/device:/dps/pki_certs
-v /tmp/data/coverage:/data/coverage
--name dps-devsim-obt
dps-dbg:latest
Expand Down
6 changes: 5 additions & 1 deletion api/plgd/device-provisioning-client/plgd_dps_endpoints.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
#include "plgd_dps_store_internal.h"

#include "oc_helpers.h"
#include "util/oc_endpoint_address.h"
#include "util/oc_endpoint_address_internal.h"
#include "util/oc_memb.h"
#include "util/oc_secure_string_internal.h"

#include <assert.h>
#include <string.h>
Expand Down Expand Up @@ -82,7 +84,9 @@ dps_set_endpoints(plgd_dps_context_t *ctx, const oc_string_t *selected_endpoint,
void
plgd_dps_set_endpoint(plgd_dps_context_t *ctx, const char *endpoint)
{
dps_set_endpoint(ctx, endpoint, strlen(endpoint), /* notify */ true);
size_t len = oc_strnlen(endpoint, OC_ENDPOINT_MAX_ENDPOINT_URI_LENGTH);
assert(len < OC_ENDPOINT_MAX_ENDPOINT_URI_LENGTH);
dps_set_endpoint(ctx, endpoint, len, /* notify */ true);
}

int
Expand Down
8 changes: 4 additions & 4 deletions docker/apps/Dockerfile.dps-cloud-server
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ FROM ubuntu:22.04 AS build
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends build-essential \
ca-certificates clang-15 cmake g++ gcc git python3 && \
apt-get clean
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 10 && \
apt-get clean && \
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 10 && \
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-15 10
ARG BUILD_TYPE=Release
ARG BUILD_ARGS=
Expand All @@ -15,8 +15,8 @@ RUN ls -l . && \
cd build && \
cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DOC_CLOUD_ENABLED=ON \
-DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_OSCORE_ENABLED=OFF -DPLGD_DEV_TIME_ENABLED=ON \
-DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON -DOC_DEBUG_ENABLED=ON -DPLGD_DEV_DEVICE_PROVISIONING_ENABLED=ON \
-DPLGD_DEV_DEVICE_PROVISIONING_TEST_PROPERTIES_ENABLED=ON ${BUILD_ARGS} .. && \
-DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON -DPLGD_DEV_DEVICE_PROVISIONING_ENABLED=ON \
${BUILD_ARGS} .. && \
cmake --build . --target mbedtls mbedx509 mbedcrypto && \
cmake --build . -j$(nproc) --target dps_cloud_server

Expand Down
15 changes: 9 additions & 6 deletions docker/apps/Dockerfile.dps-cloud-server-debug
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@ ARG BUILD_ARGS=
RUN mkdir /device-provisioning-client
COPY . /device-provisioning-client
RUN adduser nonroot && \
chown -R nonroot:nonroot /device-provisioning-client
chown -R nonroot:nonroot /device-provisioning-client && \
mkdir /dps && \
chown nonroot:nonroot /dps
USER nonroot
WORKDIR /device-provisioning-client
RUN mkdir build && cd build && \
RUN mkdir build && \
cd build && \
cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DOC_CLOUD_ENABLED=ON \
-DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_OSCORE_ENABLED=OFF -DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON \
-DOC_DEBUG_ENABLED=ON -DPLGD_DEV_TIME_ENABLED=ON -DPLGD_DEV_DEVICE_PROVISIONING_ENABLED=ON \
-DPLGD_DEV_DEVICE_PROVISIONING_TEST_PROPERTIES_ENABLED=ON -DBUILD_TESTING=ON ${BUILD_ARGS} .. && \
cmake --build . --target mbedtls mbedx509 mbedcrypto && \
cmake --build . -j$(nproc) --target dps_cloud_server

WORKDIR /device-provisioning-client/build/apps
ENTRYPOINT ["./dps_cloud_server"]
cmake --build . -j$(nproc) --target dps_cloud_server && \
cp /device-provisioning-client/build/apps/dps_cloud_server /dps/
WORKDIR /dps
ENTRYPOINT [ "./dps_cloud_server" ]
8 changes: 5 additions & 3 deletions tools/doxygen.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2239,8 +2239,6 @@ PREDEFINED = OC_API \
OC_HAS_FEATURE_PUSH \
OC_RESOURCE_ACCESS_IN_RFOTM \
OC_HAS_FEATURE_RESOURCE_ACCESS_IN_RFOTM \
PLGD_DEV_TIME \
OC_HAS_FEATURE_PLGD_TIME \
OC_ETAG \
OC_HAS_FEATURE_ETAG \
OC_HAS_FEATURE_ETAG_INCREMENTAL_CHANGES \
Expand All @@ -2249,7 +2247,11 @@ PREDEFINED = OC_API \
OC_SIMPLE_MAIN_LOOP \
OC_HAS_FEATURE_LOOP_EVENT \
OC_HAS_FEATURE_SIMPLE_MAIN_LOOP \
OC_HAS_FEATURE_ENDPOINT_ADDRESS_LIST
OC_HAS_FEATURE_ENDPOINT_ADDRESS_LIST \
PLGD_DEV_TIME \
OC_HAS_FEATURE_PLGD_TIME \
PLGD_DEV_DEVICE_PROVISIONING \
OC_HAS_FEATURE_PLGD_DEVICE_PROVISIONING

# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
Expand Down

0 comments on commit f215496

Please sign in to comment.