Skip to content

Commit

Permalink
Al2023 codebuild (#4756)
Browse files Browse the repository at this point in the history
  • Loading branch information
dougch authored Sep 24, 2024
1 parent 360feb2 commit 79b5ac6
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 15 deletions.
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

# 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

0 comments on commit 79b5ac6

Please sign in to comment.