blob: 92ce8895f61926f146b363c125304afb7ef5ebff [file] [log] [blame]
Linux Foundation Administrators1dc9dd52018-01-26 09:09:09 -08001#!/bin/bash
2# Ubuntu base build
3
4# vim: ts=4 sw=4 sts=4 et tw=72 :
5
6# force any errors to cause the script and job to end in failure
7set -xeu -o pipefail
8
9rh_systems() {
10 echo 'No changes to apply'
11}
12
Zack Williams85249ce2018-04-01 19:54:44 -070013ubuntu_install_java_setup() {
14
15 echo "debconf shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
16
17 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
18
19 DISTRO=$(lsb_release -cs)
20
21 apt-add-repository \
22 "deb http://ppa.launchpad.net/webupd8team/java/ubuntu $DISTRO main"
23}
Linux Foundation Administrators1dc9dd52018-01-26 09:09:09 -080024
25ubuntu_systems() {
Matteo Scandolobb710992019-03-06 14:50:47 -080026 DISTRO=$(lsb_release -cs)
27
Linux Foundation Administrators1dc9dd52018-01-26 09:09:09 -080028 apt-get clean
Linux Foundation Administrators1dc9dd52018-01-26 09:09:09 -080029
Zack Williams85249ce2018-04-01 19:54:44 -070030 # get prereqs for PPA and apt-over-HTTPS support
31 apt-get update
32 apt-get install -y apt-transport-https software-properties-common
33
34 # install java (not needed as SonarQube includes this)
35 # ubuntu_install_java_setup
36 # apt-get update
37 # apt-get install -y oracle-java8-installer
Zack Williams4cfdf202018-05-07 09:58:12 -070038 # rm -rf /var/cache/oracle-jdk8-installer
Luca Prete31860c52018-03-06 17:54:38 -080039
40 # set up ansible repo
Zack Williams85249ce2018-04-01 19:54:44 -070041 apt-add-repository -y ppa:ansible/ansible
Luca Prete31860c52018-03-06 17:54:38 -080042
43 # set up docker repo
Zack Williams85249ce2018-04-01 19:54:44 -070044 apt-key adv --keyserver keyserver.ubuntu.com --recv 0EBFCD88
45 add-apt-repository \
Luca Prete31860c52018-03-06 17:54:38 -080046 "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
47 $(lsb_release -cs) \
48 stable"
49
Zack Williams6ecb83c2018-08-29 13:22:21 -070050 # set up golang repo
Zack Williamsc9abcdc2019-05-09 21:23:38 -070051 # docs: https://github.com/golang/go/wiki/Ubuntu
52 add-apt-repository ppa:longsleep/golang-backports
Zack Williams6ecb83c2018-08-29 13:22:21 -070053
Zack Williams7722ef22018-10-16 14:08:29 -070054 # set up kubernetes repo
55 cat << EOF | base64 -d > /tmp/k8s-apt-key.gpg
56mQENBFUd6rIBCAD6mhKRHDn3UrCeLDp7U5IE7AhhrOCPpqGF7mfTemZYHf/5JdjxcOxoSFlK
577zwmFr3lVqJ+tJ9L1wd1K6P7RrtaNwCiZyeNPf/Y86AJ5NJwBe0VD0xHTXzPNTqRSByVYtdN
5894NoltXUYFAAPZYQls0x0nUD1hLMlOlC2HdTPrD1PMCnYq/NuL/Vk8sWrcUt4DIS+0RDQ8tK
59Ke5PSV0+PnmaJvdF5CKawhh0qGTklS2MXTyKFoqjXgYDfY2EodI9ogT/LGr9Lm/+u4OFPvmN
609VN6UG+s0DgJjWvpbmuHL/ZIRwMEn/tpuneaLTO7h1dCrXC849PiJ8wSkGzBnuJQUbXnABEB
61AAG0QEdvb2dsZSBDbG91ZCBQYWNrYWdlcyBBdXRvbWF0aWMgU2lnbmluZyBLZXkgPGdjLXRl
62YW1AZ29vZ2xlLmNvbT6JAT4EEwECACgFAlUd6rICGy8FCQWjmoAGCwkIBwMCBhUIAgkKCwQW
63AgMBAh4BAheAAAoJEDdGwginMXsPcLcIAKi2yNhJMbu4zWQ2tM/rJFovazcY28MF2rDWGOnc
649giHXOH0/BoMBcd8rw0lgjmOosBdM2JT0HWZIxC/Gdt7NSRA0WOlJe04u82/o3OHWDgTdm9M
65S42noSP0mvNzNALBbQnlZHU0kvt3sV1YsnrxljoIuvxKWLLwren/GVshFLPwONjw3f9Fan6G
66WxJyn/dkX3OSUGaduzcygw51vksBQiUZLCD2Tlxyr9NvkZYTqiaWW78L6regvATsLc9L/dQU
67iSMQZIK6NglmHE+cuSaoK0H4ruNKeTiQUw/EGFaLecay6Qy/s3Hk7K0QLd+gl0hZ1w1VzIeX
68Lo2BRlqnjOYFX4CwAgADmQENBFrBaNsBCADrF18KCbsZlo4NjAvVecTBCnp6WcBQJ5oSh7+E
6998jX9YznUCrNrgmeCcCMUvTDRDxfTaDJybaHugfba43nqhkbNpJ47YXsIa+YL6eEE9emSmQt
70jrSWIiY+2YJYwsDgsgckF3duqkb02OdBQlh6IbHPoXB6H//b1PgZYsomB+841XW1LSJPYlYb
71IrWfwDfQvtkFQI90r6NknVTQlpqQh5GLNWNYqRNrGQPmsB+NrUYrkl1nUt1LRGu+rCe4bSaS
72mNbwKMQKkROE4kTiB72DPk7zH4Lm0uo0YFFWG4qsMIuqEihJ/9KNX8GYBr+tWgyLooLlsdK3
73l+4dVqd8cjkJM1ExABEBAAG0QEdvb2dsZSBDbG91ZCBQYWNrYWdlcyBBdXRvbWF0aWMgU2ln
74bmluZyBLZXkgPGdjLXRlYW1AZ29vZ2xlLmNvbT6JAT4EEwECACgFAlrBaNsCGy8FCQWjmoAG
75CwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEGoDCyG6B/T78e8H/1WH2LN/nVNhm5TS1VYJ
76G8B+IW8zS4BqyozxC9iJAJqZIVHXl8g8a/Hus8RfXR7cnYHcg8sjSaJfQhqO9RbKnffiuQgG
77rqwQxuC2jBa6M/QKzejTeP0Mgi67pyrLJNWrFI71RhritQZmzTZ2PoWxfv6b+Tv5v0rPaG+u
78t1J47pn+kYgtUaKdsJz1umi6HzK6AacDf0C0CksJdKG7MOWsZcB4xeOxJYuy6NuO6KcdEz8/
79XyEUjIuIOlhYTd0hH8E/SEBbXXft7/VBQC5wNq40izPi+6WFK/e1O42DIpzQ749ogYQ1eode
80xPNhLzekKR3XhGrNXJ95r5KO10VrsLFNd8KwAgAD
81EOF
82
83 sudo apt-key add /tmp/k8s-apt-key.gpg
84 echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
85
Matteo Scandolobb710992019-03-06 14:50:47 -080086 # set up NodeJS repo
Zack Williams6a1d4542019-03-09 09:04:26 -070087 # Instructions: https://github.com/nodesource/distributions/blob/master/README.md#manual-installation
Matteo Scandolobb710992019-03-06 14:50:47 -080088
89 cat << EOF | base64 -d > /tmp/nodejs-apt-key.gpg
90LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tClZlcnNpb246IEdudVBHIHYxCkNvbW1lbnQ6IEdQR1Rvb2xzIC0gaHR0cHM6Ly9ncGd0b29scy5vcmcKCm1RSU5CRk9iSkxZQkVBRGtGVzhITWpzb1lSSlE0bkNZQy82RWgweUxXSFdmQ2grLzlaU0lqNHcvcE9lMlY2VisKVzZESFkza0szYSsyYnhyYXg5RXFLZTd1eGtTS2Y5NWdmbnMrSTkrUitSSmZScGIxcXZsalVScjU0eTM1SVpncwpmTUcyMk5wK1RtTTJSTGdkRkNaYTE4aDArUmJIOWkwYitackI5WFBabUxiL2g5b3U3U293R3FRM3d3T3RUM1Z5CnFtaWYwQTJHQ2NqRlRxV1c2VFhhWThlWko5QkNFcVczay8wQ2p3N0svbVN5L3V0eFlpVUl2Wk5LZ2FHL1A4VTcKODlReXZ4ZVJ4QWY5M1lGQVZ6TVhob0t4dTEySXVINFZuU3dBZmI4Z1F5eEtSeWlHT1V3azBZb0JQcHFSbk1tRApEbDdTZG1ZM29RSEVKekJlbFRNalRNOEFqYkI5bVdvUEJYNUc4dDR1NDcvRlo2UGdkZm1SZzloc0tYaGtMSmM3CkMxYnRibE9ITmdEeDE5ZnpBU1dYK3hPalppS3BQNk1rRUV6cTFiaWxVRnVsNlJEdHhrVFdzVGE1VEdpeGdDQi8KRzJmSzhJOUpML3lRaERjNk9HWTltalBPeE1iNVBnVWxUOG94M3Y4d3QyNWVyV2o5ejMwUW9FQndmU2c0dHpMYwpKcTZOL2llcFFlbU5mbzZJcytURytKekk2dmhYamxzQm0vWG16MFppRlBQ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U296S21nYTgxSlN3a0FETzFKTWdVeTZkQXBYejlrUDRFRTNnPT0KPUNMR0YKLS0tLS1FTkQgUEdQIFBVQkxJQyBLRVkgQkxPQ0stLS0tLQo=
91EOF
92
93 sudo apt-key add /tmp/nodejs-apt-key.gpg
94 NODE_VERSION=node_7.x
95 echo "deb https://deb.nodesource.com/$NODE_VERSION $DISTRO main" | sudo tee /etc/apt/sources.list.d/nodesource.list
96 echo "deb-src https://deb.nodesource.com/$NODE_VERSION $DISTRO main" | sudo tee -a /etc/apt/sources.list.d/nodesource.list
97
Zack Williams7722ef22018-10-16 14:08:29 -070098 # update after adding apt repos to sources
Linux Foundation Administrators1dc9dd52018-01-26 09:09:09 -080099 apt-get update
Luca Prete31860c52018-03-06 17:54:38 -0800100
101 # install basic sofware requirements
Linux Foundation Administrators1dc9dd52018-01-26 09:09:09 -0800102 apt-get install -y \
Zack Williams85249ce2018-04-01 19:54:44 -0700103 "docker-ce=17.06*" \
Andy Bavierb781c4c2018-09-20 08:16:52 -0700104 apt-transport-https \
Luca Prete31860c52018-03-06 17:54:38 -0800105 ansible \
Luca Prete31860c52018-03-06 17:54:38 -0800106 build-essential \
Linux Foundation Administrators1dc9dd52018-01-26 09:09:09 -0800107 bzip2 \
108 curl \
Andy Bavierb781c4c2018-09-20 08:16:52 -0700109 ebtables \
110 ethtool \
Linux Foundation Administrators1dc9dd52018-01-26 09:09:09 -0800111 git \
Zack Williamsc9abcdc2019-05-09 21:23:38 -0700112 golang-1.12-go \
Kailash Khalasi4b42e6c2018-10-18 13:43:52 -0700113 httpie \
Andy Bavierb781c4c2018-09-20 08:16:52 -0700114 jq \
Kailash3be4df02019-02-05 12:43:00 -0800115 kafkacat \
Zack Williams2dc7cf82019-04-01 12:36:06 -0700116 "kubeadm=1.12.7-*" \
117 "kubelet=1.12.7-*" \
118 "kubectl=1.12.7-*" \
Linux Foundation Administrators1dc9dd52018-01-26 09:09:09 -0800119 less \
Zack Williams9d661a42018-10-01 15:43:21 -0700120 libmysqlclient-dev \
Zack Williams68f43102018-07-07 12:57:13 -0700121 libpcap-dev \
Zack Williamscfe0b942018-04-12 11:47:57 -0700122 libxml2-utils \
Kailash Khalasi1ddc7c62018-04-20 08:47:56 -0700123 maven \
Linux Foundation Administrators1dc9dd52018-01-26 09:09:09 -0800124 nodejs \
Zack Williams85249ce2018-04-01 19:54:44 -0700125 python \
Zack Williams9754a832018-04-13 11:01:59 -0700126 python-certifi \
127 python-cryptography \
Luca Prete31860c52018-03-06 17:54:38 -0800128 python-dev \
Zack Williams9754a832018-04-13 11:01:59 -0700129 python-idna \
Luca Prete31860c52018-03-06 17:54:38 -0800130 python-netaddr \
Zack Williams9754a832018-04-13 11:01:59 -0700131 python-openssl \
Luca Prete31860c52018-03-06 17:54:38 -0800132 python-pip \
Zack Williams9754a832018-04-13 11:01:59 -0700133 python-urllib3 \
Zack Williams4b54baf2019-03-08 18:04:37 -0700134 python3-dev \
Zack Williams40c06f02018-04-15 20:31:34 -0700135 ruby \
Zack Williamseb842ae2018-05-15 17:07:32 -0700136 socat \
Zack Williams85249ce2018-04-01 19:54:44 -0700137 ssh \
Luca Prete31860c52018-03-06 17:54:38 -0800138 sshpass \
Zack Williams85249ce2018-04-01 19:54:44 -0700139 zip
Linux Foundation Administrators1dc9dd52018-01-26 09:09:09 -0800140 # end of apt-get install list
Luca Prete31860c52018-03-06 17:54:38 -0800141
142 # install python modules
Zack Williams85249ce2018-04-01 19:54:44 -0700143 pip install \
144 Jinja2 \
145 ansible-lint \
Zack Williamsac922962018-07-24 13:02:26 -0700146 astroid==1.* \
Zack Williams958bc4e2018-10-18 21:08:25 -0700147 coverage \
Zack Williams85249ce2018-04-01 19:54:44 -0700148 docker-compose==1.20.1 \
149 docker==3.2.1 \
Luca Prete31860c52018-03-06 17:54:38 -0800150 gitpython \
Luca Prete90bfa5e2018-03-06 20:41:56 -0800151 graphviz \
Kailash Khalasie15b27a2018-06-26 13:28:20 -0700152 grpcio-tools \
Zack Williams85249ce2018-04-01 19:54:44 -0700153 isort \
Zack Williams6828f822018-04-12 16:13:33 -0700154 linkchecker \
Zack Williams958bc4e2018-10-18 21:08:25 -0700155 mock \
156 nose2 \
Zack Williams85249ce2018-04-01 19:54:44 -0700157 pexpect \
Zack Williamse9af4c42018-07-24 14:29:02 -0700158 pylint==1.* \
Zack Williams85249ce2018-04-01 19:54:44 -0700159 pyyaml \
Luca Prete31860c52018-03-06 17:54:38 -0800160 robotframework \
Kailash Khalasicb327c62018-04-03 10:41:38 -0700161 robotframework-httplibrary \
Kailash Khalasia1917682018-08-20 10:34:39 -0700162 robotframework-kafkalibrary \
Zack Williams85249ce2018-04-01 19:54:44 -0700163 robotframework-requests \
Zack Williamsfd8a0042018-04-12 14:34:17 -0700164 robotframework-sshlibrary \
Zack Williamsa31016a2018-10-22 13:00:04 -0700165 tox \
Zack Williams5aa37e12019-02-13 13:28:29 -0700166 twine \
Zack Williamsfd8a0042018-04-12 14:34:17 -0700167 virtualenv
Zack Williams85249ce2018-04-01 19:54:44 -0700168 # end of pip install list
Luca Prete31860c52018-03-06 17:54:38 -0800169
Zack Williams40c06f02018-04-15 20:31:34 -0700170 # install ruby gems
171 gem install \
172 mdl
173 # end of gem install list
174
Luca Prete31860c52018-03-06 17:54:38 -0800175 # install npm modules
176 npm install -g \
Zack Williams85249ce2018-04-01 19:54:44 -0700177 gitbook-cli \
178 markdownlint \
Luca Prete31860c52018-03-06 17:54:38 -0800179 typings
Zack Williams85249ce2018-04-01 19:54:44 -0700180 # end of npm install list
Luca Prete31860c52018-03-06 17:54:38 -0800181
Zack Williams6ecb83c2018-08-29 13:22:21 -0700182 # install golang packages in /usr/local/go
183 # Set PATH=$PATH:/usr/local/go/bin` to use these
184 export GOPATH=/usr/local/go
185 mkdir -p $GOPATH
Zack Williamsc9abcdc2019-05-09 21:23:38 -0700186 export PATH=$PATH:/usr/lib/go-1.12/bin:$GOPATH/bin
Zack Williams42200aa2019-04-12 13:27:44 -0700187
Zack Williams6ecb83c2018-08-29 13:22:21 -0700188 # converters for unit/coverage test
189 go get -v github.com/t-yuki/gocover-cobertura
190 go get -v github.com/jstemmer/go-junit-report
191
Zack Williamsa2bea0a2019-05-09 21:50:37 -0700192 # dep for go package dependencies w/versioning, version 0.5.2, adapted from:
Zack Williams142ba6b2018-11-20 15:23:39 -0700193 # https://golang.github.io/dep/docs/installation.html#install-from-source
194 go get -d -u github.com/golang/dep
195 pushd $(go env GOPATH)/src/github.com/golang/dep
Zack Williamsa2bea0a2019-05-09 21:50:37 -0700196 git checkout "0.5.2"
197 go install -ldflags="-X main.version=0.5.2" ./cmd/dep
Zack Williams142ba6b2018-11-20 15:23:39 -0700198 popd
199
Zack Williams42200aa2019-04-12 13:27:44 -0700200 # protoc-gen-go - Golang protbuf compiler extension for protoc (installed
201 # below)
202 go get -d -u github.com/golang/protobuf/protoc-gen-go
203 pushd $(go env GOPATH)/src/github.com/golang/protobuf
204 git checkout "v1.3.1"
205 go install ./protoc-gen-go
206 popd
207
Luca Prete31860c52018-03-06 17:54:38 -0800208 # install repo
Zack Williams85249ce2018-04-01 19:54:44 -0700209 REPO_SHA256SUM="394d93ac7261d59db58afa49bb5f88386fea8518792491ee3db8baab49c3ecda"
Luca Prete31860c52018-03-06 17:54:38 -0800210 curl -o /tmp/repo 'https://gerrit.opencord.org/gitweb?p=repo.git;a=blob_plain;f=repo;hb=refs/heads/stable'
Zack Williams85249ce2018-04-01 19:54:44 -0700211 echo "$REPO_SHA256SUM /tmp/repo" | sha256sum -c -
212 mv /tmp/repo /usr/local/bin/repo
213 chmod a+x /usr/local/bin/repo
Linux Foundation Administrators1dc9dd52018-01-26 09:09:09 -0800214
Zack Williams85249ce2018-04-01 19:54:44 -0700215 # install sonarqube scanner
Zack Williams891922a2018-07-07 10:33:24 -0700216 # dl link: https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner
217 SONAR_SCANNER_CLI_VERSION="3.2.0.1227"
218 SONAR_SCANNER_CLI_SHA256SUM="07a50ec270a36cb83f26fe93233819c53c145248c638f4591880f1bd36e331d6"
Zack Williams02e301e2018-10-08 12:09:58 -0700219 curl -L -o /tmp/sonarscanner.zip "https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_CLI_VERSION}-linux.zip"
Zack Williams85249ce2018-04-01 19:54:44 -0700220 echo "$SONAR_SCANNER_CLI_SHA256SUM /tmp/sonarscanner.zip" | sha256sum -c -
221 pushd /opt
222 unzip /tmp/sonarscanner.zip
223 mv sonar-scanner-${SONAR_SCANNER_CLI_VERSION}-linux sonar-scanner
Zack Williams4cfdf202018-05-07 09:58:12 -0700224 rm -f /tmp/sonarscanner.zip
Zack Williams85249ce2018-04-01 19:54:44 -0700225 popd
226
Zack Williams4cfdf202018-05-07 09:58:12 -0700227 # install helm
Zack Williams7722ef22018-10-16 14:08:29 -0700228 HELM_VERSION="2.11.0"
229 HELM_SHA256SUM="02a4751586d6a80f6848b58e7f6bd6c973ffffadc52b4c06652db7def02773a1"
Zack Williams8aa52822018-04-05 09:22:15 -0700230 HELM_PLATFORM="linux-amd64"
Zack Williams4cfdf202018-05-07 09:58:12 -0700231 curl -L -o /tmp/helm.tgz "https://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VERSION}-${HELM_PLATFORM}.tar.gz"
Zack Williams8aa52822018-04-05 09:22:15 -0700232 echo "$HELM_SHA256SUM /tmp/helm.tgz" | sha256sum -c -
233 pushd /tmp
234 tar -xzvf helm.tgz
235 mv ${HELM_PLATFORM}/helm /usr/local/bin/helm
236 chmod a+x /usr/local/bin/helm
Zack Williams4cfdf202018-05-07 09:58:12 -0700237 rm -rf helm.tgz ${HELM_PLATFORM}
238 popd
239
240 # install minikube
Zack Williams7722ef22018-10-16 14:08:29 -0700241 MINIKUBE_VERSION="0.30.0"
Zack Williams4cfdf202018-05-07 09:58:12 -0700242 MINIKUBE_DEB_VERSION="$(echo ${MINIKUBE_VERSION} | sed -n 's/\(.*\)\.\(.*\)/\1-\2/p')"
Zack Williams7722ef22018-10-16 14:08:29 -0700243 MINIKUBE_SHA256SUM="c6c5aa5956f8ad5f61d426e9b8601ba95965a9c30bb80a9fe7525c64e6dd12fd"
Zack Williams4cfdf202018-05-07 09:58:12 -0700244 curl -L -o /tmp/minikube.deb "https://storage.googleapis.com/minikube/releases/v${MINIKUBE_VERSION}/minikube_${MINIKUBE_DEB_VERSION}.deb"
245 echo "$MINIKUBE_SHA256SUM /tmp/minikube.deb" | sha256sum -c -
246 pushd /tmp
247 dpkg -i minikube.deb
248 rm -f minikube.deb
Zack Williams8aa52822018-04-05 09:22:15 -0700249 popd
250
Kailash Khalasi929d21b2018-06-28 12:28:17 -0700251 # install protobufs
Zack Williamsdf5a4ab2019-03-22 14:10:34 -0700252 PROTOC_VERSION="3.7.0"
253 PROTOC_SHA256SUM="a1b8ed22d6dc53c5b8680a6f1760a305b33ef471bece482e92728f00ba2a2969"
Kailash Khalasi929d21b2018-06-28 12:28:17 -0700254 curl -L -o /tmp/protoc-${PROTOC_VERSION}-linux-x86_64.zip https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip
255 echo "$PROTOC_SHA256SUM /tmp/protoc-${PROTOC_VERSION}-linux-x86_64.zip" | sha256sum -c -
Kailash Khalasic4ff32d2018-06-28 18:24:52 -0700256 unzip /tmp/protoc-${PROTOC_VERSION}-linux-x86_64.zip -d /tmp/protoc3
Kailash Khalasi929d21b2018-06-28 12:28:17 -0700257 mv /tmp/protoc3/bin/* /usr/local/bin/
258 mv /tmp/protoc3/include/* /usr/local/include/
Zack Williams0f80d902019-04-01 11:26:57 -0700259 # fix permissions on files
260 chmod -R a+rx /usr/local/bin/*
Zack Williams6b06aa52019-04-01 14:30:17 -0700261 chmod -R a+rX /usr/local/include/
Zack Williamscab43ba2018-09-19 09:58:25 -0700262
Kailash Khalasi929d21b2018-06-28 12:28:17 -0700263 # give sudo permissions on minikube and protoc to jenkins user
264 cat <<EOF >/etc/sudoers.d/88-jenkins-minikube-protoc
265Cmnd_Alias CMDS = /usr/local/bin/protoc, /usr/bin/minikube
Zack Williams81739772018-05-14 16:35:47 -0700266Defaults:jenkins !requiretty
Kailash Khalasi929d21b2018-06-28 12:28:17 -0700267jenkins ALL=(ALL) NOPASSWD:SETENV: CMDS
Zack Williams81739772018-05-14 16:35:47 -0700268EOF
269
Andy Bavierb781c4c2018-09-20 08:16:52 -0700270 # remove apparmor
271 service apparmor stop
272 update-rc.d -f apparmor remove
273 apt-get remove apparmor-utils libapparmor-perl apparmor
274 update-grub
275
Zack Williams85249ce2018-04-01 19:54:44 -0700276 # clean up
277 apt-get clean
278 apt-get purge -y
279 apt-get autoremove -y
280 rm -rf /var/lib/apt/lists/*
Linux Foundation Administrators1dc9dd52018-01-26 09:09:09 -0800281}
Zack Williams85249ce2018-04-01 19:54:44 -0700282
Linux Foundation Administrators1dc9dd52018-01-26 09:09:09 -0800283all_systems() {
284 echo 'No common distribution configuration to perform'
285}
286
287echo "---> Detecting OS"
288ORIGIN=$(facter operatingsystem | tr '[:upper:]' '[:lower:]')
289
290case "${ORIGIN}" in
291 fedora|centos|redhat)
292 echo "---> RH type system detected"
293 rh_systems
294 ;;
295 ubuntu)
296 echo "---> Ubuntu system detected"
297 ubuntu_systems
298 ;;
299 *)
300 echo "---> Unknown operating system"
301 ;;
302esac
303
304# execute steps for all systems
305all_systems