Skip to content

Commit fd3cf9d

Browse files
authored
Merge pull request #155 from MycroftAI/feature/continuous-delivery
Continuous delivery
2 parents 036e3f0 + d38fd20 commit fd3cf9d

File tree

2 files changed

+51
-3
lines changed

2 files changed

+51
-3
lines changed

Jenkinsfile

Lines changed: 48 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,58 @@ pipeline {
5864
}
5965
}
6066
}
67+
stage('Build and upload snap package') {
68+
environment {
69+
SNAP_LOGIN=credentials('snapcraft_login')
70+
}
71+
when {
72+
anyOf {
73+
branch 'dev'
74+
branch 'release/*'
75+
}
76+
}
77+
steps {
78+
echo 'Building snap package...'
79+
sh 'docker build -f ./devops/snapcraft/Dockerfile -t \
80+
snapcraft-build .'
81+
echo 'Building snap package...'
82+
sh 'docker run -v "${PWD}":/build -w /build \
83+
snapcraft-build:latest snapcraft'
84+
echo 'Pushing package to snap store'
85+
sh('''
86+
mkdir -p .snapcraft
87+
cat ${SNAP_LOGIN} | base64 --decode --ignore-garbage \
88+
> .snapcraft/snapcraft.cfg
89+
docker run -v "${PWD}":/build -w /build \
90+
snapcraft-build:latest snapcraft \
91+
push --release edge *.snap
92+
rm -rf .snapcraft
93+
''')
94+
}
95+
}
6196
}
6297
post {
6398
cleanup {
99+
sh(
100+
label: 'Snapcraft Cleanup',
101+
script: '''
102+
docker run -v "${PWD}":/build -w /build \
103+
snapcraft-build:latest snapcraft clean
104+
'''
105+
)
64106
sh(
65107
label: 'Docker Container and Image Cleanup',
66108
script: '''
67109
docker container prune --force;
68110
docker image prune --force;
69111
'''
70112
)
113+
sh(
114+
label: 'Devops scripts cleanup',
115+
script: '''
116+
rm -rf devops
117+
'''
118+
)
71119
}
72120
failure {
73121
// Send failure email containing a link to the Jenkins build

snap/snapcraft.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ description: >
4848
Model conversion
4949
5050
mycroft-precise.convert - Convert wake-word model from Keras to TensorFlow
51+
architectures:
52+
- build-on: [amd64]
5153
base: core18
5254
grade: stable
5355
confinement: strict
@@ -70,9 +72,7 @@ parts:
7072
after: [alsa-mixin]
7173
plugin: python
7274
python-version: python3
73-
source: https://github.com/MycroftAI/mycroft-precise.git
74-
source-type: git
75-
source-branch: dev
75+
source: .
7676
override-pull: |
7777
snapcraftctl pull
7878
# Set version to setup.py version if current commit is the latest

0 commit comments

Comments
 (0)