Skip to content

Commit

Permalink
Merge branch 'master' into QFI_Pipelined_Sessiond
Browse files Browse the repository at this point in the history
  • Loading branch information
prabinakpattnaik committed Jun 27, 2022
2 parents 4d71908 + 121950b commit 7004dcc
Show file tree
Hide file tree
Showing 895 changed files with 74,788 additions and 9,545 deletions.
42 changes: 19 additions & 23 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,38 @@ build --cxxopt=-std=c++14
build --experimental_strict_action_env
build --compilation_mode=dbg

# Default test configuration
# DEFAULT TEST CONFIGURATION
# Please read the GH issue #13073 before adding "test" options.
test --test_output=errors
test --flaky_test_attempts=5

# Use dynamically linked folly library
build --define=folly_so=1

# MAGMA VM CONFIGS
build:specify_vm_cc --action_env=CC=/usr/bin/gcc
build:vm --disk_cache=/home/vagrant/magma/.bazel-cache
common:vm --repository_cache=/home/vagrant/magma/.bazel-cache-repo
build:vm --define=folly_so=1
build:vm --config=specify_vm_cc

# MAGMA-BUILDER DOCKER CONTAINER CONFIGS
build:docker --disk_cache=/workspaces/magma/.bazel-cache
common:docker --repository_cache=/workspaces/magma/.bazel-cache-repo
build:docker --define=folly_so=1

# DEVCONTAINER CONFIGS
build:devcontainer --disk_cache=/workspaces/magma/.bazel-cache
common:devcontainer --repository_cache=/workspaces/magma/.bazel-cache-repo
build:devcontainer --define=folly_so=1
# DISK CACHE CONFIGS
# The locations of the disk_cache/repository_cache are symlinks in the
# docker containers/magma-vm. They point to the correct cache locations
# $MAGMA/.bazel-cache and $MAGMA/.bazel-cache-repo inside the magma repository.
build:disk_cache --disk_cache=/var/cache/bazel-cache
common:disk_cache --repository_cache=/var/cache/bazel-cache-repo

# REMOTE CACHING READ AND WRITE CONFIGS
# The file bazel/bazelrcs/remote_caching_rw.bazelrc is templated in CI
# The full config is then written to remote-cache.bazelrc
# The full config is then written to bazel/bazelrcs/cache.bazelrc
build:remote_caching_rw --remote_download_toplevel

# REMOTE CACHING READ-ONLY CONFIGS
# The file bazel/bazelrcs/remote_caching_ro.bazelrc is templated in CI
# The full config is then written to remote-cache.bazelrc
# The full config is then written to bazel/bazelrcs/cache.bazelrc
build:remote_caching_ro --remote_download_toplevel
build:remote_caching_ro --remote_upload_local_results=false

# Try importing the bazel remote caching config (relevant in CI)
try-import remote-cache.bazelrc
# Import the bazel caching config, with default disk cache,
# which in CI gets overwritten by the remote caching config.
import bazel/bazelrcs/cache.bazelrc

# TEST CONFIGS
# Bazel test runtime default: PATH=/bin:/usr/bin:/usr/local/bin
Expand All @@ -57,7 +55,8 @@ build --test_env=MAGMA_ROOT

# MME specific compile time defines
# Compile mme libraries with unit test flag
test --per_file_copt=^lte/gateway/c/core/.*$@-DMME_UNIT_TEST
test --per_file_copt=^lte/gateway/c/core/.*$@-DMME_UNIT_TEST # See GH issue #13073
build:mme_unit_test --per_file_copt=^lte/gateway/c/core/.*$@-DMME_UNIT_TEST # See GH issue #13073
# TODO: deprecate these flags used for logging if possible
build --per_file_copt=^lte/gateway/c/core/.*$@-DPACKAGE_BUGREPORT=\"TBD\"
build --per_file_copt=^lte/gateway/c/core/.*$@-DPACKAGE_VERSION=\"0.1\"
Expand All @@ -68,10 +67,7 @@ build --per_file_copt=^lte/gateway/c/core/oai/tasks/sgw/.*$@-DPACKAGE_NAME=\"S/P
# CODE COVERAGE CONFIGS
build --javacopt="-source 8"
build --javacopt="-target 8"
build --host_javabase=@bazel_tools//tools/jdk:remote_jdk11
build --javabase=@bazel_tools//tools/jdk:remote_jdk11
build --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_java11
build --java_toolchain=@bazel_tools//tools/jdk:toolchain_java11
build --java_runtime_version=remotejdk_11

coverage --config=coverage
build:coverage --combined_report=lcov
Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.2.2
5.2.0
2 changes: 0 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,4 @@ RUN for SWAGGER_SRC in lte orc8r; \
rm -r ${PYTHON_VENV}/${GEN_DIR}/${SWAGGER_SRC}/swagger/test; \
done

RUN ln -fs $MAGMA_ROOT/bazel/bazelrcs/devcontainer.bazelrc /etc/bazelrc

WORKDIR $MAGMA_ROOT
11 changes: 7 additions & 4 deletions .devcontainer/bazel-base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
################################################################
FROM ubuntu:focal as bazel_builder

ARG DEB_PORT=amd64

ARG PYTHON_VERSION=3.8

ENV TZ=UTC
Expand Down Expand Up @@ -119,13 +121,14 @@ RUN wget -qO - https://artifactory.magmacore.org:443/artifactory/api/gpg/key/pub

# Install bazel
WORKDIR /usr/sbin
RUN wget --progress=dot:giga https://github.com/bazelbuild/bazelisk/releases/download/v1.10.0/bazelisk-linux-amd64 && \
chmod +x bazelisk-linux-amd64 && \
ln -s /usr/sbin/bazelisk-linux-amd64 /usr/sbin/bazel
RUN wget --progress=dot:giga https://github.com/bazelbuild/bazelisk/releases/download/v1.10.0/bazelisk-linux-"${DEB_PORT}" && \
chmod +x bazelisk-linux-"${DEB_PORT}" && \
ln -s /usr/sbin/bazelisk-linux-"${DEB_PORT}" /usr/sbin/bazel

# Update shared library configuration
RUN ldconfig -v

RUN ln -s /workspaces/magma/bazel/bazelrcs/docker.bazelrc /etc/bazelrc
RUN ln -s /workspaces/magma/.bazel-cache /var/cache/bazel-cache
RUN ln -s /workspaces/magma/.bazel-cache-repo /var/cache/bazel-cache-repo

WORKDIR /workspaces/magma
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,14 @@
!orc8r/tools/ansible/roles/fluent_bit/files
!orc8r/tools/docker/

!dp/cloud/docker/python/test_runner/entrypoint.sh
!dp/cloud/go/
!dp/cloud/python/
!dp/protos/
!dp/Makefile

!build/gen

!protos/

!xwf/gateway/
Expand Down
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# GitHub-specific: https://github.com/github/linguist/blob/master/docs/overrides.md

# Monolithic swagger.yml is generated
/orc8r/cloud/go/obsidian/swagger/v1/swagger.yml linguist-generated
/orc8r/cloud/go/services/obsidian/swagger/v1/swagger.yml linguist-generated
# NMS bindings are generated
/nms/generated/MagmaAPIBindings.js linguist-generated
# SBI openapi interface generated files
Expand Down
67 changes: 59 additions & 8 deletions .github/workflows/agw-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ concurrency:
cancel-in-progress: true

env:
DEVCONTAINER_IMAGE: "ghcr.io/magma/magma/devcontainer:latestv2"
BAZEL_BASE_IMAGE: "ghcr.io/magma/magma/bazel-base:latestv2"
DEVCONTAINER_IMAGE: "ghcr.io/magma/magma/devcontainer:latest"
BAZEL_BASE_IMAGE: "ghcr.io/magma/magma/bazel-base:latest"
CACHE_KEY: bazel-base-image

jobs:
Expand Down Expand Up @@ -139,7 +139,10 @@ jobs:

c_cpp_unit_tests:
needs: path_filter
if: ${{ needs.path_filter.outputs.should_not_skip == 'true' }}
if: |
needs.path_filter.outputs.should_not_skip == 'true' &&
github.repository_owner == 'magma' &&
github.ref_name == 'master'
name: C/C++ unit tests with Bazel
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -186,7 +189,11 @@ jobs:
run: |
cd /workspaces/magma
bazel/scripts/remote_cache_bazelrc_setup.sh "${{ env.CACHE_KEY }}" "${{ secrets.BAZEL_REMOTE_PASSWORD }}"
bazel test //orc8r/gateway/c/...:* //lte/gateway/c/...:* --config=asan --test_output=errors --cache_test_results=no
bazel test //orc8r/gateway/c/...:* //lte/gateway/c/...:* \
--config=asan \
--test_output=errors \
--cache_test_results=no \
--profile=Bazel_cpp_unit_tests_profile
TEST_RESULT=$?
# copy out test results
echo "Copying out test result XMLs for testing with ASAN"
Expand All @@ -198,11 +205,28 @@ jobs:
with:
name: Unit Test Results
path: c-cpp-test-results/
- name: Publish bazel profile
uses: actions/upload-artifact@v3
if: always()
with:
name: Bazel cpp unit tests profile
path: Bazel_cpp_unit_tests_profile
- name: Build space left after run
shell: bash
run: |
echo "Available storage:"
df -h
- name: Notify failure to slack
if: failure() && github.event_name == 'push'
uses: rtCamp/action-slack-notify@v2.2.0
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_BAZEL_CI }}
SLACK_TITLE: "C/C++ unit tests with Bazel"
SLACK_USERNAME: "agw-workflow"
SLACK_ICON_EMOJI: ":boom:"
SLACK_COLOR: "#FF0000"
SLACK_FOOTER: ' '
MSG_MINIMAL: actions url,commit

li_agent_test:
needs: path_filter
Expand Down Expand Up @@ -358,7 +382,11 @@ jobs:
make coverage
cp $C_BUILD/coverage.info $MAGMA_ROOT
- name: Run coverage with Bazel (COMMON / SESSIOND / SCTPD / LIAGENT / CONNECTIOND)
if: always()
if: |
always() &&
github.repository_owner == 'magma' &&
github.ref_name == 'master'
id: bazel-codecoverage
uses: addnab/docker-run-action@v3
with:
image: ${{ env.BAZEL_BASE_IMAGE }}
Expand All @@ -368,9 +396,12 @@ jobs:
cd $MAGMA_ROOT
bazel/scripts/remote_cache_bazelrc_setup.sh "${{ env.CACHE_KEY }}" "${{ secrets.BAZEL_REMOTE_PASSWORD }}"
# Collecting coverage with Bazel can be slow. We can follow this thread to see if this can be improved: https://github.com/bazelbuild/bazel/issues/8178
# Omit OAI coverage until it is tested. We need to determine what the behavior is for doing both CMake and Bazel based coverage at the same time
# TODO: GH11936
bazel coverage -- //orc8r/gateway/c/...:* //lte/gateway/c/...:* -//lte/gateway/c/core/...:*
# Coverage in bazel is flaky for remote caches - the flags below are helping. See GH13026 for details.
# TODO: GH11936 Omit OAI coverage until it is tested. We need to determine what the behavior is for doing both CMake and Bazel based coverage at the same time
bazel coverage \
--profile=Bazel_test_coverage_profile \
--experimental_split_coverage_postprocessing --experimental_fetch_all_coverage_outputs --remote_download_outputs=all \
-- //orc8r/gateway/c/...:* //lte/gateway/c/...:* -//lte/gateway/c/core/...:*
# copy out coverage information into magma so that it's accessible from the CI node
cp bazel-out/_coverage/_coverage_report.dat $MAGMA_ROOT
- name: Upload code coverage
Expand All @@ -379,6 +410,15 @@ jobs:
uses: codecov/codecov-action@v2
with:
flags: c_cpp
- name: Publish bazel profile
uses: actions/upload-artifact@v3
if: |
always() &&
github.repository_owner == 'magma' &&
github.ref_name == 'master'
with:
name: Bazel test coverage profile
path: Bazel_test_coverage_profile
- name: Extract commit title
# yamllint enable
if: failure() && github.event_name == 'push'
Expand All @@ -402,6 +442,17 @@ jobs:
run: |
echo "Available storage:"
df -h
- name: Notify Bazel failure to slack
if: failure() && steps.bazel-codecoverage.conclusion == 'failure' && github.event_name == 'push'
uses: rtCamp/action-slack-notify@v2.2.0
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_BAZEL_CI }}
SLACK_TITLE: "C / C++ code coverage with Bazel"
SLACK_USERNAME: "agw-workflow"
SLACK_ICON_EMOJI: ":boom:"
SLACK_COLOR: "#FF0000"
SLACK_FOOTER: ' '
MSG_MINIMAL: actions url,commit

lint-clang-format:
needs: path_filter
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/amis-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ jobs:
sed -i -e '/^stackDevOpsCloudstrapper: /s/:.*$/: publish-amis-to-marketplace-stack-devopscloustrapper/' ${{ env.VARS_DIR }}/defaults.yaml
sed -i -e '/^stackCloudstrapper: /s/:.*$/: publish-amis-to-marketplace-stack-cloustrapper/' ${{ env.VARS_DIR }}/defaults.yaml
sed -i -e '/^devOpsAmi: /s/:.*$/: cloudstrapper-'"$VERSION"'/' ${{ env.VARS_DIR }}/defaults.yaml
sed -i -e '/^buildUbuntuAmi: /s/:.*$/: ami-09e67e426f25ce0d7/' ${{ env.VARS_DIR }}/build.yaml
sed -i -e '/^buildAgwVersion: /s/:.*$/: '"$GIT_REF"'/' ${{ env.VARS_DIR }}/build.yaml
sed -i -e '/^buildAgwPackage: /s/:.*$/: '"$PACKAGE_VERSION"'/' ${{ env.VARS_DIR }}/build.yaml
sed -i -e '/^taggedVersion: /s/:.*$/: '"$VERSION"'/' ${{ env.VARS_DIR }}/build.yaml
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/bazel-cache-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ jobs:
- run: echo "::set-output name=date::$(date +'%m-%d-%Y--%H-%M-%S')"
id: date
- uses: actions/checkout@v2
- name: Cache magma dev
uses: actions/cache@v3
with:
path: ~/.vagrant.d/boxes/magmacore-VAGRANTSLASH-magma_dev
key: vagrant-box-magma-dev
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
Expand Down Expand Up @@ -82,6 +87,17 @@ jobs:
aws s3 cp ${{ env.BAZEL_CACHE_MAGMA_VM_TAR }} ${{ env.S3_BUCKET_PATH }}/${{ env.BAZEL_CACHE_MAGMA_VM_TAR}}
aws s3 cp ${{ env.BAZEL_CACHE_REPO_MAGMA_VM_TAR }} ${{ env.S3_BUCKET_PATH }}/${{ env.BAZEL_CACHE_REPO_MAGMA_VM_TAR}}
- name: Notify failure to slack
if: failure() && github.event_name == 'push'
uses: rtCamp/action-slack-notify@v2.2.0
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_BAZEL_CI }}
SLACK_TITLE: "VM Caches"
SLACK_USERNAME: "Push Bazel Cache To S3"
SLACK_ICON_EMOJI: ":boom:"
SLACK_COLOR: "#FF0000"
SLACK_FOOTER: ' '
MSG_MINIMAL: actions url,commit

bazel-build-devcontainer-and-push-cache:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -135,3 +151,15 @@ jobs:
run: |
echo "Available storage:"
df -h
- name: Notify failure to slack
if: failure() && github.event_name == 'push'
uses: rtCamp/action-slack-notify@v2.2.0
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_BAZEL_CI }}
SLACK_TITLE: "Devcontainer Caches"
SLACK_USERNAME: "Push Bazel Cache To S3"
SLACK_MESSAGE: "${{ steps.commit.outputs.title}}"
SLACK_ICON_EMOJI: ":boom:"
SLACK_COLOR: "#FF0000"
SLACK_FOOTER: ' '
MSG_MINIMAL: actions url,commit

0 comments on commit 7004dcc

Please sign in to comment.