Skip to content

Commit

Permalink
feat: added sd_error and arm architecture support
Browse files Browse the repository at this point in the history
  • Loading branch information
ecow committed Apr 5, 2024
1 parent 89186c4 commit 2177386
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ FROM ubuntu:22.04

LABEL authors="[email protected]"


RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
Expand Down
20 changes: 7 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,13 @@ docker network rm myvpn
To push a new docker image to docker hub:

```
docker login
NAME="linkeddatacenter/sdaas-ce" MAJOR="4" MINOR="0" PATCH="0"
docker build --build-arg MODE=prod -t $NAME:$MAJOR.$MINOR.$PATCH .
docker tag $NAME:$MAJOR.$MINOR.$PATCH $NAME:$MAJOR.$MINOR
docker tag $NAME:$MAJOR.$MINOR.$PATCH $NAME:$MAJOR
docker tag $NAME:$MAJOR.$MINOR.$PATCH $NAME:latest
docker push $NAME:$MAJOR.$MINOR.$PATCH
docker push $NAME:$MAJOR.$MINOR
docker push $NAME:$MAJOR
docker push $NAME:latest
```

N.B. opmitting `--build-arg ARG=prod` enable the supports for test automation
# docker login
# docker buildx create --name multi-arch-builder
NAME="linkeddatacenter/sdaas-ce" MAJOR="4" MINOR="1" PATCH="0"
docker buildx build --builder multi-arch-builder --platform linux/arm,linux/amd64 --build-arg MODE=prod --push -t $NAME:$MAJOR.$MINOR.$PATCH .
```


## Credits and license

Expand Down
7 changes: 7 additions & 0 deletions modules/core
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ sd_abort() {
exit 2
}


sd_error() {
local error_message="${1:-"return error"}" return_val="${2:-1}"
sd_log -p ERROR "$error_message ($return_val)"
return $return_val
}

sd_return_first_non_zero() {
for element in "$@"; do
if [[ $element -ne 0 ]]; then
Expand Down
9 changes: 9 additions & 0 deletions tests/unit/coreTest.bats
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ function teardown {
}


########## Test sd_error

@test "core sd_error" {
SD_LOG_PRIORITY=7
run sd_error "test message as ERROR" 3
[[ "$status" -eq 3 ]]
[[ "${lines[0]}" =~ "[ERROR]" ]]
[[ "${lines[0]}" =~ "test message as ERROR" ]]
}

########## Test sd_validate

Expand Down

0 comments on commit 2177386

Please sign in to comment.