File tree Expand file tree Collapse file tree
builder/image/slugbuilder/builder Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,6 +87,18 @@ if [[ -n "$BUILDPACK_URL" ]]; then
8787 committish=" master"
8888 fi
8989
90+ if [[ -n " $SSH_KEY " ]]; then
91+ mkdir -p ~ /.ssh/
92+ chmod 700 ~ /.ssh/
93+
94+ echo $SSH_KEY | base64 -d > ~ /.ssh/id_rsa
95+ chmod 400 ~ /.ssh/id_rsa
96+
97+ echo ' StrictHostKeyChecking=no' > ~ /.ssh/config
98+ chmod 600 ~ /.ssh/config
99+
100+ fi
101+
90102 set +e
91103 git clone --branch " $committish " --depth=1 " $url " " $buildpack " & > /dev/null
92104 SHALLOW_CLONED=$?
Original file line number Diff line number Diff line change 4848from itertools import cycle
4949from threading import Event
5050from threading import Thread
51+ from base64 import b64encode
5152import glob
5253import json
5354import locale
@@ -1039,6 +1040,18 @@ def config_set(self, args):
10391040 if not app :
10401041 app = self ._session .app
10411042 values = dictify (args ['<var>=<value>' ])
1043+ if values .get ('SSH_KEY' ):
1044+ if os .path .isfile (values .get ('SSH_KEY' )):
1045+ with open (values .get ('SSH_KEY' )) as f :
1046+ ssh_key = f .read ()
1047+ else :
1048+ ssh_key = values ['SSH_KEY' ]
1049+ match = re .match (r'^-.+ .SA PRIVATE KEY-*' , ssh_key )
1050+ if match :
1051+ values ['SSH_KEY' ] = b64encode (ssh_key )
1052+ else :
1053+ self ._logger .error ("Could not parse SSH private key {}" .format (ssh_key ))
1054+ sys .exit (1 )
10421055 self ._config_set (app , values )
10431056
10441057 def _config_set (self , app , values ):
Original file line number Diff line number Diff line change @@ -27,6 +27,29 @@ Use ``deis create`` to create an application on the :ref:`controller`.
2727 Creating application... done, created unisex-huntress
2828 Git remote deis added
2929
30+ Optional: Add SSH KEY to use private repositories
31+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
32+
33+ To pull code from private repositories, you'll need to provide Deis with a private SSH key which has access.
34+
35+ You can do so with deis client:
36+
37+
38+ Using private key file:
39+
40+ .. code-block :: console
41+
42+ $ deis config:set SSH_KEY=/home/user/.ssh/id_rsa
43+
44+
45+ You can also use a raw key instead of a private key file:
46+
47+ .. code-block :: console
48+
49+ $ deis config:set SSH_KEY="""-----BEGIN RSA PRIVATE KEY-----
50+ (...)
51+ -----END RSA PRIVATE KEY-----"""
52+
3053 Push to Deploy
3154--------------
3255Use ``git push deis master `` to deploy your application.
You can’t perform that action at this time.
0 commit comments