Adding template for building docker images
[ci-management.git] / jjb / global-templates-golang.yaml
1 ---
2 - job-template:
3     # Job template for Golang verify jobs
4     #
5     # The purpose of this job template is to run:
6     # 1. make build
7     #
8     # Required Variables:
9     #     branch:    git branch (eg. stable/lithium or master)
10
11     name: '{project-name}-{stream}-verify-golang'
12     path: '$WORKSPACE'
13
14     project-type: freestyle
15     concurrent: true
16     node: '{build-node}'
17
18     properties:
19       - infra-properties:
20           build-days-to-keep: '{build-days-to-keep}'
21
22     parameters:
23       - infra-parameters:
24           project: '{project}'
25           branch: '{branch}'
26           refspec: 'refs/heads/{branch}'
27           artifacts: '{archive-artifacts}'
28
29     scm:
30       - gerrit-trigger-scm:
31           refspec: '$GERRIT_REFSPEC'
32           choosing-strategy: 'gerrit'
33           submodule-recursive: '{submodule-recursive}'
34
35     wrappers:
36       - infra-wrappers:
37           build-timeout: '{build-timeout}'
38
39     triggers:
40       - gerrit-trigger-patch-submitted:
41           server: '{server-name}'
42           project: '{project}'
43           branch: '{branch}'
44           files: '**'
45
46     builders:
47       - provide-maven-settings:
48           global-settings-file: 'global-settings'
49           settings-file: '{mvn-settings}'
50       - shell: |
51           #!/bin/bash
52           curl -O https://dl.google.com/go/go1.10.linux-amd64.tar.gz
53           tar -zxf go1.10.linux-amd64.tar.gz
54           export GOROOT=$WORKSPACE/go
55           export PATH=$PATH:$GOROOT/bin
56           cd $WORKSPACE/{path}
57           make build
58
59     publishers:
60       - infra-shiplogs:
61           maven-version: '{maven-version}'
62
63 - job-template:
64     # Job template for Golang merge jobs
65     #
66     # The purpose of this job template is to run:
67     # 1. make deploy
68     #
69     # Required Variables:
70     #     branch:    git branch (eg. stable/lithium or master)
71
72     name: '{project-name}-{stream}-merge-golang'
73     path: $WORKSPACE
74
75     project-type: freestyle
76     node: '{build-node}'
77
78     properties:
79       - infra-properties:
80           build-days-to-keep: '{build-days-to-keep}'
81
82     parameters:
83       - infra-parameters:
84           project: '{project}'
85           branch: '{branch}'
86           refspec: 'refs/heads/{branch}'
87           artifacts: '{archive-artifacts}'
88       - maven-exec:
89           maven-version: '{maven-version}'
90
91     scm:
92       - gerrit-trigger-scm:
93           refspec: ''
94           choosing-strategy: 'default'
95           submodule-recursive: '{submodule-recursive}'
96
97     wrappers:
98       - infra-wrappers:
99           build-timeout: '{build-timeout}'
100
101     triggers:
102       - gerrit-trigger-patch-merged:
103           server: '{server-name}'
104           project: '{project}'
105           branch: '{branch}'
106           files: '**'
107
108     builders:
109       - provide-maven-settings:
110           global-settings-file: 'global-settings'
111           settings-file: '{mvn-settings}'
112       - shell: |
113           #!/bin/bash
114           curl -O https://dl.google.com/go/go1.10.linux-amd64.tar.gz
115           tar -zxf go1.10.linux-amd64.tar.gz
116           export GOROOT=$PWD/go
117           export PATH=$PATH:$GOROOT/bin
118           cd $WORKSPACE/{path}
119           make deploy
120
121     publishers:
122       - infra-shiplogs:
123           maven-version: '{maven-version}'
124
125 - job-template:
126     # Job template for building & pushing docker images
127     #
128     # The purpose of this job template is to run:
129     #  1. login to the docker registry
130     #  2. run a specified shell builder
131     #
132
133     name: '{project-name}-{stream}-docker-golang-shell-daily'
134     project-type: freestyle
135     node: 'ubuntu1604-docker-8c-8g'
136     disabled: false
137     properties:
138       - infra-properties:
139           build-days-to-keep: '{build-days-to-keep}'
140
141     parameters:
142       - infra-parameters:
143           project: '{project}'
144           branch: '{branch}'
145           refspec: 'refs/heads/{branch}'
146           artifacts: '{archive-artifacts}'
147
148     scm:
149       - gerrit-trigger-scm:
150           refspec: ''
151           choosing-strategy: 'default'
152           submodule-recursive: '{submodule-recursive}'
153
154     wrappers:
155       - infra-wrappers:
156           build-timeout: '{build-timeout}'
157
158     triggers:
159       # 12 AM UTC
160       - timed: 'H 12 * * *'
161       - gerrit-trigger-release-manually:
162           server: '{server-name}'
163           project: '{project}'
164           branch: '{branch}'
165
166     builders:
167       - provide-maven-settings:
168           global-settings-file: 'global-settings'
169           settings-file: '{mvn-settings}'
170
171       - docker-login
172
173       - shell: '{script}'
174
175     publishers:
176       - infra-shiplogs:
177           maven-version: '{maven-version}'