Skip to content

Commit ccce9bb

Browse files
committed
[MOS-724] CodeQL setup
added CodeQL setup, small fixes to CI
1 parent cf1ec5d commit ccce9bb

File tree

11 files changed

+69
-15
lines changed

11 files changed

+69
-15
lines changed

Target_Linux.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ option (LINUX_ENABLE_SANITIZER "Enable address sanitizer for Linux" ON)
1313
if (LINUX_ENABLE_SANITIZER)
1414
add_compile_options(-fsanitize=address)
1515
add_link_options(-fsanitize=address)
16+
add_link_options(-pthread)
1617
endif (LINUX_ENABLE_SANITIZER)
1718

1819
set(CMAKE_STRIP strip CACHE INTERNAL "")

build_all_dockers.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
set -ex
3+
4+
REPO_PATH="/home/bartek/MuditaOS"
5+
DST_VERSION=1.17
6+
7+
./config/build_runner_docker
8+
docker build ${REPO_PATH}/docker -f ${REPO_PATH}/docker/Dockerfile -t "wearemudita/mudita_os_builder:${DST_VERSION}"
9+
docker tag "wearemudita/mudita_os_builder:${DST_VERSION}" wearemudita/mudita_os_builder:latest
10+
docker push "wearemudita/mudita_os_builder:${DST_VERSION}"
11+
docker push wearemudita/mudita_os_builder:latest
12+
13+
docker build ${REPO_PATH}/docker/jenkins-docker -f ${REPO_PATH}/docker/jenkins-docker/Dockerfile -t "wearemudita/mudita_os_jenkins_slave:${DST_VERSION}"
14+
docker tag "wearemudita/mudita_os_jenkins_slave:${DST_VERSION}" wearemudita/mudita_os_jenkins_slave:latest
15+
docker push "wearemudita/mudita_os_jenkins_slave:${DST_VERSION}"
16+
docker push wearemudita/mudita_os_jenkins_slave:latest

config/bootstrap_config

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11

22
# configuration variables used by bootstrap and dockerbuilder
33
# ARM_GCC="gcc-arm-none-eabi-9-2020-q2-update"
4-
ARM_GCC="gcc-arm-none-eabi-10-2020-q4-major"
4+
ARM_VERSION="10-2020-q4-major"
5+
ARM_GCC="gcc-arm-none-eabi-${ARM_VERSION}"
56
ARM_GCC_PKG="${ARM_GCC}-x86_64-linux.tar.bz2"
6-
ARM_GCC_SOURCE_LINK="https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2?revision=ca0cbf9c-9de2-491c-ac48-898b5bbc0443&la=en&hash=68760A8AE66026BCF99F05AC017A6A50C6FD832A"
7+
#ARM_GCC_SOURCE_LINK="https://developer.arm.com/-/media/Files/downloads/gnu-rm/${ARM_VERSION}/${ARM_GCC_PKG}?revision=ca0cbf9c-9de2-491c-ac48-898b5bbc0443&la=en&hash=68760A8AE66026BCF99F05AC017A6A50C6FD832A"
8+
ARM_GCC_SOURCE_LINK="https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/${ARM_GCC_PKG}?revision=ca0cbf9c-9de2-491c-ac48-898b5bbc0443&la=en&hash=68760A8AE66026BCF99F05AC017A6A50C6FD832A"
79
ARM_GCC_PATH_VAR="${ARM_GCC//-/_}"
8-
ARM_GCC_MD5="8312c4c91799885f222f663fc81f9a31"
10+
ARM_GCC_MD5="2383e4eb4ea23f248d33adc70dc3227e"
11+
12+
CODEQL_VERSION="2.11.1"
13+
CODEQL_NAME="codeql-linux64"
14+
CODEQL_PKG="${CODEQL_NAME}.zip"
15+
CODEQL_SOURCE_LINK="https://github.com/github/codeql-cli-binaries/releases/download/v${CODEQL_VERSION}/${CODEQL_PKG}"
916

1017
CMAKE_VERSION="3.21.3"
1118
CMAKE_NAME="cmake-${CMAKE_VERSION}-linux-x86_64"

config/build_runner_docker

+11
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ source ${SRC_ROOT}/config/bootstrap_config
88

99
DOCKER_DIR=${SRC_ROOT}/docker
1010
DOCKER_TEMPLATE=${DOCKER_DIR}/Dockerfile.runner.in
11+
JENKINS_DOCKER_TEMPLATE=${DOCKER_DIR}/jenkins-docker/Dockerfile-jenkins.runner.in
1112
DOCKER_TIMEZONE="Europe/Warsaw"
1213
DOCKER_IMAGE_NAME="wearemudita/mudita_os_builder"
1314
DOCKER_IMAGE_TAG="latest"
@@ -19,10 +20,18 @@ function prepareDockerFile() {
1920
-e "s#@CMAKE_PKG@#${CMAKE_PKG}#g" \
2021
-e "s#@CMAKE_NAME@#${CMAKE_NAME}#g" \
2122
-e "s#@ARM_GCC@#${ARM_GCC}#g;" \
23+
-e "s#@CODEQL_PKG@#${CODEQL_PKG}#g" \
2224
-e "s#@DOCKER_TIMEZONE@#${DOCKER_TIMEZONE}#g;" \
2325
-e "s#@INSTALL_PACKAGES@#${INSTALL_PACKAGES}#g;" \
2426
-e "s#@ENTRYPOINT@#${ENTRYPOINT}#g;" \
2527
-s ${DOCKER_TEMPLATE} > ${DOCKER_DEST}
28+
29+
sed -e "s#@ARM_GCC_PKG@#${ARM_GCC_PKG}#g" \
30+
-e "s#@CMAKE_PKG@#${CMAKE_PKG}#g" \
31+
-e "s#@CMAKE_NAME@#${CMAKE_NAME}#g" \
32+
-e "s#@ARM_GCC@#${ARM_GCC}#g;" \
33+
-e "s#@CODEQL_PKG@#${CODEQL_PKG}#g" \
34+
-s ${JENKINS_DOCKER_TEMPLATE} > ${JENKINS_DOCKER_DEST}
2635
}
2736

2837
function help() {
@@ -45,6 +54,8 @@ case ${1} in
4554
*)
4655
ENTRYPOINT="entrypoint.sh"
4756
DOCKER_DEST=${DOCKER_DIR}/Dockerfile
57+
JENKINS_DOCKER_DEST=${DOCKER_DIR}/jenkins-docker/Dockerfile
58+
4859
;;
4960
esac
5061

config/common_scripts_lib

100755100644
+4
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ function getArmCC() {
2121
function getCMake() {
2222
wget --no-verbose --show-progress -O ${CMAKE_PKG} ${CMAKE_SOURCE_LINK}
2323
}
24+
25+
function getCodeQL() {
26+
wget --no-verbose --show-progress -O ${CODEQL_PKG} ${CODEQL_SOURCE_LINK}
27+
}

config/download_assets

+6
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,14 @@ function getPythonReq() {
4141
cat ${DEST_PYREQ_TMP} | sort | uniq > ${DEST_PYREQ}
4242
}
4343

44+
function get_CodeQL() {
45+
echo -e "\e[32m${FUNCNAME[0]}\e[0m"
46+
wget --no-verbose --show-progress -c -O ${CODEQL_PKG} ${CODEQL_SOURCE_LINK}
47+
}
48+
4449
get_arm_toolchain
4550
get_cmake
51+
get_CodeQL
4652
getPythonReq
4753

4854

docker/Dockerfile.runner.in

+9-1
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,24 @@ RUN apt-get install git -y
3030
#add python packages
3131
ADD assets/requirements.txt /home/docker/requirements.txt
3232
RUN pip3 install -r /home/docker/requirements.txt
33+
RUN apt-get remove ccache -y
3334

3435
# ARM compiler
3536
ADD assets/@ARM_GCC_PKG@ /usr/local/
37+
# CodeQL
38+
ADD assets/@CODEQL_PKG@ /usr/local/
39+
RUN cd /usr/local && unzip @CODEQL_PKG@ && rm @CODEQL_PKG@
3640

3741
# CMake
3842
ADD assets/@CMAKE_PKG@ /usr/local/
3943

44+
RUN wget https://github.com/ccache/ccache/releases/download/v4.7/ccache-4.7-linux-x86_64.tar.xz && tar -xvf ccache-4.7-linux-x86_64.tar.xz && cd ccache-4.7-linux-x86_64/ && make install
45+
46+
4047
ENV CMAKE_NAME="/usr/local/@CMAKE_NAME@"
4148
ENV ARM_GCC="/usr/local/@ARM_GCC@"
4249

43-
ENV PATH="/user/local/actions-runner:/usr/local/@CMAKE_NAME@/bin:/usr/local/@ARM_GCC@/bin:$PATH"
50+
ENV PATH="/usr/local/codeql:/user/local/actions-runner:/usr/local/@CMAKE_NAME@/bin:/usr/local/@ARM_GCC@/bin:$PATH"
4451
ENV TERM="xterm-256color"
4552

4653
ADD assets/.bashrc /home/docker/
@@ -50,6 +57,7 @@ COPY assets/entrypoint.sh /entrypoint.sh
5057
COPY ci_actions.sh /ci_actions.sh
5158

5259
RUN echo "export PATH="/user/local/actions-runner:/usr/local/@CMAKE_NAME@/bin:/usr/local/@ARM_GCC@/bin:$PATH"" > /etc/profile.d/setup_path.sh
60+
RUN echo "export PATH="/usr/local/codeql/:$PATH"" > /etc/profile.d/setup_path.sh
5361
RUN chmod +x /etc/profile.d/setup_path.sh
5462
RUN chmod +x /cmd.sh && \
5563
chmod +x /entrypoint.sh && \

docker/jenkins-docker/Dockerfile docker/jenkins-docker/Dockerfile-jenkins.runner.in

+9-8
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,22 @@ MAINTAINER [email protected]
55

66
USER root
77

8-
RUN export DEBIAN_FRONTEND=noninteractive
8+
RUN export DEBIAN_FRONTEND=noninteractive
99

10-
RUN apt-get update
11-
RUN apt-get full-upgrade -y
10+
RUN apt-get update
11+
RUN apt-get full-upgrade -y
1212

1313
RUN apt-get install -y \
1414
openssh-server \
15-
openjdk-8-jdk
15+
openjdk-11-jdk
1616

1717
RUN apt-get -qy clean
1818

1919
#Docker drops audit-related capabilities, removing from pam requirements
2020
RUN sed -i 's|session required pam_loginuid.so|session optional pam_loginuid.so|g' /etc/pam.d/sshd
2121

22+
ENV PATH="/usr/local/codeql:/user/local/actions-runner:/usr/local/@CMAKE_NAME@/bin:/usr/local/@ARM_GCC@/bin:$PATH"
23+
2224
RUN sed -i /etc/ssh/sshd_config \
2325
-e 's/#PermitRootLogin.*/PermitRootLogin no/' \
2426
-e 's/#RSAAuthentication.*/RSAAuthentication yes/' \
@@ -33,12 +35,11 @@ RUN adduser --quiet --gecos '' --disabled-password --uid 6666 jenkins
3335
COPY .ssh/authorized_keys /home/jenkins/.ssh/authorized_keys
3436
COPY start-sshd /usr/local/bin/start-sshd
3537
RUN chown -R jenkins:jenkins /home/jenkins/.ssh
38+
RUN echo "export PATH="/usr/local/codeql:/user/local/actions-runner:/usr/local/@CMAKE_NAME@/bin:/usr/local/@ARM_GCC@/bin:$PATH"" > /etc/profile.d/setup_path.sh
39+
RUN chmod +x /etc/profile.d/setup_path.sh
3640
RUN cat /etc/profile.d/setup_path.sh >> /home/jenkins/.bashrc
3741

38-
#RUN chmod -x /cmd.sh && \
39-
# chmod -x /entrypoint.sh
4042

4143
EXPOSE 22
4244

43-
ENTRYPOINT ["/usr/local/bin/start-sshd"]
44-
#ENTRYPOINT ["/bin/sleep", "infinity"]
45+
ENTRYPOINT ["/usr/local/bin/start-sshd"]

in_docker.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
2+
# Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
33
# For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
44

55
CONTAINER_NAME="wearemudita/mudita_os_builder"

module-bsp/drivers/i2c/DriverI2C.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#include <memory>
88
#include <sys/types.h>
9-
9+
#include <cstdint>
1010
namespace drivers
1111
{
1212

products/PurePhone/test/test-settings/test-service-db-settings-api.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#include <module-db/Interface/ThreadRecord.hpp>
3838
#include <service-db/agents/quotes/QuotesAgent.hpp>
3939

40-
TEST_CASE("SettingsApi")
40+
TEST_CASE("SettingsApi", "[.]")
4141
{
4242
SECTION("variable/profile/mode register/set/get/unregister")
4343
{

0 commit comments

Comments
 (0)