Switched to node builder

This commit is contained in:
Jonathan Ervine 2020-07-21 22:07:55 +08:00
parent 1509425c99
commit 50b608438a
3 changed files with 36 additions and 25 deletions

View File

@ -1,5 +1,5 @@
# Base on latest (edge) alpine image # Base on latest (edge) alpine image
FROM opensuse/leap:15.1 FROM opensuse/leap:15.2
MAINTAINER “Jonathan Ervine” <docker@ervine.org> MAINTAINER “Jonathan Ervine” <docker@ervine.org>
@ -27,9 +27,8 @@ RUN wget https://github.com/smallstep/certificates/releases/download/v$STEP_VERS
RUN wget https://github.com/smallstep/cli/releases/download/v$STEP_VERSION/step_linux_$STEP_VERSION\_amd64.tar.gz && \ RUN wget https://github.com/smallstep/cli/releases/download/v$STEP_VERSION/step_linux_$STEP_VERSION\_amd64.tar.gz && \
tar zxvf step_linux_$STEP_VERSION\_amd64.tar.gz -C /tmp/ && \ tar zxvf step_linux_$STEP_VERSION\_amd64.tar.gz -C /tmp/ && \
mv /tmp/step_$STEP_VERSION/bin/step /usr/local/bin/ mv /tmp/step_$STEP_VERSION/bin/step /usr/local/bin/ && \
rm -rf step_linux_$STEP_VERSION\_amd64.tar.gz /tmp/step_$STEP_VERSION /tmp/step-certificates_$STEP_VERSION
RUN rm -rf step_linux_$STEP_VERSION\_amd64.tar.gz /tmp/step_$STEP_VERSION /tmp/step-certificates_$STEP_VERSION
EXPOSE 9000/tcp EXPOSE 9000/tcp

50
Jenkinsfile vendored
View File

@ -1,23 +1,35 @@
node("docker-node") { podTemplate(yaml: """
docker.withRegistry('https://harbor.ervine.dev', 'jenkins-to-harbor') { kind: Pod
spec:
containers:
- name: kaniko
image: gcr.io/kaniko-project/executor:debug-539ddefcae3fd6b411a95982a830d987f4214251
imagePullPolicy: Always
command:
- /busybox/cat
tty: true
volumeMounts:
- name: jenkins-docker-cfg
mountPath: /kaniko/.docker
volumes:
- name: jenkins-docker-cfg
projected:
sources:
- secret:
name: regcred
items:
- key: .dockerconfigjson
path: config.json
"""
) {
git branch: "master", url: "ssh://git@git.ervine.org:2222/jonny/x86_64-suse-stepCA", credentialsId: 'jenkins-to-git' node(POD_LABEL) {
stage('Build with Kaniko') {
sh "git rev-parse HEAD > .git/commit-id" git url: 'ssh://git@git.ervine.org/jonny/x86_64-suse-stepCA.git', credentialsId: 'jenkins-to-git'
def commit_id = readFile('.git/commit-id').trim() container('kaniko') {
println commit_id sh '/kaniko/executor -f `pwd`/Dockerfile -c `pwd` --cache=true --destination=harbor.ervine.dev/library/x86_64/suse/stepca:0.14.3'
try {
stage "build"
def app = docker.build "library/x86_64/suse/stepca"
stage "publish"
app.push("${env.BUILD_NUMBER}")
app.push("latest")
app.push("0.14.3")
}
catch (err) {
currentBuild.result = 'FAILURE'
} }
} }
} }
}

0
start.sh Normal file → Executable file
View File