1 | node {
|
2 | checkout scm;
|
3 | properties([
|
4 | parameters([
|
5 | stringParam(
|
6 | defaultValue: "false",
|
7 | description: 'build docker without cache',
|
8 | name: 'NO_CACHE'
|
9 | ),
|
10 | booleanParam(
|
11 | defaultValue: false,
|
12 | description: 'whether to avoid triggering precious at the end',
|
13 | name: 'NO_PRECIOUS'
|
14 | ),
|
15 | ]),
|
16 | ]);
|
17 | try {
|
18 | ansiColor('xterm') {
|
19 | def env = ["tag=${BUILD_TAG}", "NO_CACHE=${params.NO_CACHE}"]
|
20 | withEnv(env) {
|
21 | stage('Build') {
|
22 | echo 'Building docker image';
|
23 | sh "make build"
|
24 | }
|
25 | stage('Lint') {
|
26 | echo 'Linting'
|
27 | sh "make lint"
|
28 | }
|
29 | stage('Tag') {
|
30 | echo 'Tagging local images';
|
31 | sh "make tag"
|
32 | }
|
33 | stage('Push') {
|
34 | echo 'Pushing images to ECR'
|
35 | build(
|
36 | job: 'cli/push-cli',
|
37 | wait: true,
|
38 | parameters: [
|
39 | string(name: 'TRIGGER_BRANCH', value: BRANCH_NAME),
|
40 | string(name: 'BUILD_TAG', value: BUILD_TAG)
|
41 | ]
|
42 | )
|
43 | }
|
44 | }
|
45 | }
|
46 | if (!params.NO_PRECIOUS) {
|
47 | trigger_precious("${BRANCH_NAME}", "${JOB_NAME}");
|
48 | }
|
49 | slack('SUCCESS');
|
50 | } catch (err) {
|
51 | slack('FAILURE');
|
52 | throw err;
|
53 | }
|
54 | }
|