Skip to content

Commit

Permalink
Make docker login to be configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
kobi-lemberg committed Mar 17, 2020
1 parent af20364 commit d23bacd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
8 changes: 4 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ name: 'Scala SBT Action'
author: 'Matan Keidar <[email protected]>'
description: 'SBT build tool action with docker'
inputs:
commands: # id of input
command: # id of input
description: 'Commands to run'
required: true
docker-login-username: # Docker login username
description: 'docker login username'
required: true
required: false
docker-login-password: # Docker login password
description: 'docker login password'
required: true
required: false
docker-registry: # Docker registry
description: 'docker registry'
required: true
required: false
runs:
using: 'docker'
image: 'Dockerfile'
Expand Down
20 changes: 14 additions & 6 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
#!/bin/sh

sbt version
set -x
COMMAND=""

DOCKER_USERNAME=$1
DOCKER_PASSWORD=$2
DOCKER_REGISTRY=$3
if [[ -z ${1} || -z ${2} || -z ${3} ]]; then
echo "One or more variables are not defined, will run command"
COMMAND = $1
else
DOCKER_USERNAME=$1
DOCKER_PASSWORD=$2
DOCKER_REGISTRY=$3
COMMAND=$4
echo "Running docker login into ${DOCKER_REGISTRY}"

echo ${DOCKER_PASSWORD} | docker login -u ${DOCKER_USERNAME} --password-stdin ${DOCKER_REGISTRY}
echo ${DOCKER_PASSWORD} | docker login -u ${DOCKER_USERNAME} --password-stdin ${DOCKER_REGISTRY}
fi

$4
echo "Running command"
${COMMAND}

0 comments on commit d23bacd

Please sign in to comment.