Switched to node builder

This commit is contained in:
Jonathan Ervine 2020-07-21 22:12:30 +08:00
parent 474d5640bb
commit bdfa33d4a6
3 changed files with 35 additions and 23 deletions

View File

@ -10,8 +10,8 @@ ENV KUBE_LATEST_VERSION="v1.14.2"
USER root
RUN curl -L https://storage.googleapis.com/kubernetes-release/release/${KUBE_LATEST_VERSION}/bin/linux/amd64/kubectl -o /usr/local/bin/kubectl \
&& chmod +x /usr/local/bin/kubectl
RUN zypper in -y expect
&& chmod +x /usr/local/bin/kubectl && \
zypper in -y expect
COPY entrypoint.sh /home/step/
RUN chmod +x /home/step/entrypoint.sh

50
Jenkinsfile vendored
View File

@ -1,23 +1,35 @@
node("docker-node") {
docker.withRegistry('https://harbor.ervine.dev', 'jenkins-to-harbor') {
podTemplate(yaml: """
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-step_bootstrap", credentialsId: 'jenkins-to-git'
sh "git rev-parse HEAD > .git/commit-id"
def commit_id = readFile('.git/commit-id').trim()
println commit_id
try {
stage "build"
def app = docker.build "library/x86_64/suse/stepca_bootstrap"
stage "publish"
app.push("${env.BUILD_NUMBER}")
app.push("latest")
app.push("0.14.3")
}
catch (err) {
currentBuild.result = 'FAILURE'
node(POD_LABEL) {
stage('Build with Kaniko') {
git url: 'https://git.ervine.org/jonny/x86_64-suse-step_bootstrap.git', credentialsId: 'jenkins-to-git'
container('kaniko') {
sh '/kaniko/executor -f `pwd`/Dockerfile -c `pwd` --cache=true --destination=harbor.ervine.dev/library/x86_64/suse/stepca_bootstrap:0.14.3'
}
}
}
}

0
entrypoint.sh Normal file → Executable file
View File