Skip to content
Closed
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
44 changes: 44 additions & 0 deletions example_context/config/CMCONF_FLEET_PROTOCOLConfig.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

# Example configuration for CMCONF system.
#

FIND_PACKAGE(CMLIB REQUIRED COMPONENTS CMCONF)

CMCONF_INIT_SYSTEM(FLEET_PROTOCOL)

#
# Setting using upstream Package Repository by default for this system. This can be overridden by
# App in CMakeLists.txt.
#
CMCONF_SET(BA_PACKAGE_LOCAL_USE OFF)
CMCONF_SET(BA_PACKAGE_LOCAL_PATH "")

#
# The http authorization header is usually used for accessing private Package Repositories. This
# example does not need it, but the variable must be set.
#
CMCONF_SET(BA_PACKAGE_HTTP_AUTHORIZATION_HEADER "")

#
# Setting BringAuto's Package Repository URI Template
#
CMCONF_SET(BA_PACKAGE_URI_REVISION master)
CMCONF_SET(BA_PACKAGE_URI_TEMPLATE_REMOTE "https://gitea.bringauto.com/fleet-protocol/package-repository/media/<REVISION>/package/<GIT_PATH>/<PACKAGE_GROUP_NAME>/<ARCHIVE_NAME>")

#
# Gitea hosted public Package Repository:
#
#CMCONF_SET(BA_PACKAGE_URI_TEMPLATE_REMOTE "https://gitea.example.com/username/repository/media/<REVISION>/package/<GIT_PATH>/<PACKAGE_GROUP_NAME>/<ARCHIVE_NAME>")

#
# Gitea hosted private Package Repository.
# Do not forget to specify Access Token
#
#CMCONF_SET(BA_PACKAGE_HTTP_AUTHORIZATION_HEADER "token <token>")
#CMCONF_SET(BA_PACKAGE_URI_TEMPLATE_REMOTE "https://gitea.example.com/username/repository/raw/<REVISION>/package/<GIT_PATH>/<PACKAGE_GROUP_NAME>/<ARCHIVE_NAME>")

#
# Gitlab hosted private Package Repository.
#
#CMCONF_SET(BA_PACKAGE_HTTP_AUTHORIZATION_HEADER "Bearer <token>")
#CMCONF_SET(BA_PACKAGE_URI_TEMPLATE_REMOTE "https://gitlab.example.com/username/repository/-/raw/<REVISION>/package/<GIT_PATH>/<PACKAGE_GROUP_NAME>/<ARCHIVE_NAME>")
17 changes: 17 additions & 0 deletions example_context/config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

# FLEET_PROTOCOL System Configuration

This directory contains the configuration file for FLEET_PROTOCOL [CMCONF] system. It is used to set
required variables for [Package Tracker]. The most important variable is
`BA_PACKAGE_URI_TEMPLATE_REMOTE`, which sets URI of Package Repository used during builds.

This system must be installed in all Docker images.

More information about this system can be found in [Package Tracker Example].

Using this system is an example and in general Context does not need to use it.


[Package Tracker]: https://github.com/bacpack-system/package-tracker
[Package Tracker Example]: https://github.com/bacpack-system/package-tracker/tree/master/example
[CMCONF]: https://github.com/cmakelib/cmakelib-component-cmconf
5 changes: 5 additions & 0 deletions example_context/docker/debian12/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ RUN echo "export CMLIB_DIR=/cmakelib" >> /root/.bashrc && \
echo "export CXX=/usr/local/bin/g++" >> /root/.bashrc && \
echo "export LD_LIBRARY_PATH=/usr/local/lib64" >> /root/.bashrc

# Install Fleet Protocol's CMCONF system
COPY --from=package-context config/CMCONF_FLEET_PROTOCOLConfig.cmake /etc
ENV CMLIB_DIR=/cmakelib
RUN cmake -DCMCONF_INSTALL_AS_SYMLINK=ON -P /etc/CMCONF_FLEET_PROTOCOLConfig.cmake

RUN sed -ri 's/#?PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN mkdir -p /run/sshd

Expand Down
5 changes: 5 additions & 0 deletions example_context/docker/fedora40/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ RUN dnf -y update && \
RUN git clone https://github.com/cmakelib/cmakelib.git /cmakelib
RUN echo "export CMLIB_DIR=/cmakelib" >> /root/.bashrc

# Install Fleet Protocol's CMCONF system
COPY --from=package-context config/CMCONF_FLEET_PROTOCOLConfig.cmake /etc
ENV CMLIB_DIR=/cmakelib
RUN cmake -DCMCONF_INSTALL_AS_SYMLINK=ON -P /etc/CMCONF_FLEET_PROTOCOLConfig.cmake

RUN sed -ri 's/#?PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN mkdir -p /run/sshd

Expand Down
5 changes: 5 additions & 0 deletions example_context/docker/fedora41/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ RUN dnf -y update && \
RUN git clone https://github.com/cmakelib/cmakelib.git /cmakelib
RUN echo "export CMLIB_DIR=/cmakelib" >> /root/.bashrc

# Install Fleet Protocol's CMCONF system
COPY --from=package-context config/CMCONF_FLEET_PROTOCOLConfig.cmake /etc
ENV CMLIB_DIR=/cmakelib
RUN cmake -DCMCONF_INSTALL_AS_SYMLINK=ON -P /etc/CMCONF_FLEET_PROTOCOLConfig.cmake

RUN sed -ri 's/#?PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN mkdir -p /run/sshd

Expand Down
5 changes: 5 additions & 0 deletions example_context/docker/fleet-os-2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ RUN chmod +x /root/init_toolchain.sh && \
COPY os-release /etc/os-release
COPY uname.txt /root/tools/

# Install Fleet Protocol's CMCONF system
COPY --from=package-context config/CMCONF_FLEET_PROTOCOLConfig.cmake /etc
ENV CMLIB_DIR=/cmakelib
RUN cmake -DCMCONF_INSTALL_AS_SYMLINK=ON -P /etc/CMCONF_FLEET_PROTOCOLConfig.cmake

RUN apt-get update && \
apt-get purge -y \
wget unzip && \
Expand Down
5 changes: 5 additions & 0 deletions example_context/docker/ubuntu2404/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ RUN apt-get purge -y \
RUN git clone https://github.com/cmakelib/cmakelib.git /cmakelib
RUN echo "export CMLIB_DIR=/cmakelib" >> /root/.bashrc

# Install Fleet Protocol's CMCONF system
COPY --from=package-context config/CMCONF_FLEET_PROTOCOLConfig.cmake /etc
ENV CMLIB_DIR=/cmakelib
RUN cmake -DCMCONF_INSTALL_AS_SYMLINK=ON -P /etc/CMCONF_FLEET_PROTOCOLConfig.cmake

RUN sed -ri 's/#?PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN mkdir -p /run/sshd

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"debian12",
"ubuntu2404",
"fedora40",
"fedora41"
"fedora41",
"fleet-os-2"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"debian12",
"ubuntu2404",
"fedora40",
"fedora41"
"fedora41",
"fleet-os-2"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"ubuntu1804-aarch64",
"ubuntu2404",
"fedora40",
"fedora41"
"fedora41",
"fleet-os-2"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"ubuntu1804-aarch64",
"ubuntu2404",
"fedora40",
"fedora41"
"fedora41",
"fleet-os-2"
]
}
}
53 changes: 53 additions & 0 deletions tests/integration_tests/test_build_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
is_tracked,
does_app_support_image,
clean_sysroot,
prepare_packages,
)

from test_utils.common import PackagerExpectedResult, PackagerReturnCode
Expand Down Expand Up @@ -147,3 +148,55 @@ def test_04_build_all_apps_when_port_1122_is_used(
pytest.skip("Port 1122 is already in use, skipping test")
finally:
sock.close()

def test_05_build_app_local_repo(test_image, packager_binary, context, test_repo):
"""Test building a single app using local Package Repository."""
app = "io-module"

if not does_app_support_image(app, test_image):
pytest.skip(f"App {app} does not support image {test_image}")

run_packager(
packager_binary,
"build-app",
context=context,
image_name=test_image,
output_dir=test_repo,
name=app,
use_local_repo=True,
expected_result=PackagerExpectedResult.FAILURE,
expected_returncode=(
PackagerReturnCode.BUILD_ERROR
if does_app_support_image(app, test_image)
else PackagerReturnCode.DEFAULT_ERROR
),
)
dep_packages = ["nlohmann-json", "zlib", "fleet-protocol-interface", "fleet-protocol-cpp"]
prepare_packages(dep_packages)
for package in dep_packages:
run_packager(
packager_binary,
"build-package",
context=context,
image_name=test_image,
output_dir=test_repo,
name=package,
expected_result=PackagerExpectedResult.SUCCESS,
)

run_packager(
packager_binary,
"build-app",
context=context,
image_name=test_image,
output_dir=test_repo,
name=app,
use_local_repo=True,
expected_result=PackagerExpectedResult.SUCCESS,
expected_returncode=(
PackagerReturnCode.SUCCESS
if does_app_support_image(app, test_image)
else PackagerReturnCode.DEFAULT_ERROR
),
)

5 changes: 3 additions & 2 deletions tests/test_data/example/app/io-module/io-module_debug.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"CMake": {
"Defines": {
"CMAKE_BUILD_TYPE": "Debug",
"BRINGAUTO_INSTALL": "ON"
"BRINGAUTO_INSTALL": "ON",
"FLEET_PROTOCOL_BUILD_EXTERNAL_SERVER": "OFF"
}
}
},
Expand All @@ -31,4 +32,4 @@
"fedora41"
]
}
}
}
5 changes: 3 additions & 2 deletions tests/test_data/example/app/io-module/io-module_release.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"CMake": {
"Defines": {
"CMAKE_BUILD_TYPE": "Release",
"BRINGAUTO_INSTALL": "ON"
"BRINGAUTO_INSTALL": "ON",
"FLEET_PROTOCOL_BUILD_EXTERNAL_SERVER": "OFF"
}
}
},
Expand All @@ -31,4 +32,4 @@
"fedora41"
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"Env": {},
"DependsOn": [
"fleet-protocol-interface"
],
"Git": {
"URI": "https://github.com/bringauto/fleet-protocol-cpp.git",
"Revision": "v1.1.1"
},
"Build": {
"CMake": {
"Defines": {
"CMAKE_BUILD_TYPE": "Debug",
"BRINGAUTO_INSTALL": "ON",
"BRINGAUTO_PACKAGE": "ON",
"BRINGAUTO_SYSTEM_DEP": "ON",
"BRINGAUTO_TESTS": "OFF"
}
}
},
"Package": {
"Name": "fleet-protocol-cpp",
"VersionTag": "v1.1.1",
"PlatformString": {
"Mode": "auto"
},
"IsLibrary": true,
"IsDevLib": true,
"IsDebug": true
},
"DockerMatrix": {
"ImageNames": [
"debian12",
"ubuntu2404",
"fedora40",
"fedora41",
"fleet-os-2"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"Env": {},
"DependsOn": [
"fleet-protocol-interface"
],
"Git": {
"URI": "https://github.com/bringauto/fleet-protocol-cpp.git",
"Revision": "v1.1.1"
},
"Build": {
"CMake": {
"Defines": {
"CMAKE_BUILD_TYPE": "Release",
"BRINGAUTO_INSTALL": "ON",
"BRINGAUTO_PACKAGE": "ON",
"BRINGAUTO_SYSTEM_DEP": "ON",
"BRINGAUTO_TESTS": "OFF"
}
}
},
"Package": {
"Name": "fleet-protocol-cpp",
"VersionTag": "v1.1.1",
"PlatformString": {
"Mode": "auto"
},
"IsLibrary": true,
"IsDevLib": true,
"IsDebug": false
},
"DockerMatrix": {
"ImageNames": [
"debian12",
"ubuntu2404",
"fedora40",
"fedora41",
"fleet-os-2"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"Env": {},
"DependsOn": [],
"Git": {
"URI": "https://github.com/bringauto/fleet-protocol.git",
"Revision": "v2.0.0"
},
"Build": {
"CMake": {
"Defines": {
"CMAKE_BUILD_TYPE": "Debug",
"BRINGAUTO_INSTALL": "ON",
"BRINGAUTO_PACKAGE": "ON",
"BRINGAUTO_SYSTEM_DEP": "ON",
"BRINGAUTO_SAMPLES": "OFF"
}
}
},
"Package": {
"Name": "fleet-protocol-interface",
"VersionTag": "v2.0.0",
"PlatformString": {
"Mode": "auto"
},
"IsLibrary": true,
"IsDevLib": true,
"IsDebug": true
},
"DockerMatrix": {
"ImageNames": [
"debian12",
"ubuntu1804-aarch64",
"ubuntu2404",
"fedora40",
"fedora41",
"fleet-os-2"
]
}
}
Loading