--- # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You may not use # this file except in compliance with the License. A copy of the License is # located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompanying this file. This file is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. See the License for the specific language governing permissions and # limitations under the License. version: 0.2 # This is designed to work with CodeBuild's reserved instances fleet and # curated Ec2 AMI for AL2023. # # Because the Ec2 reserved instance disks persist between runs, # we need to do periodic clean up; The `nix store gc` command runs on Sunday to # prevent the disk from filling up. env: shell: bash variables: NIX_CACHE_BUCKET: "s3://s2n-tls-nixcachebucket-x86-64?region=us-west-2" NIX_INSTALLER: "https://nixos.org/nix/install" S2N_KTLS_TESTING_EXPECTED: 1 phases: install: commands: - yum update -y; yum upgrade -y pre_build: commands: - id; groupadd nixbld||true - useradd -m -g nixbld -G nixbld nix || true - | echo "Working around the faulty yaml parser..." echo 'nix ALL=NOPASSWD: ALL' > /etc/sudoers.d/nix # (Re)Install nix - sh <(curl -L "$NIX_INSTALLER") --no-daemon # Make sure nix exists in the PATH - export PATH=$HOME/.nix-profile/bin:$PATH # Turn on flakes - mkdir -p ~/.config/nix; echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf # Configure S3 bucket as a nix substituter - echo "extra-substituters = $NIX_CACHE_BUCKET" >> ~/.config/nix/nix.conf - echo "extra-trusted-substituters = $NIX_CACHE_BUCKET" >> ~/.config/nix/nix.conf - echo "require-sigs = false" >> ~/.config/nix/nix.conf - if [[ $(date +%u) -eq 0 ]]; then nix store gc;fi # Load the TLS kernel module - sudo modprobe tls - echo "Checking that the TLS kernel mod loaded..."; test $(sudo lsmod|grep -c tls) = 1 build: commands: - nix develop .#awslc --command bash -c 'source ./nix/shell.sh && clean && configure && unit' - S2N_CMAKE_OPTIONS="-DASAN=ON" nix develop .#awslc --command bash -c 'source ./nix/shell.sh && clean && configure && unit' post_build: commands: - nix copy --to $NIX_CACHE_BUCKET .#cache-awslc