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

Al2023 codebuild #4756

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ versions(){
gcc --version
cmake --version
python3 --version
ninja --version
}

if [[ ${DISTRO} != "amazon linux" ]]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,37 @@
# permissions and limitations under the License.
#

set -e
set -eu

source codebuild/bin/s2n_setup_env.sh
# Used to test if we're running in CodeBuild
CODEBUILD_BUILD_ARN_="${CODEBUILD_BUILD_ARN:-}"

if [[ ${DISTRO} != "amazon linux" ]]; then
echo "Target Amazon Linux, but running on $DISTRO: Nothing to do."
exit 1;
else
# AL2023 case
BUILD_FLAGS="-DCMAKE_BUILD_TYPE=RelWithDebInfo"
# AL2 case; Linker flags are a workaround for system openssl
if [[ ${VERSION_ID} == '2' ]]; then
BUILD_FLAGS=$(echo -e '-DCMAKE_EXE_LINKER_FLAGS="-lcrypto -lz" \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DS2N_BLOCK_NONPORTABLE_OPTIMIZATIONS=True')
fi
fi

# Use prlimit to set the memlock limit to unlimited for linux. OSX is unlimited by default
# Codebuild Containers aren't allowing prlimit changes (and aren't being caught with the usual cgroup check)
if [[ "$OS_NAME" == "linux" && -n "$CODEBUILD_BUILD_ARN" ]]; then
PRLIMIT_LOCATION=`which prlimit`
if [[ "$OS_NAME" == "linux" && -z "$CODEBUILD_BUILD_ARN_" ]]; then
PRLIMIT_LOCATION=$(which prlimit)
sudo -E ${PRLIMIT_LOCATION} --pid "$$" --memlock=unlimited:unlimited;
fi
Comment on lines +37 to 40
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably out of scope, but is this even necessary? The unit tests automatically disable mlock, which is what the memlock limit would be about.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

historical carry-over, maybe we need an issue to verify the S2N_DONT_MLOCK and clean this up


# Linker flags are a workaround for openssl
case "$TESTS" in
"unit")
cmake . -Bbuild -DCMAKE_EXE_LINKER_FLAGS="-lcrypto -lz" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DS2N_BLOCK_NONPORTABLE_OPTIMIZATIONS=True
cmake --build ./build -j $(nproc)
CTEST_PARALLEL_LEVEL=$(nproc) cmake --build ./build --target test -- ARGS="-L unit --output-on-failure"
eval cmake . -Bbuild "${BUILD_FLAGS}"
cmake --build ./build -j "$(nproc)"
CTEST_PARALLEL_LEVEL="$(nproc)" cmake --build ./build --target test -- ARGS="-L unit --output-on-failure"
;;
*) echo "Unknown test"; exit 1;;
esac

Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ phases:
if [ -d "third-party-src" ]; then
cd third-party-src;
fi
- ./codebuild/bin/install_al2_dependencies.sh
- ./codebuild/bin/install_al_dependencies.sh
build:
commands:
- printenv
- $CB_BIN_DIR/s2n_codebuild_al2.sh
- $CB_BIN_DIR/s2n_codebuild_al.sh
25 changes: 22 additions & 3 deletions codebuild/spec/buildspec_generalbatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ batch:
S2N_LIBCRYPTO: openssl-3.0
TESTS: unit
identifier: s2nUnitOpenssl3Gcc9
- buildspec: codebuild/spec/buildspec_amazonlinux2.yml
- buildspec: codebuild/spec/buildspec_amazonlinux.yml
env:
compute-type: BUILD_GENERAL1_LARGE
image: aws/codebuild/amazonlinux2-aarch64-standard:2.0
Expand All @@ -196,7 +196,7 @@ batch:
variables:
TESTS: unit
identifier: s2nUnitAl2Arm
- buildspec: codebuild/spec/buildspec_amazonlinux2.yml
- buildspec: codebuild/spec/buildspec_amazonlinux.yml
env:
compute-type: BUILD_GENERAL1_SMALL
image: aws/codebuild/amazonlinux2-x86_64-standard:3.0
Expand All @@ -205,7 +205,7 @@ batch:
TESTS: unit
S2N_LIBCRYPTO: default
identifier: s2nUnitAL2
- buildspec: codebuild/spec/buildspec_amazonlinux2.yml
- buildspec: codebuild/spec/buildspec_amazonlinux.yml
env:
compute-type: BUILD_GENERAL1_SMALL
image: aws/codebuild/amazonlinux2-x86_64-standard:3.0
Expand All @@ -214,6 +214,25 @@ batch:
TESTS: unit
S2N_LIBCRYPTO: openssl-1.1.1
identifier: s2nUnitAl2Openssl111
- buildspec: codebuild/spec/buildspec_amazonlinux.yml
env:
compute-type: BUILD_GENERAL1_SMALL
image: aws/codebuild/amazonlinux2-x86_64-standard:5.0
privileged-mode: true
variables:
TESTS: unit
S2N_LIBCRYPTO: openssl-3.0
identifier: UnitAl2023x86Openssl30
- buildspec: codebuild/spec/buildspec_amazonlinux.yml
env:
compute-type: BUILD_GENERAL1_SMALL
image: aws/codebuild/amazonlinux2-aarch64-standard:3.0
privileged-mode: true
type: ARM_CONTAINER
variables:
TESTS: unit
S2N_LIBCRYPTO: openssl-3.0
identifier: UnitAl2023armOpenssl30
- buildspec: codebuild/spec/buildspec_ubuntu.yml
env:
compute-type: BUILD_GENERAL1_LARGE
Expand Down
Loading