Skip to content

Commit

Permalink
Rename submodules to submodule_credentials
Browse files Browse the repository at this point in the history
Signed-off-by: Simeon Korchev <simeonkorchev@gmail.com>
  • Loading branch information
i340033 authored and simeonkorchev committed Dec 17, 2019
1 parent 7a2277b commit 5192a1d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ Tracks the commits in a [git](http://git-scm.com/) repository.
the `branch`. Patterns are [glob(7)](http://man7.org/linux/man-pages/man7/glob.7.html)
compatible (as in, bash compatible).
* `submodules`: *Optional.* List of credentials for HTTP(s) auth when pulling/pushing private git submodules which are not stored in the same git server as the container repository.
* `submodule_credentials`: *Optional.* List of credentials for HTTP(s) auth when pulling/pushing private git submodules which are not stored in the same git server as the container repository.
Example:
```
submodules:
submodule_credentials:
- host: github.com
username: git-user
password: git-password
Expand Down Expand Up @@ -144,7 +144,7 @@ resources:
source:
uri: git@github.com:concourse/git-resource.git
branch: master
submodules:
submodule_credentials:
- host: some.other.git.server
username: user
password: verysecurepassword
Expand Down
10 changes: 5 additions & 5 deletions assets/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,14 @@ git_metadata() {
configure_submodule_credentials() {
local username
local password
if [[ "$(jq -r '.source.submodules // ""' < "$1")" == "" ]]; then
if [[ "$(jq -r '.source.submodule_credentials // ""' < "$1")" == "" ]]; then
return
fi

for k in $(jq -r '.source.submodules | keys | .[]' < "$1"); do
host=$(jq -r --argjson k "$k" '.source.submodules[$k].host // ""' < "$1")
username=$(jq -r --argjson k "$k" '.source.submodules[$k].username // ""' < "$1")
password=$(jq -r --argjson k "$k" '.source.submodules[$k].password // ""' < "$1")
for k in $(jq -r '.source.submodule_credentials | keys | .[]' < "$1"); do
host=$(jq -r --argjson k "$k" '.source.submodule_credentials[$k].host // ""' < "$1")
username=$(jq -r --argjson k "$k" '.source.submodule_credentials[$k].username // ""' < "$1")
password=$(jq -r --argjson k "$k" '.source.submodule_credentials[$k].password // ""' < "$1")
if [ "$username" != "" -a "$password" != "" -a "$host" != "" ]; then
echo "machine $host login $username password $password" >> "${HOME}/.netrc"
fi
Expand Down
2 changes: 1 addition & 1 deletion test/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ check_uri_with_submodule_credentials() {
uri: $(echo $1 | jq -R .),
username: $(echo $2 | jq -R .),
password: $(echo $3 | jq -R .),
submodules: [
submodule_credentials: [
{
host: $(echo $4 | jq -R .),
username: $(echo $5 | jq -R .),
Expand Down

0 comments on commit 5192a1d

Please sign in to comment.