Skip to content

Commit

Permalink
Change .ci.sh to show more relevant information of the build; Change …
Browse files Browse the repository at this point in the history
…Dockerfile to build the image based on ubuntu:rolling to get relatively new software
  • Loading branch information
nirui committed May 12, 2023
1 parent e0b4b75 commit b505bef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 25 deletions.
27 changes: 3 additions & 24 deletions .ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,83 +22,62 @@ child() {
cpid=""
ret=0
i=0

echo "+ Spawning $# childs ..."

for c in "$@"; do
( (((((eval "$c"; echo $? >&3) | sed "s/^/\|------ ($i) /" >&4) 2>&1 | sed "s/^/\|------ ($i)!/" >&2) 3>&1) | (read xs; exit $xs)) 4>&1) & ppid=$!

cpid="$cpid $ppid"

echo "+ Child $i (PID $ppid): $c ..."

i=$((i+1))
done

for c in $cpid; do
wait $c

cret=$?
[ $cret -eq 0 ] && continue

echo "* Child PID $c has failed." >&2

ret=$cret
done

return $ret
}

retry() {
res=0

for i in $(seq 0 36); do
$@
res=$?

[ $res -eq 0 ] && return $res || sleep 10
done

return $res
}

catch() {
(eval '"$@"')
res=$?

[ $res -eq 0 ] && return $res

echo "Command \"$@\" has failed. Exit code: $res"

exit $res
}

SSHWIFTY_LAST_TAG_NAME=HEAD~1

if [ "$SSHWIFTY_DEPLOY" = 'yes' ]; then
echo 'Downloading compile & deploy tools ...'

[ "$(which ghr)" != '' ] || catch retry go install -v github.com/tcnksm/ghr@latest
[ "$(which gox)" != '' ] || catch retry go install -v github.com/mitchellh/gox@latest

echo 'Fetching extra references from the repository ...'

GIT_TAG_FETCH_PARAM=

if [ "$(git rev-parse --is-shallow-repository)" ]; then
echo 'Shallow clone detected, will unshallow ...'

GIT_TAG_FETCH_PARAM='--unshallow'
fi

catch retry git fetch --tags "$GIT_TAG_FETCH_PARAM"

SSHWIFTY_LAST_TAG_NAME=$(git describe --tags --abbrev=0 --always HEAD~1)
fi

echo "Version: $SSHWIFTY_VERSION"
echo "Files: $(pwd)" && ls -la
export
echo "Golang: $(go version)"
echo "NPM: $(npm version)"
export | grep -i "SSHWIFTY"
git status --short
git log --pretty=format:"- %h %s - (%an) %GK %G?" "$SSHWIFTY_LAST_TAG_NAME"..HEAD

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the build base environment
FROM ubuntu:devel AS base
FROM ubuntu:rolling AS base
RUN set -ex && \
cd / && \
echo '#!/bin/sh' > /try.sh && echo 'res=1; for i in $(seq 0 36); do $@; res=$?; [ $res -eq 0 ] && exit $res || sleep 10; done; exit $res' >> /try.sh && chmod +x /try.sh && \
Expand Down

0 comments on commit b505bef

Please sign in to comment.