Skip to content

Commit

Permalink
1. Small fixes in GH Actions (renamed step titles)
Browse files Browse the repository at this point in the history
2. Updated aws-code-build/DeveloperGuide.md
3. Local build: Support for prebuilt AWS codebuild image
  • Loading branch information
tomuben committed May 18, 2022
1 parent 5375810 commit 9035471
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check_aws_buildspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check_starter_scripts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 21 additions & 4 deletions aws-code-build/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <buildspec> <aws-profile> in the root folder"

popd &> /dev/null
13 changes: 13 additions & 0 deletions aws-code-build/run_local/get_prebuilt.sh
Original file line number Diff line number Diff line change
@@ -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 <buildspec> <aws-profile> in the root folder"

popd &> /dev/null
12 changes: 12 additions & 0 deletions aws-code-build/run_local/run_local_prebuilt.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9035471

Please sign in to comment.