Skip to content

Commit fe9a05b

Browse files
authored
Jenkins integration (#53)
1 parent 1568bd5 commit fe9a05b

File tree

3 files changed

+266
-0
lines changed

3 files changed

+266
-0
lines changed

jenkins/Dockerfile

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
ARG DOCKERHUB_MIRROR
2+
FROM ${DOCKERHUB_MIRROR}/ubuntu:20.04
3+
4+
# Jenkins image build job uses this label to tag version of image
5+
# Update when you make a change
6+
LABEL build.environment.version="1.0.0"
7+
8+
RUN useradd -u 1000 -U -m -c Jenkins jenkins
9+
10+
RUN apt update && apt -y upgrade \
11+
&& DEBIAN_FRONTEND=noninteractive apt install -y \
12+
ca-certificates \
13+
curl \
14+
clang \
15+
g++ \
16+
gcc \
17+
git \
18+
gnupg \
19+
imagemagick \
20+
make \
21+
python3 \
22+
python3-numpy \
23+
python3-pil \
24+
python3-pip \
25+
python3-venv \
26+
software-properties-common \
27+
wget
28+
29+
# Install up-to-date CMake, as standard Ubuntu package is too old
30+
RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null \
31+
| gpg --dearmor - > /etc/apt/trusted.gpg.d/kitware.gpg
32+
RUN apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main'
33+
RUN apt-get update
34+
RUN apt-get install -y cmake \
35+
&& rm -rf /var/lib/apt/lists/*
36+
37+
38+
# Install python modules
39+
RUN pip3 install requests
40+
41+
# Install Coverity client
42+
RUN --mount=type=secret,id=ARTIFACTORY_CREDENTIALS curl --user "$(cat /run/secrets/ARTIFACTORY_CREDENTIALS)" "https://eu-west-1.artifactory.aws.arm.com/artifactory/eda-synopsys.coverity/2021.12.1/cov-analysis-linux64-2021.12.1.sh" --output /tmp/coverity_install.sh &&\
43+
curl --user "$(cat /run/secrets/ARTIFACTORY_CREDENTIALS)" "https://eu-west-1.artifactory.aws.arm.com/artifactory/eda-synopsys.coverity/2021.12.1/license.dat" --output /tmp/license.dat &&\
44+
chmod 555 /tmp/coverity_install.sh &&\
45+
/tmp/coverity_install.sh -q --license.region=6 --license.agreement=agree --license.cov.path=/tmp/license.dat -dir /usr/local/cov-analysis &&\
46+
rm /tmp/coverity_install.sh /tmp/license.dat

jenkins/Jenkinsfile

Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
/* HWCPipe basic pipeline framework
2+
*/
3+
4+
final Map K8S_CONFIG = [
5+
registry: 'mobile-studio--docker.eu-west-1.artifactory.aws.arm.com',
6+
registryCredentials: 'artifactory-ms-docker',
7+
imageName: 'hwcpipe',
8+
imageTag: '1.0.0'
9+
]
10+
11+
/**
12+
@brief Return Kubernetes pod definition
13+
*/
14+
@NonCPS
15+
def getPodTemplate(Map K8S_CONFIG, String containerName) {
16+
return """
17+
apiVersion: v1
18+
kind: Pod
19+
spec:
20+
imagePullSecrets:
21+
- name: ${K8S_CONFIG.registryCredentials}
22+
securityContext:
23+
runAsUser: 1000
24+
runAsGroup: 1000
25+
containers:
26+
- name: ${containerName}
27+
image: ${K8S_CONFIG.registry}/${K8S_CONFIG.imageName}:${K8S_CONFIG.imageTag}
28+
command:
29+
- sleep
30+
args:
31+
- infinity
32+
resources:
33+
requests:
34+
cpu: 4
35+
memory: 8Gi
36+
limits:
37+
cpu: 8
38+
memory: 16Gi
39+
"""
40+
}
41+
42+
pipeline {
43+
agent none
44+
45+
options {
46+
ansiColor('xterm')
47+
timestamps()
48+
}
49+
50+
stages {
51+
stage('Build All') {
52+
parallel {
53+
/* Build for Linux on Ubuntu 20.04 x86-64 */
54+
stage('Linux') {
55+
agent {
56+
kubernetes {
57+
yaml getPodTemplate(K8S_CONFIG, 'hwcpipe-build')
58+
defaultContainer 'hwcpipe-build'
59+
}
60+
}
61+
stages {
62+
stage('Build') {
63+
steps {
64+
sh '''
65+
echo "Look at me Ma! I'm building on Ubuntu 20.04!"
66+
'''
67+
}
68+
}
69+
stage('Stash') {
70+
steps {
71+
sh '''
72+
echo "Look at me Ma! I'm stashing artefacts on Ubuntu 20.04!"
73+
'''
74+
}
75+
}
76+
stage('Test') {
77+
steps {
78+
sh '''
79+
echo "Look at me Ma! I'm testing on Ubuntu 20.04!"
80+
'''
81+
}
82+
}
83+
}
84+
}
85+
/* Build for Windows on x86-64 */
86+
stage('Windows') {
87+
agent {
88+
label 'Windows'
89+
}
90+
stages {
91+
stage('Clean') {
92+
steps {
93+
bat 'git clean -ffdx'
94+
}
95+
}
96+
stage('Build') {
97+
steps {
98+
bat '''
99+
echo "Look at me Ma! I'm building on Windows!"
100+
'''
101+
}
102+
}
103+
stage('Stash') {
104+
steps {
105+
bat '''
106+
echo "Look at me Ma! I'm stashing artefacts on Windows"
107+
'''
108+
}
109+
}
110+
stage('Test') {
111+
steps {
112+
bat '''
113+
echo "Look at me Ma! I'm testing on Windows!"
114+
'''
115+
}
116+
}
117+
}
118+
}
119+
/* Build for macOS on x86-64 */
120+
stage('macOS x86') {
121+
agent {
122+
label 'mac'
123+
}
124+
stages {
125+
stage('Clean') {
126+
steps {
127+
sh 'git clean -ffdx'
128+
}
129+
}
130+
stage('Build') {
131+
steps {
132+
sh '''
133+
echo "Look at me Ma! I'm building on Mac x86"
134+
'''
135+
}
136+
}
137+
stage('Stash') {
138+
steps {
139+
sh '''
140+
echo "Look at me Ma! I'm stashing artefacts on Mac x86"
141+
'''
142+
}
143+
}
144+
stage('Test') {
145+
steps {
146+
sh '''
147+
echo "Look at me Ma! I'm testing on Mac x86"
148+
'''
149+
}
150+
}
151+
}
152+
}
153+
/* Build for macOS on Apple M1 */
154+
stage('macOS M1') {
155+
agent {
156+
label 'macm1'
157+
}
158+
stages {
159+
stage('Clean') {
160+
steps {
161+
sh 'git clean -ffdx'
162+
}
163+
}
164+
stage('Build') {
165+
steps {
166+
sh '''
167+
echo "Look at me Ma! I'm building on Mac M1"
168+
'''
169+
}
170+
}
171+
stage('Stash') {
172+
steps {
173+
sh '''
174+
echo "Look at me Ma! I'm stashing artefacts on Mac M1"
175+
'''
176+
}
177+
}
178+
stage('Test') {
179+
steps {
180+
sh '''
181+
echo "Look at me Ma! I'm testing on Mac M1"
182+
'''
183+
}
184+
}
185+
}
186+
}
187+
}
188+
}
189+
stage('Artifactory') {
190+
agent {
191+
kubernetes {
192+
yaml getPodTemplate(K8S_CONFIG, 'hwcpipe-af')
193+
defaultContainer 'hwcpipe-af'
194+
}
195+
}
196+
options {
197+
skipDefaultCheckout true
198+
}
199+
stages {
200+
stage('Unstash') {
201+
steps {
202+
sh '''
203+
echo "Unstashing"
204+
'''
205+
}
206+
}
207+
stage('Upload') {
208+
steps {
209+
echo 'Uploading to AF'
210+
// zip zipFile: 'hwcpipe.zip', dir: 'upload', archive: false
211+
// cepeArtifactoryUpload(sourcePattern: 'hwcpipe.zip')
212+
}
213+
}
214+
}
215+
}
216+
}
217+
}

jenkins/dockerimage.Jenkinsfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@Library('hive-infra-library@changes/67/404467/2') _
2+
3+
dockerBuildImage('jenkins/Dockerfile', 'hwcpipe')

0 commit comments

Comments
 (0)