Install amazon jdk and update the sudoer file
- Increase the volume size, default is 8G and too small to install all
required packages
- THe default version of maven in Ubuntu 16.04 is mvn33 but it's mvn36
in Ubuntu 18.04
- We have to setup the JAVA_HOME for mvn36 but we did't do it in our
jobs so all jobs with mvn36 will fail.
- Specify the mvn33
Change-Id: I2560e83d941f6093ee4fe2f1f24bb8b359c2706b
diff --git a/packer/provision/baseline.yaml b/packer/provision/baseline.yaml
index 1aad172..2c43ecf 100644
--- a/packer/provision/baseline.yaml
+++ b/packer/provision/baseline.yaml
@@ -17,7 +17,7 @@
dest: /etc/sudoers.d/89-jenkins-user-defaults
content: |
Defaults:jenkins !requiretty
- jenkins ALL=(ALL) NOPASSWD:ALL
+ jenkins ALL = NOPASSWD: /usr/sbin/update-alternatives, /usr/sbin/update-java-alternatives
validate: /usr/sbin/visudo -cf %s
become: yes
diff --git a/packer/provision/onf-playbook.yaml b/packer/provision/onf-playbook.yaml
index 206fec8..c69e00c 100644
--- a/packer/provision/onf-playbook.yaml
+++ b/packer/provision/onf-playbook.yaml
@@ -7,6 +7,16 @@
become: true
tasks:
+ - name: Add Java Amazon Corretto Jdk repo GPG key
+ apt_key:
+ url: https://apt.corretto.aws/corretto.key
+ state: present
+
+ - name: Add Java Amazon Corretto Jdk repo
+ apt_repository:
+ repo: deb https://apt.corretto.aws stable main
+ state: present
+
- name: Install apt packages
apt:
name:
@@ -37,6 +47,8 @@
- "nodejs-dev"
- "node-gyp"
- "npm"
+ - "java-1.8.0-amazon-corretto-jdk"
+ - "java-11-amazon-corretto-jdk"
state: "present"
update_cache: true
cache_valid_time: 3600