Skip to content

Commit 2b4b27e

Browse files
committed
fixes
1 parent d41a845 commit 2b4b27e

4 files changed

Lines changed: 8 additions & 27 deletions

File tree

deploy/infrabox/templates/function_crd.yaml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ spec:
3434
-
3535
mountPath: /local-cache
3636
name: local-cache
37-
{{ end }}
38-
{{ if .Values.gerrit.enabled }}
39-
-
40-
mountPath: /var/run/gerrit/
41-
name: gerrit-ssh
4237
{{ end }}
4338
volumes:
4439
-
@@ -54,9 +49,3 @@ spec:
5449
hostPath:
5550
path: {{ default "/tmp/infrabox/local_cache" .Values.local_cache.host_path }}
5651
{{ end }}
57-
{{ if .Values.gerrit.enabled }}
58-
-
59-
name: gerrit-ssh
60-
secret:
61-
secretName: infrabox-gerrit-ssh
62-
{{ end }}

src/api/handlers/projects/projects.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,15 @@ def post(self):
158158
owner = split[0]
159159
repo_name = split[1]
160160

161+
clone_url = repo['clone_url']
162+
if repo['private']:
163+
clone_url = repo['ssh_url']
164+
161165
g.db.execute('''
162166
INSERT INTO repository (name, html_url, clone_url, github_id,
163167
private, project_id, github_owner)
164168
VALUES (%s, %s, %s, %s, %s, %s, %s)
165-
''', [repo['name'], repo['html_url'], repo['clone_url'],
169+
''', [repo['name'], repo['html_url'], clone_url,
166170
repo['id'], repo['private'], project_id, repo['owner']['login']])
167171

168172
insecure_ssl = "0"

src/job/entrypoint.sh

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,14 @@ else
3131
echo "Using host docker daemon socket"
3232
fi
3333

34-
if [ -z "$INFRABOX_GIT_PRIVATE_KEY" ]; then
34+
if [ ! -z "$INFRABOX_GIT_PRIVATE_KEY" ]; then
3535
echo "Setting private key"
3636
eval `ssh-agent -s`
3737
echo $INFRABOX_GIT_PRIVATE_KEY > ~/.ssh/id_rsa
3838
chmod 600 ~/.ssh/id_rsa
3939
echo "StrictHostKeyChecking no" > ~/.ssh/config
4040
ssh-add ~/.ssh/id_rsa
4141
ssh-keyscan -p $INFRABOX_GIT_PORT $INFRABOX_GIT_HOSTNAME >> ~/.ssh/known_hosts
42-
fi
43-
44-
if [ -f /var/run/gerrit/id_rsa ]; then
45-
echo "Setting private key"
46-
eval `ssh-agent -s`
47-
cp /var/run/gerrit/id_rsa ~/.ssh/id_rsa
48-
chmod 600 ~/.ssh/id_rsa
49-
echo "StrictHostKeyChecking no" > ~/.ssh/config
50-
ssh-add ~/.ssh/id_rsa
51-
ssh-keyscan -p $INFRABOX_GERRIT_PORT $INFRABOX_GERRIT_HOSTNAME >> ~/.ssh/known_hosts
5242
else
5343
echo "No private key configured"
5444
fi

src/scheduler/kubernetes/scheduler.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ def kube_job(self, job_id, cpu, mem, private_key, services=None):
564564
if private_key:
565565
env += [{
566566
'name': 'INFRABOX_GIT_PORT',
567-
'value': 443
567+
'value': '443'
568568
}, {
569569
'name': 'INFRABOX_GIT_HOSTNAME',
570570
'value': 'github.com'
@@ -602,8 +602,6 @@ def kube_job(self, job_id, cpu, mem, private_key, services=None):
602602
}
603603
},
604604
'env': env,
605-
'volumes': volumes,
606-
'volumeMounts': volumeMounts
607605
}
608606
}
609607
}
@@ -656,7 +654,7 @@ def schedule_job(self, job_id, cpu, memory):
656654
cursor = self.conn.cursor()
657655
cursor.execute('''
658656
SELECT r.private_key
659-
FROM repositor r
657+
FROM repository r
660658
WHERE r.project_id = %s
661659
''', [project_id])
662660
result = cursor.fetchone()

0 commit comments

Comments
 (0)