a
gitea/sample-test/pipeline/head There was a failure building this commit Details

main
onikolskyy 1 year ago
parent c249b37f38
commit b483945cc0

61
Jenkinsfile vendored

@ -1,33 +1,40 @@
version="1.0.0" pipeline {
repository="swr.eu-de.otc.t-systems.com" agent {
tag="latest" kubernetes {
image="swr.eu-de.otc.t-systems.com/omnia-test/${repository}:${version}.${env.BUILD_NUMBER}" yaml """\
namespace="demo" apiVersion: v1
kind: Pod
podTemplate(label: 'pod', cloud: 'kubernetes', serviceAccount: 'jenkins-agent-sa', metadata:
imagePullSecrets: [ name: 'jenkins-slave'
'default-secret' namespace: 'your-namespace'
], spec:
containers: [ containers:
containerTemplate( - name: docker
name: 'docker', image: 'swr.eu-de.otc.t-systems.com/base-image/docker:dind', ttyEnabled: true, command: 'cat', privileged: true, image: swr.eu-de.otc.t-systems.com/base-image/docker:dind
envVars: [ tty: true
secretEnvVar(key: "PASS", secretName: "docker-reg", secretKey: "docker-reg") imagePullPolicy: Always
] imagePullSecrets:
), - name: default-secret
], env:
) { - name: PASS
node('pod') { valueFrom:
stage('Build Docker Image') { secretKeyRef:
name: docker-reg
key: docker-reg
""".stripIndent()
}
}
stages {
stage('Build Docker Image') {
container('docker') { container('docker') {
sh """ sh """
docker login ${env.PASS} swr.eu-de.otc.t-systems.com image="swr.eu-de.otc.t-systems.com/omnia-test/test-build:latest"
docker build -t ${image}:${tag} . docker login ${PASS} swr.eu-de.otc.t-systems.com
docker push ${image}:${tag} docker build -t ${image} .
docker push ${image}
""" """
milestone(1) milestone(1)
} }
} }
} }
} }

@ -0,0 +1,33 @@
version="1.0.0"
repository="swr.eu-de.otc.t-systems.com"
tag="latest"
image="swr.eu-de.otc.t-systems.com/omnia-test/${repository}:${version}.${env.BUILD_NUMBER}"
namespace="demo"
podTemplate(label: 'pod', cloud: 'kubernetes', serviceAccount: 'jenkins-agent-sa',
imagePullSecrets: [
'default-secret'
],
containers: [
containerTemplate(
name: 'docker', image: 'swr.eu-de.otc.t-systems.com/base-image/docker:dind', ttyEnabled: true, command: 'cat', privileged: true,
envVars: [
secretEnvVar(key: "PASS", secretName: "docker-reg", secretKey: "docker-reg")
]
),
],
) {
node('pod') {
stage('Build Docker Image') {
container('docker') {
sh """
docker login ${env.PASS} swr.eu-de.otc.t-systems.com
docker build -t ${image}:${tag} .
docker push ${image}:${tag}
"""
milestone(1)
}
}
}
}
Loading…
Cancel
Save