diff --git a/.github/workflows/check_aws_buildspec.yaml b/.github/workflows/check_aws_buildspec.yaml index 3713add1d..e62814fcb 100644 --- a/.github/workflows/check_aws_buildspec.yaml +++ b/.github/workflows/check_aws_buildspec.yaml @@ -29,7 +29,7 @@ jobs: - name: Setup poetry env run: bash scripts/setup_poetry_env.sh "python3.8" - - name: Run check_if_starter_scripts_are_up_to_date.sh + - name: Run githooks/update_aws_buildspec.sh run: bash githooks/update_aws_buildspec.sh - name: Check git status diff --git a/.github/workflows/check_starter_scripts.yaml b/.github/workflows/check_starter_scripts.yaml index 2f3976890..511b1f2ed 100644 --- a/.github/workflows/check_starter_scripts.yaml +++ b/.github/workflows/check_starter_scripts.yaml @@ -29,7 +29,7 @@ jobs: - name: Setup poetry env run: bash scripts/setup_poetry_env.sh "python3.8" - - name: Run check_if_starter_scripts_are_up_to_date.sh + - name: Run githooks/update_exaslct_starter_scripts.sh run: bash githooks/update_exaslct_starter_scripts.sh - name: Check git status diff --git a/aws-code-build/DeveloperGuide.md b/aws-code-build/DeveloperGuide.md index bcef3f052..2a301c5be 100644 --- a/aws-code-build/DeveloperGuide.md +++ b/aws-code-build/DeveloperGuide.md @@ -12,17 +12,34 @@ Another limitation is, that artifacts will not be uploaded to S3. ### Setup -[Here](https://docs.aws.amazon.com/codebuild/latest/userguide/use-codebuild-agent.html) are detailed scripts for the installation. -You will find a script under ./aws-code-build/run_local/get.sh which runs the installation automatically. +[Here](https://docs.aws.amazon.com/codebuild/latest/userguide/use-codebuild-agent.html) are detailed scripts for the installation. + +There are two options: +1. Build the AWS build container from scratch which might take several hours. You can use the script [get_from_source.sh](run_local/get_from_source.sh) which runs the installation automatically. +2. Use the prebuilt AWS build container from Dockerhub in the `exadockerci4/aws_codebuild` repository (which might not be up-tp-date). You can use the script [get_prebuilt.sh](run_local/get_prebuilt.sh) which runs the installation automatically. ### Run - Set the flavor in aws-code-build/run_local_run_local.env -- Run aws-code-build/run_local/run_local.sh +- Run [run_local.sh](run_local/run_local.sh) or [run_local_prebuilt.sh](run_local/run_local_prebuilt.sh) with buildspec file and AWS profile as parameters: + +```bash +bash ./aws-code-build/run_local/run_local.sh aws-code-build/ci/build_buildspec.yaml my_aws_profile_mfa +``` + +## Buildspec Updates + +The buildspec files are automatically generated by `script-languages-container-ci-setup`. There is a [githook](../githooks/update_aws_buildspec.sh) which ensures that the buildspecs are up-to-date. + +## AWS Deployment +The infrastructure is created using AWS Cloudformation. The cloudformation stack can be automatically deployed by using the script [update_aws_build_stack.sh](update_aws_build_stack.sh). You need to pass your AWS profile as parameter, for example: +```bash +bash ./aws-code-build/update_aws_build_stack.sh my-aws-profile-mfa +``` -## AWS Run +## AWS Build Overview - AWS CodeBuild has registered a WebHook in [script-languages](https://github.com/exasol/script-languages) and [script-languages-release](https://github.com/exasol/script-languages-release), which will trigger AWS builds automatically - Access the AWS Console and go to "CodeBuild" diff --git a/aws-code-build/run_local/get.sh b/aws-code-build/run_local/get_from_source.sh similarity index 87% rename from aws-code-build/run_local/get.sh rename to aws-code-build/run_local/get_from_source.sh index f9728bf1b..5c79f97b4 100644 --- a/aws-code-build/run_local/get.sh +++ b/aws-code-build/run_local/get_from_source.sh @@ -20,6 +20,6 @@ fi echo Ready. echo Now you can run the AWS code build locally with: -echo "'./aws-code-build/run_local/run_local.sh in the root folder (where buildspec.yml exists)" +echo "'./aws-code-build/run_local/run_local_prebuilt.sh in the root folder" popd &> /dev/null diff --git a/aws-code-build/run_local/get_prebuilt.sh b/aws-code-build/run_local/get_prebuilt.sh new file mode 100644 index 000000000..43863f421 --- /dev/null +++ b/aws-code-build/run_local/get_prebuilt.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -euo pipefail + +pushd "../.." &>/dev/null + +echo Pulling codebuild script... +wget https://raw.githubusercontent.com/aws/aws-codebuild-docker-images/master/local_builds/codebuild_build.sh +docker pull exadockerci4/aws_codebuild:5.0 +echo Ready. +echo Now you can run the AWS code build locally with: +echo "'./aws-code-build/run_local/run_local_prebuilt.sh in the root folder" + +popd &> /dev/null diff --git a/aws-code-build/run_local/run_local_prebuilt.sh b/aws-code-build/run_local/run_local_prebuilt.sh new file mode 100644 index 000000000..2d8fa55f8 --- /dev/null +++ b/aws-code-build/run_local/run_local_prebuilt.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -euo pipefail + +BUILD_SPEC=$1 +AWS_PROFILE=$2 +SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" + +pushd "$SCRIPT_DIR/../../" &>/dev/null +#Artifacts will be stored under /tmp +./codebuild_build.sh -e ./aws-code-build/run_local/run_local.env -d -c -i exadockerci4/aws_codebuild:5.0 -b "$BUILD_SPEC" -p $AWS_PROFILE -a /tmp +popd > /dev/null