Skip to content

Commit

Permalink
Fix creds
Browse files Browse the repository at this point in the history
  • Loading branch information
kobi-lemberg committed Mar 23, 2020
1 parent 0e84d09 commit 6487802
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 21 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ RUN set -x \
&& apk del --purge .build-deps \
&& rm -rf /tmp/sbt-${SBT_VER}.tgz /var/cache/apk/*

COPY github-credentials.sbt /root/.sbt/1.0/


ADD entrypoint.sh /entrypoint.sh

Expand Down
4 changes: 0 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ inputs:
command: # id of input
description: 'Commands to run'
required: true
packages-resolver: # packages resolver
description: 'packages resolver'
required: true
docker-login-username: # Docker login username
description: 'docker login username'
required: false
Expand All @@ -24,7 +21,6 @@ runs:
image: 'Dockerfile'
args:
- ${{ inputs.command }}
- ${{ inputs.packages-resolver }}
- ${{ inputs.docker-login-username }}
- ${{ inputs.docker-login-password }}
- ${{ inputs.docker-registry }}
Expand Down
22 changes: 5 additions & 17 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,15 @@

set -x
COMMAND=$1
IVY_CONF=$(echo $2 | base64 -d)
echo "Printing IVY conf"
echo $IVY_CONF
if [[ -z "${3}" || -z "${4}" || -z "${5}" ]]; then
if [[ -z "${2}" || -z "${3}" || -z "${4}" ]]; then
echo "One or more variables are not defined, will only run command"
else
DOCKER_USERNAME=$3
DOCKER_PASSWORD=$4
DOCKER_REGISTRY=$5
DOCKER_USERNAME=$2
DOCKER_PASSWORD=$3
DOCKER_REGISTRY=$4
echo "Running docker login into ${DOCKER_REGISTRY}"
echo ${DOCKER_PASSWORD} | docker login -u ${DOCKER_USERNAME} --password-stdin ${DOCKER_REGISTRY}
fi

mkdir ~/.ivy2/ || echo "Ivy folder is exists"
mkdir /root/.ivy2/ || echo "Ivy folder is exists"

echo ${IVY_CONF} > ${HOME}/.ivy2/credentials || echo "Couldn't write ivy into ~/.ivy2/credentials"
echo ${IVY_CONF} > /root/.ivy2/credentials || sudo echo ${IVY_CONF} > /root/.ivy2/credentials || echo "Couldn't write ivy into /root/.ivy2/credentials"
echo $(cat ${HOME}/.ivy2/credentials) || echo "~/.ivy2/credentials not found"
echo $(cat /root/.ivy2/credentials) || echo "/root/.ivy2/credentials"
echo "Running command"
${COMMAND}

11.0.5-1.3.8-DOCKER-IVY-CREDS8
${COMMAND}
3 changes: 3 additions & 0 deletions github-credentials.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
val username = sys.env.get("GITHUB_USERNAME").getOrElse("")
val password = sys.env.get("GITHUB_PASSWORD").getOrElse("")
credentials += Credentials("GitHub Package Registry", "maven.pkg.github.com", username, password)

0 comments on commit 6487802

Please sign in to comment.