Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
if: "!contains(github.event.head_commit.message, 'skip ci')"
uses: actions/checkout@v2
with:
ref: 'patch'
repository: 'kbaseapps/kb_sdk_actions'
path: 'kb_sdk_actions'

Expand All @@ -36,10 +37,10 @@ jobs:
KBASE_TEST_TOKEN: ${{ secrets.KBASE_TEST_TOKEN }}
run: |
# Verify kb_sdk_actions clone worked
test -f "$HOME/kb_sdk_actions/bin/kb-sdk" && echo "CI files cloned"
test -f "$GITHUB_WORKSPACE/kb_sdk_actions/bin/kb-sdk" && echo "CI files cloned"
# Pull kb-sdk & create startup script
docker pull kbase/kb-sdk
docker pull ghcr.io/kbase/kb_sdk_patch-develop:br-0.0.4

sh $GITHUB_WORKSPACE/kb_sdk_actions/bin/make_testdir && echo "Created test_local"
test -f "test_local/test.cfg" && echo "Confirmed config exists"

Expand Down
13 changes: 11 additions & 2 deletions bin/kb-sdk
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
#!/bin/sh

KB_SDK_IMAGE="ghcr.io/kbase/kb_sdk_patch-develop:br-0.0.4"

# Cache the group for the docker file
if [ ! -e $HOME/.kbsdk.cache ] ; then
docker run -i -v /var/run/docker.sock:/var/run/docker.sock --entrypoint ls kbase/kb-sdk -l /var/run/docker.sock|awk '{print $4}' > $HOME/.kbsdk.cache
docker run -i -v /var/run/docker.sock:/var/run/docker.sock \
--entrypoint ls $KB_SDK_IMAGE -l /var/run/docker.sock | \
awk '{print $4}' > $HOME/.kbsdk.cache
fi

exec docker run -i --rm -v $HOME:$HOME -u $(id -u) -w $(pwd) -v /var/run/docker.sock:/var/run/docker.sock -e DUSER=$USER -e DSHELL=$SHELL --group-add $(cat $HOME/.kbsdk.cache) kbase/kb-sdk $@
exec docker run -i --rm \
-v $HOME:$HOME -u $(id -u) -w $(pwd) \
-v /var/run/docker.sock:/var/run/docker.sock \
-e DUSER=$USER -e DSHELL=$SHELL \
--group-add $(cat $HOME/.kbsdk.cache) \
$KB_SDK_IMAGE $@
15 changes: 12 additions & 3 deletions bin/make_testdir
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,19 @@
# Disable the default `return 1` when creating `test_local`
set +e

KB_SDK_IMAGE="ghcr.io/kbase/kb_sdk_patch-develop:br-0.0.4"

# Cache the group for the docker file
if [ ! -e $HOME/.kbsdk.cache ] ; then
docker run -i -v /var/run/docker.sock:/var/run/docker.sock --entrypoint ls kbase/kb-sdk -l /var/run/docker.sock|awk '{print $4}' > $HOME/.kbsdk.cache
docker run -i -v /var/run/docker.sock:/var/run/docker.sock \
--entrypoint ls $KB_SDK_IMAGE -l /var/run/docker.sock | \
awk '{print $4}' > $HOME/.kbsdk.cache
fi

exec docker run -i --rm -v $HOME:$HOME -u $(id -u) -w $(pwd) -v /var/run/docker.sock:/var/run/docker.sock -e DUSER=$USER -e DSHELL=$SHELL --group-add $(cat $HOME/.kbsdk.cache) kbase/kb-sdk test
exit
exec docker run -i --rm \
-v $HOME:$HOME -u $(id -u) -w $(pwd) \
-v /var/run/docker.sock:/var/run/docker.sock \
-e DUSER=$USER -e DSHELL=$SHELL \
--group-add $(cat $HOME/.kbsdk.cache) \
$KB_SDK_IMAGE test
exit