containers: hack credential helper
This commit is contained in:
parent
981de38644
commit
cedd8218c4
2 changed files with 41 additions and 0 deletions
36
bin/executable_docker-credential-gopass
Normal file
36
bin/executable_docker-credential-gopass
Normal file
|
@ -0,0 +1,36 @@
|
|||
#!/bin/zsh
|
||||
|
||||
set -e
|
||||
|
||||
trap 'echo {} ; exit 0' ERR
|
||||
|
||||
add() {
|
||||
gopass insert -f docker/$serverurl <<END
|
||||
$secret
|
||||
login: $login
|
||||
END
|
||||
}
|
||||
|
||||
case $1 in
|
||||
get)
|
||||
read serverurl || true
|
||||
[[ -n $serverurl ]]
|
||||
pass="$(gopass show --password docker/$serverurl)"
|
||||
login="$(gopass show --password docker/$serverurl login)"
|
||||
jo serverurl=dhub.corp.metrans.cz username=$login secret=$pass
|
||||
exit ;;
|
||||
store)
|
||||
jq '.username+"|"+.secret+"|"+.serverurl' | IFS='|' read login secret serverurl
|
||||
add
|
||||
exit ;;
|
||||
erase)
|
||||
read serverurl
|
||||
[[ -z $serverurl ]] && exit 1
|
||||
gopass delete -f docker/$serverurl
|
||||
exit ;;
|
||||
list)
|
||||
gopass ls --flat -s docker | jq -R | jq -s
|
||||
exit ;;
|
||||
esac
|
||||
|
||||
echo "get|list|store|erase"
|
5
dot_config/containers/auth.json
Normal file
5
dot_config/containers/auth.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"credHelpers": {
|
||||
"dhub.corp.metrans.cz": "gopass"
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue