-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
66 lines (64 loc) · 2.28 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Uses Declarative syntax to run commands inside a container.
pipeline {
triggers {
pollSCM("*/5 * * * *")
}
agent {
kubernetes {
yaml '''
apiVersion: v1
kind: Pod
spec:
volumes:
- name: docker-sock
hostPath:
path: /var/run/docker.sock
containers:
- name: docker
image: quay.imanuel.dev/dockerhub/library---docker:stable
command:
- cat
tty: true
volumeMounts:
- mountPath: /var/run/docker.sock
name: docker-sock
- name: dart
image: quay.imanuel.dev/dockerhub/library---dart:stable
command:
- cat
tty: true
'''
defaultContainer 'docker'
}
}
stages {
stage('Build binary') {
steps {
container('dart') {
sh "dart pub get"
sh "dart pub get --offline"
sh "dart compile exe bin/influx_alerter.dart -o bin/influx_alerter"
archiveArtifacts artifacts: 'bin/influx_alerter', followSymlinks: false, onlyIfSuccessful: true
}
}
}
stage('Push') {
steps {
container('docker') {
sh "docker build -t quay.imanuel.dev/imanuel/influx-alerter:v1.$BUILD_NUMBER -f ./Dockerfile ."
sh "docker tag quay.imanuel.dev/imanuel/influx-alerter:v1.$BUILD_NUMBER quay.imanuel.dev/imanuel/influx-alerter:latest"
sh "docker tag quay.imanuel.dev/imanuel/influx-alerter:v1.$BUILD_NUMBER iulbricht/influx-alerter:v1.$BUILD_NUMBER"
sh "docker tag quay.imanuel.dev/imanuel/influx-alerter:v1.$BUILD_NUMBER iulbricht/influx-alerter:latest"
withDockerRegistry(credentialsId: 'quay.imanuel.dev', url: 'https://quay.imanuel.dev') {
sh "docker push quay.imanuel.dev/imanuel/influx-alerter:v1.$BUILD_NUMBER"
sh "docker push quay.imanuel.dev/imanuel/influx-alerter:latest"
}
withDockerRegistry(credentialsId: 'hub.docker.com', url: '') {
sh "docker push iulbricht/influx-alerter:v1.$BUILD_NUMBER"
sh "docker push iulbricht/influx-alerter:latest"
}
}
}
}
}
}