-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from ba-st/gem_launchpad_docker_image
Docker images for GemStone/64
- Loading branch information
Showing
34 changed files
with
454 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
gemstone.key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM launchpad-gs64:sut | ||
|
||
CMD [ "launchpad", "start", "greeter" , "--name=DJ", "--title=Mr." ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
#!/usr/bin/env bash | ||
|
||
readonly ANSI_BOLD="\\033[1m" | ||
readonly ANSI_RED="\\033[31m" | ||
readonly ANSI_GREEN="\\033[32m" | ||
readonly ANSI_BLUE="\\033[34m" | ||
readonly ANSI_RESET="\\033[0m" | ||
|
||
function print_info() { | ||
if [ -t 1 ]; then | ||
printf "${ANSI_BOLD}${ANSI_BLUE}%s${ANSI_RESET}\\n" "$1" | ||
else | ||
echo "$1" | ||
fi | ||
} | ||
|
||
function print_success() { | ||
if [ -t 1 ]; then | ||
printf "${ANSI_BOLD}${ANSI_GREEN}%s${ANSI_RESET}\\n" "$1" | ||
else | ||
echo "$1" | ||
fi | ||
} | ||
|
||
function print_error() { | ||
if [ -t 1 ]; then | ||
printf "${ANSI_BOLD}${ANSI_RED}%s${ANSI_RESET}\\n" "$1" 1>&2 | ||
else | ||
echo "$1" 1>&2 | ||
fi | ||
} | ||
|
||
function executeWithArguments() { | ||
rm -rf logs out err | ||
LAST_ARGUMENTS=$* | ||
"$@" > out 2> err || true | ||
} | ||
|
||
function assertOutputIncludesMessage() { | ||
local message=$1 | ||
local output=$2 | ||
|
||
if [ "$(grep -c "$message" "$output")" -eq 0 ]; then | ||
print_error "Expected std$output to have: '$message' when invoked with $LAST_ARGUMENTS" | ||
print_info "Output contents" | ||
cat "$output" | ||
exit 1 | ||
fi | ||
} | ||
|
||
set -e | ||
|
||
print_info "Creating network" | ||
if docker network inspect launchpad-net > /dev/null 2>&1 ;then | ||
docker network rm launchpad-net | ||
fi | ||
docker network create --attachable launchpad-net | ||
|
||
print_info "Starting stone" | ||
if [[ ! -f "$PWD"/.docker/gs64/gemstone.key ]]; then | ||
print_error "Missing $PWD/.docker/gs64/gemstone.key" | ||
exit 1 | ||
fi | ||
|
||
docker run --rm --detach --name gs64-stone \ | ||
-e TZ="America/Argentina/Buenos_Aires" \ | ||
--cap-add=SYS_RESOURCE \ | ||
--network=launchpad-net \ | ||
--volume="$PWD":/opt/gemstone/projects/Launchpad:ro \ | ||
--volume="$PWD"/.docker/gs64/gem.conf:/opt/gemstone/conf/gem.conf \ | ||
--volume="$PWD"/.docker/gs64/gemstone.key:/opt/gemstone/product/sys/gemstone.key:ro \ | ||
ghcr.io/ba-st/gs64-rowan:v3.7.0 | ||
|
||
sleep 1 | ||
print_info "Loading Launchpad in the stone" | ||
docker exec -t -u gemstone gs64-stone ./load-rowan-project.sh Launchpad | ||
|
||
print_info "Building base gem" | ||
docker buildx build --tag launchpad-gs64:sut docker/gs64 | ||
|
||
print_info "Building examples gem" | ||
docker buildx build \ | ||
--tag launchpad-examples-gs64:sut \ | ||
--file .docker/gs64/Dockerfile \ | ||
. | ||
|
||
function run_launchpad_gem(){ | ||
executeWithArguments docker run \ | ||
-e TZ="America/Argentina/Buenos_Aires" \ | ||
-e GS64_STONE_HOSTNAME="gs64-stone" \ | ||
--cap-add=SYS_RESOURCE \ | ||
--network=launchpad-net \ | ||
--volume="$PWD"/.docker/gs64/gem.conf:/opt/gemstone/conf/gem.conf \ | ||
launchpad-examples-gs64:sut "$@" | ||
} | ||
|
||
print_info "Running basic test" | ||
run_launchpad_gem | ||
assertOutputIncludesMessage '[INFO]' out | ||
assertOutputIncludesMessage "Hi Mr. DJ!" out | ||
print_success "OK" | ||
|
||
print_info "Running --version test" | ||
run_launchpad_gem launchpad --version | ||
assertOutputIncludesMessage "Launchpad" out | ||
print_success "OK" | ||
|
||
print_info "Running launchpad list test" | ||
run_launchpad_gem launchpad list | ||
assertOutputIncludesMessage "broken greeter" out | ||
print_success "OK" | ||
|
||
print_info "Running launchpad list --verbose test" | ||
run_launchpad_gem launchpad list --verbose | ||
assertOutputIncludesMessage "broken v0.0.1" out | ||
assertOutputIncludesMessage "greeter v1.0.0" out | ||
print_success "OK" | ||
|
||
print_info "Running launchpad explain test" | ||
run_launchpad_gem launchpad explain broken | ||
assertOutputIncludesMessage "broken \[v0.0.1\] - A broken application" out | ||
run_launchpad_gem launchpad explain greeter | ||
assertOutputIncludesMessage "greeter \[v1.0.0\] - A greetings application" out | ||
run_launchpad_gem launchpad explain | ||
assertOutputIncludesMessage "\[ERROR\] Missing application name or option." err | ||
print_success "OK" | ||
|
||
print_info "Running launchpad start greeter test" | ||
run_launchpad_gem launchpad start greeter --name=Juan | ||
assertOutputIncludesMessage "Hi Juan!" out | ||
print_success " Just name, OK" | ||
run_launchpad_gem launchpad start greeter --name=Julia --title=Miss | ||
assertOutputIncludesMessage "Hi Miss Julia!" out | ||
print_success " Name and title, OK" | ||
run_launchpad_gem launchpad start greeter --title=Miss | ||
assertOutputIncludesMessage "\[ERROR\] \"Name\" parameter not provided. You must provide one." err | ||
print_success " Missing name, OK" | ||
run_launchpad_gem launchpad start greeter | ||
assertOutputIncludesMessage "\[ERROR\] \"Name\" parameter not provided. You must provide one." err | ||
print_success "OK" | ||
|
||
print_info "Running launchpad start broken test" | ||
run_launchpad_gem launchpad start broken --raise-error | ||
assertOutputIncludesMessage "\[INFO\] Obtaining configuration... \[DONE\]" out | ||
assertOutputIncludesMessage "\[ERROR\] Unexpected startup error: \"Doh!\"" err | ||
print_success "OK" | ||
|
||
print_info "Stopping stone" | ||
docker stop gs64-stone | ||
print_info "Removing network" | ||
docker network rm launchpad-net |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GEM_TEMPOBJ_CACHE_SIZE = 500000KB; | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Build and Publish GS64 Docker Images | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- '**' | ||
tags: | ||
- 'v*.*.*' | ||
pull_request: | ||
jobs: | ||
build_and_publish: | ||
runs-on: ubuntu-latest | ||
name: Build and Publish Docker images | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Docker meta | ||
id: docker_meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ghcr.io/${{ github.repository_owner }}/launchpad-gs64 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to Container Registry | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }} | ||
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }} | ||
- name: Docker build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./docker/gs64 | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.docker_meta.outputs.tags }} | ||
labels: ${{ steps.docker_meta.outputs.labels }} | ||
secrets: GIT_AUTH_TOKEN=${{ secrets.DOCKER_REGISTRY_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: GS64 Docker Tests | ||
on: | ||
- push | ||
- pull_request | ||
- workflow_dispatch | ||
jobs: | ||
unit-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 2 | ||
- name: Configure keyfile | ||
run: | | ||
echo "$GS_KEYFILE" > ./.docker/gs64/gemstone.key | ||
env: | ||
GS_KEYFILE: ${{ secrets.GS_KEYFILE }} | ||
- name: Run tests using Docker | ||
run: ./.docker/gs64/docker-tests.sh | ||
- name: Remove keyfile | ||
run: rm -f ./.docker/gs64/gemstone.key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: 'GS64 Components Loading' | ||
on: | ||
- push | ||
- pull_request | ||
- workflow_dispatch | ||
jobs: | ||
component-loading: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
load-spec: | ||
- Deployment | ||
name: GS64 + ${{ matrix.load-spec }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Load component in image | ||
uses: ba-st-actions/gs64-ci@v2 | ||
with: | ||
project_name: 'Launchpad' | ||
load_spec: 'Launchpad-${{ matrix.load-spec }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.