File tree Expand file tree Collapse file tree 5 files changed +51
-4
lines changed Expand file tree Collapse file tree 5 files changed +51
-4
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,23 @@ resource_types:
55
55
through, without relying on a status being on it. This feature should only be used in
56
56
concourse version 1.2.x and higher and the [`version : every`](http://concourse.ci/get-step.html#get-version).
57
57
58
+ * `username`: *Optional.* Username for HTTP(S) auth when pulling/pushing.
59
+ This is needed when only HTTP/HTTPS protocol for git is available (which does not support private key auth)
60
+ and auth is required.
61
+
62
+ * `password`: *Optional.* Password for HTTP(S) auth when pulling/pushing.
63
+
64
+ * `skip_ssl_verification`: *Optional.* Skips git ssl verification by exporting
65
+ ` GIT_SSL_NO_VERIFY=true` .
66
+
67
+ * `git_config`: *Optional*. If specified as (list of pairs `name` and `value`)
68
+ it will configure git global options, setting each name with each value.
69
+
70
+ This can be useful to set options like `credential.helper` or similar.
71
+
72
+ See the [`git-config(1)` manual page](https://www.kernel.org/pub/software/scm/git/docs/git-config.html)
73
+ for more information and documentation of existing git options.
74
+
58
75
# # Behavior
59
76
60
77
# ## `check`: Check for new pull requests
Original file line number Diff line number Diff line change 5
5
exec 3>&1 # make stdout available as fd 3 for the result
6
6
exec 1>&2 # redirect all output to stderr for logging
7
7
8
- . $( dirname $0 ) /common.sh
9
-
10
8
payload=$( mktemp $TMPDIR /pullrequest-resource.XXXXXX)
11
9
cat > $payload < & 0
12
- load_pubkey $payload
13
10
14
11
$( dirname $0 ) /lib/check.rb $1 >&3 < $payload
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ load_pubkey() {
11
11
eval $( ssh-agent) > /dev/null 2>&1
12
12
trap " kill $SSH_AGENT_PID " 0
13
13
14
- ssh-add $private_key_path > /dev/null 2>&1
14
+ SSH_ASKPASS=/opt/resource/askpass.sh DISPLAY= ssh-add $private_key_path > /dev/null
15
15
16
16
mkdir -p ~ /.ssh
17
17
cat > ~ /.ssh/config << EOF
21
21
chmod 0600 ~ /.ssh/config
22
22
fi
23
23
}
24
+
25
+ configure_git_ssl_verification () {
26
+ skip_ssl_verification=$( jq -r ' .source.skip_ssl_verification // false' < $1 )
27
+ if [ " $skip_ssl_verification " = " true" ]; then
28
+ export GIT_SSL_NO_VERIFY=true
29
+ fi
30
+ }
31
+
32
+ configure_credentials () {
33
+ local username=$( jq -r ' .source.username // ""' < $1 )
34
+ local password=$( jq -r ' .source.password // ""' < $1 )
35
+
36
+ rm -f $HOME /.netrc
37
+ if [ " $username " != " " -a " $password " != " " ]; then
38
+ echo " default login $username password $password " > $HOME /.netrc
39
+ fi
40
+ }
41
+
42
+ configure_git_global () {
43
+ local git_config_payload=" $1 "
44
+ eval $( echo " $git_config_payload " | \
45
+ jq -r " .[] | \" git config --global '\\ (.name)' '\\ (.value)'; \" " )
46
+ }
Original file line number Diff line number Diff line change @@ -10,5 +10,10 @@ exec 1>&2 # redirect all output to stderr for logging
10
10
payload=$( mktemp $TMPDIR /pullrequest-resource.XXXXXX)
11
11
cat > $payload < & 0
12
12
load_pubkey $payload
13
+ configure_git_ssl_verification $payload
14
+ configure_credentials $payload
15
+
16
+ git_config_payload=$( jq -r ' .source.git_config // []' < $payload )
17
+ configure_git_global " ${git_config_payload} "
13
18
14
19
$( dirname $0 ) /lib/in.rb $1 >&3 < $payload
Original file line number Diff line number Diff line change @@ -10,5 +10,10 @@ exec 1>&2 # redirect all output to stderr for logging
10
10
payload=$( mktemp $TMPDIR /pullrequest-resource.XXXXXX)
11
11
cat > $payload < & 0
12
12
load_pubkey $payload
13
+ configure_git_ssl_verification $payload
14
+ configure_credentials $payload
15
+
16
+ git_config_payload=$( jq -r ' .source.git_config // []' < $payload )
17
+ configure_git_global " ${git_config_payload} "
13
18
14
19
$( dirname $0 ) /lib/out.rb $1 >&3 < $payload
You can’t perform that action at this time.
0 commit comments