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
diff --git a/packer/templates/basebuild_1804.json b/packer/templates/basebuild_1804.json
index 668b282..0bd5455 100644
--- a/packer/templates/basebuild_1804.json
+++ b/packer/templates/basebuild_1804.json
@@ -11,6 +11,7 @@
"source_ami_filter_name": null,
"source_ami_filter_owner": null,
"source_ami_filter_product_code": "",
+ "vm_volume_size": "20",
"subnet_id": null,
"ssh_user": null
},
@@ -37,6 +38,14 @@
"ssh_username": "{{user `ssh_user`}}",
"subnet_id": "{{user `subnet_id`}}",
"type": "amazon-ebs",
+ "launch_block_device_mappings": [
+ {
+ "device_name": "/dev/sda1",
+ "volume_size": "{{user `vm_volume_size`}}",
+ "volume_type": "gp2",
+ "delete_on_termination": true
+ }
+ ],
"user_data_file": "{{user `cloud_user_data`}}"
}
],