Skip to content

Commit ba75116

Browse files
committed
Add stage for building snap package
Uses the snapcraft Dockerfile from the devops repo
1 parent 323dfb1 commit ba75116

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

Jenkinsfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ pipeline {
1919
GITHUB=credentials('38b2e4a6-167a-40b2-be6f-d69be42c8190')
2020
}
2121
stages {
22+
stage('Setup') {
23+
steps {
24+
sh 'git clone https://$GITHUB_PSW@github.com/MycroftAI/devops.git'
25+
}
26+
}
27+
2228
stage('Lint & Format') {
2329
// Run PyLint and Black to check code quality.
2430
when {
@@ -58,16 +64,44 @@ pipeline {
5864
}
5965
}
6066
}
67+
stage('Build snap package') {
68+
when {
69+
anyOf {
70+
branch 'dev'
71+
branch 'release/*'
72+
}
73+
}
74+
steps {
75+
echo 'Building snap package...'
76+
sh 'docker build -f ./devops/snapcraft/Dockerfile -t \
77+
snapcraft-build .'
78+
sh 'docker run -v "${PWD}":/build -w /build \
79+
snapcraft-build:latest snapcraft'
80+
}
81+
}
6182
}
6283
post {
6384
cleanup {
85+
sh(
86+
label: 'Snapcraft Cleanup',
87+
script: '''
88+
docker run -v "${PWD}":/build -w /build \
89+
snapcraft-build:latest snapcraft clean
90+
'''
91+
)
6492
sh(
6593
label: 'Docker Container and Image Cleanup',
6694
script: '''
6795
docker container prune --force;
6896
docker image prune --force;
6997
'''
7098
)
99+
sh(
100+
label: 'Devops scripts cleanup',
101+
script: '''
102+
rm -rf devops
103+
'''
104+
)
71105
}
72106
failure {
73107
// Send failure email containing a link to the Jenkins build

0 commit comments

Comments
 (0)