
3 changed files with 113 additions and 105 deletions
@ -1,97 +1,104 @@ |
|||||
podTemplate(yaml: ''' |
podTemplate(yaml: ''' |
||||
apiVersion: v1 |
apiVersion: v1 |
||||
kind: Pod |
kind: Pod |
||||
spec: |
spec: |
||||
volumes: |
volumes: |
||||
- name: docker-socket |
- name: docker-socket |
||||
emptyDir: {} |
emptyDir: {} |
||||
- name: docker-local-certs |
- name: docker-local-certs |
||||
configMap: |
configMap: |
||||
name: docker-cert |
name: docker-cert |
||||
containers: |
containers: |
||||
- name: docker |
- name: docker |
||||
image: docker:19.03.1 |
image: docker:19.03.1 |
||||
command: |
command: |
||||
- sleep |
- sleep |
||||
args: |
args: |
||||
- 99d |
- 99d |
||||
volumeMounts: |
volumeMounts: |
||||
- name: docker-socket |
- name: docker-socket |
||||
mountPath: /var/run |
mountPath: /var/run |
||||
- name: docker-daemon |
- name: docker-daemon |
||||
image: docker:19.03.1-dind |
image: docker:19.03.1-dind |
||||
securityContext: |
securityContext: |
||||
privileged: true |
privileged: true |
||||
volumeMounts: |
volumeMounts: |
||||
- name: docker-socket |
- name: docker-socket |
||||
mountPath: /var/run |
mountPath: /var/run |
||||
- name: docker-local-certs |
- name: docker-local-certs |
||||
mountPath: /etc/docker/certs.d/docker.local |
mountPath: /etc/docker/certs.d/docker.local |
||||
- name: python |
- name: python |
||||
image: docker.local/ci/python:latest |
image: docker.local/ci/python:latest |
||||
imagePullPolicy: Always |
imagePullPolicy: Always |
||||
command: |
command: |
||||
- sleep |
- sleep |
||||
args: |
args: |
||||
- 99d |
- 99d |
||||
- name: helm |
- name: helm |
||||
image: docker.local/ci/helm:latest |
image: docker.local/ci/helm:latest |
||||
imagePullPolicy: Always |
imagePullPolicy: Always |
||||
env: |
env: |
||||
- name: KUBECONFIG |
- name: KUBECONFIG |
||||
value: /home/jenkins/agent/workspace/gitea-bme_covidok-backend_master/ci/kube.config |
value: /home/jenkins/agent/workspace/gitea-bme_covidok-backend_master/ci/kube.config |
||||
command: |
command: |
||||
- sleep |
- sleep |
||||
args: |
args: |
||||
- 99d |
- 99d |
||||
''') { |
''') { |
||||
|
|
||||
node(POD_LABEL) { |
node(POD_LABEL) { |
||||
try { |
try { |
||||
stage('Git') { |
stage('Git') { |
||||
git url: 'https://gyulai.cloud/git/bme/covidok-backend.git', |
git url: 'https://gyulai.cloud/git/bme/covidok-backend.git', |
||||
credentialsId: '1b1c30a0-590d-41d4-b775-bdb90e837bc8' |
credentialsId: '1b1c30a0-590d-41d4-b775-bdb90e837bc8' |
||||
container('docker') { |
container('docker') { |
||||
stage('Build dev image') { |
stage('Build dev image') { |
||||
sh 'docker build -f /home/jenkins/agent/workspace/gitea-bme_covidok-backend_master/CoviDok/Dockerfile.CI -t docker.local/bme/covidok:dev /home/jenkins/agent/workspace' |
sh 'docker build -f /home/jenkins/agent/workspace/gitea-bme_covidok-backend_master/CoviDok/Dockerfile.CI -t docker.local/bme/covidok:dev /home/jenkins/agent/workspace' |
||||
} |
} |
||||
stage('Push dev image') { |
stage('Push dev image') { |
||||
sh 'docker push docker.local/bme/covidok:dev' |
sh 'docker push docker.local/bme/covidok:dev' |
||||
} |
} |
||||
} |
} |
||||
container('helm') { |
container('helm') { |
||||
stage('Helm lint'){ |
stage('Helm lint'){ |
||||
sh 'helm lint /home/jenkins/agent/workspace/gitea-bme_covidok-backend_master/helm/covidok' |
sh 'helm lint /home/jenkins/agent/workspace/gitea-bme_covidok-backend_master/helm/covidok' |
||||
} |
} |
||||
stage('Install dev') { |
stage('Install dev') { |
||||
sh '/home/jenkins/agent/workspace/gitea-bme_covidok-backend_master/ci/helm_test.sh /home/jenkins/agent/workspace/gitea-bme_covidok-backend_master/helm/covidok' |
sh '/home/jenkins/agent/workspace/gitea-bme_covidok-backend_master/ci/helm_test.sh /home/jenkins/agent/workspace/gitea-bme_covidok-backend_master/helm/covidok' |
||||
} |
} |
||||
} |
} |
||||
container('python') { |
container('python') { |
||||
stage('API test'){ |
stage('API test'){ |
||||
sh 'echo python3 -m pytest /home/jenkins/agent/workspace/gitea-bme_covidok-backend_master/ci/tests' |
sh 'echo python3 -m pytest /home/jenkins/agent/workspace/gitea-bme_covidok-backend_master/ci/tests' |
||||
} |
} |
||||
} |
} |
||||
container('docker') { |
container('docker') { |
||||
stage('Push tested image'){ |
stage('Push tested image'){ |
||||
sh 'docker tag docker.local/bme/covidok:dev docker.local/bme/covidok:latest' |
sh 'docker tag docker.local/bme/covidok:dev docker.local/bme/covidok:latest' |
||||
sh 'docker push docker.local/bme/covidok:latest' |
sh 'docker push docker.local/bme/covidok:latest' |
||||
} |
withCredentials([string(credentialsId: 'docker-dgyulaid-token', variable: 'DOCKER_PASS')]) { |
||||
} |
sh ''' |
||||
container('helm'){ |
echo "$DOCKER_PASS" | docker login --username dgyulaid --password-stdin |
||||
stage('Package Helm') { |
docker tag docker.local/bme/covidok:latest dgyulaid/covidok:latest |
||||
sh 'helm package /home/jenkins/agent/workspace/gitea-bme_covidok-backend_master/helm/covidok' |
docker push dgyulaid/covidok:latest |
||||
} |
''' |
||||
} |
} |
||||
stage('Archive chart'){ |
} |
||||
archiveArtifacts artifacts: 'covidok*tgz', followSymlinks: false, onlyIfSuccessful: true |
} |
||||
} |
container('helm'){ |
||||
} |
stage('Package Helm') { |
||||
} |
sh 'helm package /home/jenkins/agent/workspace/gitea-bme_covidok-backend_master/helm/covidok' |
||||
finally { |
} |
||||
container('helm') { |
} |
||||
sh '/home/jenkins/agent/workspace/gitea-bme_covidok-backend_master/ci/cleanup.sh' |
stage('Archive chart'){ |
||||
} |
archiveArtifacts artifacts: 'covidok*tgz', followSymlinks: false, onlyIfSuccessful: true |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
|
finally { |
||||
|
container('helm') { |
||||
|
sh '/home/jenkins/agent/workspace/gitea-bme_covidok-backend_master/ci/cleanup.sh' |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
@ -1,7 +1,8 @@ |
|||||
# CI values for covidok. |
# CI values for covidok. |
||||
# This is a YAML-formatted file. |
# This is a YAML-formatted file. |
||||
# Declare variables to be passed into your templates. |
# Declare variables to be passed into your templates. |
||||
|
|
||||
images: |
images: |
||||
covidok: |
covidok: |
||||
tag: dev |
name: docker.local/bme/covidok |
||||
|
tag: dev |
||||
|
Loading…
Reference in new issue