Skip to content

Commit

Permalink
ci: use go builder container
Browse files Browse the repository at this point in the history
  • Loading branch information
xhalo32 committed Sep 6, 2023
1 parent c39c3f0 commit b2f85bc
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 14 deletions.
1 change: 1 addition & 0 deletions ci/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
jenkins/
16 changes: 9 additions & 7 deletions ci/casc/jenkins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ credentials:
system:
domainCredentials:
- credentials:
- usernamePassword:
description: "vagrant"
id: "vagrant"
password: "vagrant"
- basicSSHUserPrivateKey:
id: "ssh_id"
privateKeySource:
directEntry:
privateKey: "${readFile:/tmp/id_ed25519}"
scope: GLOBAL
username: "vagrant"
username: "root"

jenkins:
labelAtoms:
- name: "build"
Expand All @@ -17,8 +19,8 @@ jenkins:
labelString: "build"
launcher:
ssh:
credentialsId: "vagrant"
host: "172.17.0.1"
credentialsId: "ssh_id"
host: "builder"
port: 22
sshHostKeyVerificationStrategy: "nonVerifyingKeyVerificationStrategy"
name: "build"
Expand Down
23 changes: 16 additions & 7 deletions ci/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ services:
- 8080:8080
container_name: jenkins
volumes:
- ~/jenkins:/var/jenkins_home
- /var/run/docker.sock:/var/run/docker.sock
- /usr/local/bin/docker:/usr/local/bin/docker
- /home/vagrant/project/ci/casc:/var/casc/
- ./jenkins:/var/jenkins_home
# - /var/run/docker.sock:/var/run/docker.sock
# - /usr/local/bin/docker:/usr/local/bin/docker
- ./casc:/var/casc/
- ./id_ed25519:/tmp/id_ed25519
environment:
JAVA_OPTS: -Djenkins.install.runSetupWizard=false
JENKINS_OPTS: --argumentsRealm.roles.user=admin --argumentsRealm.passwd.admin=admin --argumentsRealm.roles.admin=admin # bad idea, this is to ease up the setup
Expand All @@ -23,12 +24,20 @@ services:
ports:
- "3000:3000"
volumes:
- ~/grafana:/var/lib/grafana/
- ./grafana:/var/lib/grafana/
restart: unless-stopped
influxdb:
image: influxdb:1.8.10
ports:
- "8086:8086"
volumes:
- ~/influxdb:/var/lib/influxdb/
restart: always
- ./influxdb:/var/lib/influxdb/
restart: always

builder:
build:
context: .
dockerfile: ./go-docker
restart: unless-stopped
ports:
- "9000:22"
15 changes: 15 additions & 0 deletions ci/go-docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM golang:1.20

USER root

RUN apt-get update
RUN apt-get install -y openssh-server default-jre
RUN apt-get clean
RUN service ssh start

COPY ./id_ed25519.pub /root/.ssh/
RUN cp /root/.ssh/id_ed25519.pub /root/.ssh/authorized_keys

EXPOSE 22

ENTRYPOINT ["/usr/sbin/sshd", "-D"]
7 changes: 7 additions & 0 deletions ci/id_ed25519
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACAjFPPtqRP/wrxiEBQCIlWICWqmV9JeBirun6ufjX0WxQAAAJhlV1SZZVdU
mQAAAAtzc2gtZWQyNTUxOQAAACAjFPPtqRP/wrxiEBQCIlWICWqmV9JeBirun6ufjX0WxQ
AAAEDMajuuf3mGTbhwZ+tGmVea4r1f6YAZOF2XL08OBG5RaSMU8+2pE//CvGIQFAIiVYgJ
aqZX0l4GKu6fq5+NfRbFAAAADm5pa2xhc2hAZmVkb3JhAQIDBAUGBw==
-----END OPENSSH PRIVATE KEY-----
1 change: 1 addition & 0 deletions ci/id_ed25519.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICMU8+2pE//CvGIQFAIiVYgJaqZX0l4GKu6fq5+NfRbF

0 comments on commit b2f85bc

Please sign in to comment.