This repository was archived by the owner on Sep 11, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +34
-12
lines changed Expand file tree Collapse file tree 3 files changed +34
-12
lines changed Original file line number Diff line number Diff line change @@ -25,15 +25,18 @@ before_script:
25
25
- make build-git
26
26
27
27
before_install :
28
- - eval "$(ssh-agent -s)"
29
- # we only decrypt the SSH key when we aren't in a pull request
30
- # - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash .travis/install_key.sh; fi'
31
- # - 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then export SSH_AUTH_SOCK="" ; fi'\
32
- # temporal fix skip of SSH test
33
- - export SSH_AUTH_SOCK=""
34
28
-
git config --global user.email "[email protected] "
35
29
- git config --global user.name "Travis CI"
36
30
31
+ # we only decrypt the SSH key when we aren't in a pull request
32
+ - >
33
+ if [ "$TRAVIS_PULL_REQUEST" = "false" ] ; then \
34
+ bash .travis/install_key.sh; \
35
+ SSH_TEST_PRIVATE_KEY=$HOME/.travis/deploy.pem; \
36
+ else \
37
+ export SSH_AUTH_SOCK=""; \
38
+ fi
39
+
37
40
install :
38
41
- go get -v -t ./...
39
42
Original file line number Diff line number Diff line change 1
- openssl aes-256-cbc -K $encrypted_1477e58fe67a_key -iv $encrypted_1477e58fe67a_iv -in .travis/deploy.pem.enc -out .travis/deploy.pem -d
1
+ #! /bin/bash
2
+ export SSH_TEST_PRIVATE_KEY=$PWD /.travis/deploy.pem
3
+
4
+ openssl aes-256-cbc \
5
+ -K $encrypted_1477e58fe67a_key \
6
+ -iv $encrypted_1477e58fe67a_iv \
7
+ -in .travis/deploy.pem.enc \
8
+ -out .travis/deploy.pem -d
9
+
2
10
chmod 600 .travis/deploy.pem
3
- ssh-add .travis/deploy.pem
11
+
Original file line number Diff line number Diff line change @@ -16,10 +16,7 @@ type UploadPackSuite struct {
16
16
var _ = Suite (& UploadPackSuite {})
17
17
18
18
func (s * UploadPackSuite ) SetUpSuite (c * C ) {
19
- if os .Getenv ("SSH_AUTH_SOCK" ) == "" {
20
- c .Skip ("SSH_AUTH_SOCK is not set" )
21
- }
22
-
19
+ s .setAuthBuilder (c )
23
20
s .UploadPackSuite .Client = DefaultClient
24
21
25
22
ep ,
err := transport .
NewEndpoint (
"[email protected] :git-fixtures/basic.git" )
@@ -34,3 +31,17 @@ func (s *UploadPackSuite) SetUpSuite(c *C) {
34
31
c .Assert (err , IsNil )
35
32
s .UploadPackSuite .NonExistentEndpoint = ep
36
33
}
34
+
35
+ func (s * UploadPackSuite ) setAuthBuilder (c * C ) {
36
+ privateKey := os .Getenv ("SSH_TEST_PRIVATE_KEY" )
37
+ if privateKey != "" {
38
+ DefaultAuthBuilder = func (user string ) (AuthMethod , error ) {
39
+ return NewPublicKeysFromFile (user , privateKey )
40
+ }
41
+ }
42
+
43
+ if privateKey == "" && os .Getenv ("SSH_AUTH_SOCK" ) == "" {
44
+ c .Skip ("SSH_AUTH_SOCK or SSH_TEST_PRIVATE_KEY are required" )
45
+ return
46
+ }
47
+ }
You can’t perform that action at this time.
0 commit comments