Get Docker Password from StdIn. Should not have been a problem in the past as the containers are thrown away after the run, but lets be sure.

This commit is contained in:
Lars Gohr
2019-08-24 00:00:35 +02:00
parent 7f8a8d4a00
commit 12169ed809
2 changed files with 8 additions and 8 deletions

View File

@@ -33,7 +33,7 @@ if [ ! -z "${INPUT_DOCKERFILE}" ]; then
CUSTOMDOCKERFILE="-f ${INPUT_DOCKERFILE}"
fi
docker login -u ${INPUT_USERNAME} -p ${INPUT_PASSWORD} ${INPUT_REGISTRY}
echo ${INPUT_PASSWORD} | docker login -u ${INPUT_USERNAME} --password-stdin ${INPUT_REGISTRY}
if [ "${INPUT_SNAPSHOT}" == "true" ]; then
SHA_DOCKER_NAME="${INPUT_NAME}:${GITHUB_SHA}"

14
test.sh
View File

@@ -12,7 +12,7 @@ function itPushesMasterBranchToLatest() {
export INPUT_PASSWORD='PASSWORD'
export INPUT_NAME='my/repository'
local result=$(exec /entrypoint.sh)
local expected="Called mock with: login -u USERNAME -p PASSWORD
local expected="Called mock with: login -u USERNAME --password-stdin
Called mock with: build -t my/repository:latest .
Called mock with: push my/repository:latest
Called mock with: logout"
@@ -29,7 +29,7 @@ function itPushesBranchAsNameOfTheBranch() {
export INPUT_PASSWORD='PASSWORD'
export INPUT_NAME='my/repository'
local result=$(exec /entrypoint.sh)
local expected="Called mock with: login -u USERNAME -p PASSWORD
local expected="Called mock with: login -u USERNAME --password-stdin
Called mock with: build -t my/repository:myBranch .
Called mock with: push my/repository:myBranch
Called mock with: logout"
@@ -46,7 +46,7 @@ function itPushesReleasesToLatest() {
export INPUT_PASSWORD='PASSWORD'
export INPUT_NAME='my/repository'
local result=$(exec /entrypoint.sh)
local expected="Called mock with: login -u USERNAME -p PASSWORD
local expected="Called mock with: login -u USERNAME --password-stdin
Called mock with: build -t my/repository:latest .
Called mock with: push my/repository:latest
Called mock with: logout"
@@ -64,7 +64,7 @@ function itPushesSpecificDockerfileReleasesToLatest() {
export INPUT_PASSWORD='PASSWORD'
export INPUT_NAME='my/repository'
local result=$(exec /entrypoint.sh)
local expected="Called mock with: login -u USERNAME -p PASSWORD
local expected="Called mock with: login -u USERNAME --password-stdin
Called mock with: build -f MyDockerFileName -t my/repository:latest .
Called mock with: push my/repository:latest
Called mock with: logout"
@@ -84,7 +84,7 @@ function itPushesBranchByShaInAddition() {
export INPUT_PASSWORD='PASSWORD'
export INPUT_NAME='my/repository'
local result=$(exec /entrypoint.sh)
local expected="Called mock with: login -u USERNAME -p PASSWORD
local expected="Called mock with: login -u USERNAME --password-stdin
Called mock with: build -t my/repository:latest -t my/repository:COMMIT_SHA .
Called mock with: push my/repository:latest
Called mock with: push my/repository:COMMIT_SHA
@@ -106,7 +106,7 @@ function itPushesBranchByShaInAdditionWithSpecificDockerfile() {
export INPUT_PASSWORD='PASSWORD'
export INPUT_NAME='my/repository'
local result=$(exec /entrypoint.sh)
local expected="Called mock with: login -u USERNAME -p PASSWORD
local expected="Called mock with: login -u USERNAME --password-stdin
Called mock with: build -f MyDockerFileName -t my/repository:latest -t my/repository:COMMIT_SHA .
Called mock with: push my/repository:latest
Called mock with: push my/repository:COMMIT_SHA
@@ -126,7 +126,7 @@ function itLogsIntoAnotherRegistryIfConfigured() {
export INPUT_REGISTRY='https://myRegistry'
export INPUT_NAME='my/repository'
local result=$(exec /entrypoint.sh)
local expected="Called mock with: login -u USERNAME -p PASSWORD https://myRegistry
local expected="Called mock with: login -u USERNAME --password-stdin https://myRegistry
Called mock with: build -t my/repository:latest .
Called mock with: push my/repository:latest
Called mock with: logout"