mirror of
https://github.com/elgohr/Publish-Docker-Github-Action.git
synced 2026-03-12 18:07:12 -04:00
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:
@@ -33,7 +33,7 @@ if [ ! -z "${INPUT_DOCKERFILE}" ]; then
|
|||||||
CUSTOMDOCKERFILE="-f ${INPUT_DOCKERFILE}"
|
CUSTOMDOCKERFILE="-f ${INPUT_DOCKERFILE}"
|
||||||
fi
|
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
|
if [ "${INPUT_SNAPSHOT}" == "true" ]; then
|
||||||
SHA_DOCKER_NAME="${INPUT_NAME}:${GITHUB_SHA}"
|
SHA_DOCKER_NAME="${INPUT_NAME}:${GITHUB_SHA}"
|
||||||
|
|||||||
14
test.sh
14
test.sh
@@ -12,7 +12,7 @@ function itPushesMasterBranchToLatest() {
|
|||||||
export INPUT_PASSWORD='PASSWORD'
|
export INPUT_PASSWORD='PASSWORD'
|
||||||
export INPUT_NAME='my/repository'
|
export INPUT_NAME='my/repository'
|
||||||
local result=$(exec /entrypoint.sh)
|
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: build -t my/repository:latest .
|
||||||
Called mock with: push my/repository:latest
|
Called mock with: push my/repository:latest
|
||||||
Called mock with: logout"
|
Called mock with: logout"
|
||||||
@@ -29,7 +29,7 @@ function itPushesBranchAsNameOfTheBranch() {
|
|||||||
export INPUT_PASSWORD='PASSWORD'
|
export INPUT_PASSWORD='PASSWORD'
|
||||||
export INPUT_NAME='my/repository'
|
export INPUT_NAME='my/repository'
|
||||||
local result=$(exec /entrypoint.sh)
|
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: build -t my/repository:myBranch .
|
||||||
Called mock with: push my/repository:myBranch
|
Called mock with: push my/repository:myBranch
|
||||||
Called mock with: logout"
|
Called mock with: logout"
|
||||||
@@ -46,7 +46,7 @@ function itPushesReleasesToLatest() {
|
|||||||
export INPUT_PASSWORD='PASSWORD'
|
export INPUT_PASSWORD='PASSWORD'
|
||||||
export INPUT_NAME='my/repository'
|
export INPUT_NAME='my/repository'
|
||||||
local result=$(exec /entrypoint.sh)
|
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: build -t my/repository:latest .
|
||||||
Called mock with: push my/repository:latest
|
Called mock with: push my/repository:latest
|
||||||
Called mock with: logout"
|
Called mock with: logout"
|
||||||
@@ -64,7 +64,7 @@ function itPushesSpecificDockerfileReleasesToLatest() {
|
|||||||
export INPUT_PASSWORD='PASSWORD'
|
export INPUT_PASSWORD='PASSWORD'
|
||||||
export INPUT_NAME='my/repository'
|
export INPUT_NAME='my/repository'
|
||||||
local result=$(exec /entrypoint.sh)
|
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: build -f MyDockerFileName -t my/repository:latest .
|
||||||
Called mock with: push my/repository:latest
|
Called mock with: push my/repository:latest
|
||||||
Called mock with: logout"
|
Called mock with: logout"
|
||||||
@@ -84,7 +84,7 @@ function itPushesBranchByShaInAddition() {
|
|||||||
export INPUT_PASSWORD='PASSWORD'
|
export INPUT_PASSWORD='PASSWORD'
|
||||||
export INPUT_NAME='my/repository'
|
export INPUT_NAME='my/repository'
|
||||||
local result=$(exec /entrypoint.sh)
|
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: build -t my/repository:latest -t my/repository:COMMIT_SHA .
|
||||||
Called mock with: push my/repository:latest
|
Called mock with: push my/repository:latest
|
||||||
Called mock with: push my/repository:COMMIT_SHA
|
Called mock with: push my/repository:COMMIT_SHA
|
||||||
@@ -106,7 +106,7 @@ function itPushesBranchByShaInAdditionWithSpecificDockerfile() {
|
|||||||
export INPUT_PASSWORD='PASSWORD'
|
export INPUT_PASSWORD='PASSWORD'
|
||||||
export INPUT_NAME='my/repository'
|
export INPUT_NAME='my/repository'
|
||||||
local result=$(exec /entrypoint.sh)
|
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: 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:latest
|
||||||
Called mock with: push my/repository:COMMIT_SHA
|
Called mock with: push my/repository:COMMIT_SHA
|
||||||
@@ -126,7 +126,7 @@ function itLogsIntoAnotherRegistryIfConfigured() {
|
|||||||
export INPUT_REGISTRY='https://myRegistry'
|
export INPUT_REGISTRY='https://myRegistry'
|
||||||
export INPUT_NAME='my/repository'
|
export INPUT_NAME='my/repository'
|
||||||
local result=$(exec /entrypoint.sh)
|
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: build -t my/repository:latest .
|
||||||
Called mock with: push my/repository:latest
|
Called mock with: push my/repository:latest
|
||||||
Called mock with: logout"
|
Called mock with: logout"
|
||||||
|
|||||||
Reference in New Issue
Block a user