File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 1+ ### 0.7.0 (2019-May-01)
2+ * added ` secret_ops::docker_login `
3+
14### 0.6.3 (2019-Apr-23)
25
36 * added license notes
Original file line number Diff line number Diff line change @@ -104,3 +104,12 @@ function secret_ops::insert_vault_token_gocd_yaml {
104104function secret_ops::insert_vault_token_gocd_yaml2 {
105105 secret_ops::insert_vault_token_gocd_yaml $1
106106}
107+
108+ function secret_ops::docker_login {
109+ vault_user_path=$USER
110+ if [ $vault_user_path == " go" ]; then
111+ vault_user_path=" gocd"
112+ fi
113+ dockerhub_user=$( vault read -field=user secret/$vault_user_path /dockerhub)
114+ vault read -field=password secret/$vault_user_path /dockerhub | docker login --username $dockerhub_user --password-stdin
115+ }
Original file line number Diff line number Diff line change @@ -62,3 +62,11 @@ load '/opt/bats-assert/load.bash'
6262 echo " output: $output "
6363 assert_equal " $status " 0
6464}
65+
66+ @test " secret_ops::docker_login should succeed" {
67+ run /bin/bash -c " source src/secret-ops && secret_ops::docker_login"
68+ assert_line --partial " Login Succeeded"
69+ # this is printed on test failure
70+ echo " output: $output "
71+ assert_equal " $status " 0
72+ }
You can’t perform that action at this time.
0 commit comments