Update for OpenCI migration
- Upgrade packer as it is way too old to support IAM based authentication
- Add VPC_ID and SUBNET_ID in environment variables to support multiple
infrastructure like DEV, TEST, PROD etc
- Add "packer_" tags to identify instances spun up by packer.
- Increase node size as Docker images are getting bigger
Change-Id: I10bb88affd9f408dc40ae0041adef647077ff7a3
Signed-off-by: Saheer Babu <saheer.babu@arm.com>
diff --git a/custom.sh b/custom.sh
index 0927cab..7d13ada 100755
--- a/custom.sh
+++ b/custom.sh
@@ -51,8 +51,7 @@
sed -i -e 's/#PermitTTY.*/PermitTTY yes/g' /etc/ssh/sshd_config
-# install packer. We are using an older version because current 1.8.5 has
-# a bug in it that prevents the temp ssh key from being setup for freebsd
-curl --output packer.zip https://releases.hashicorp.com/packer/1.5.1/packer_1.5.1_linux_amd64.zip
+curl --output packer.zip https://releases.hashicorp.com/packer/1.11.2/packer_1.11.2_linux_amd64.zip
unzip -o packer.zip
install -m 755 packer /usr/bin/packer
+packer plugins install github.com/hashicorp/amazon 1.3.3
diff --git a/packer_aarch64.json b/packer_aarch64.json
index 76c772a..8d8f552 100644
--- a/packer_aarch64.json
+++ b/packer_aarch64.json
@@ -1,14 +1,17 @@
{
"variables": {
- "vpc_region": "us-east-1",
- "ssh_username": "ubuntu"
+ "vpc_region": "eu-west-1",
+ "ssh_username": "ubuntu",
+ "git_hash": "",
+ "vpc_id": "{{env `VPC_ID`}}",
+ "subnet_id": "{{env `SUBNET_ID`}}"
},
"builders": [
{
"type": "amazon-ebs",
"name": "ubuntu-20.04-mbedtls",
- "vpc_id": "vpc-d28c0ca9",
- "subnet_id": "subnet-a0d573af",
+ "vpc_id": "{{user `vpc_id`}}",
+ "subnet_id": "{{user `subnet_id`}}",
"region": "{{user `vpc_region`}}",
"source_ami_filter": {
"filters": {
@@ -22,13 +25,7 @@
"instance_type": "t4g.large",
"ssh_username": "{{user `ssh_username`}}",
"ami_name": "jenkins-aarch64-{{isotime \"2006-01-02-1504\"}}",
- "ami_users": [
- "987685672616"
- ],
- "ami_regions": ["eu-central-1" ],
- "snapshot_users": [
- "987685672616"
- ],
+ "ami_regions": ["eu-west-1" ],
"launch_block_device_mappings": [
{
"device_name": "/dev/sda1",
@@ -36,7 +33,10 @@
"volume_size": "50",
"delete_on_termination": true
}
- ]
+ ],
+ "run_tags": {
+ "Name": "packer_builder"
+ }
}
],
"provisioners": [
diff --git a/packer_custom.json b/packer_custom.json
index 7f81a0c..e96446d 100644
--- a/packer_custom.json
+++ b/packer_custom.json
@@ -1,14 +1,16 @@
{
"variables": {
- "vpc_region": "us-east-1",
- "ssh_username": "ubuntu"
+ "vpc_region": "eu-west-1",
+ "ssh_username": "ubuntu",
+ "vpc_id": "{{env `VPC_ID`}}",
+ "subnet_id": "{{env `SUBNET_ID`}}"
},
"builders": [
{
"type": "amazon-ebs",
"name": "ubuntu-20.04-custom",
- "vpc_id": "vpc-d28c0ca9",
- "subnet_id": "subnet-a0d573af",
+ "vpc_id": "{{user `vpc_id`}}",
+ "subnet_id": "{{user `subnet_id`}}",
"region": "{{user `vpc_region`}}",
"source_ami_filter": {
"filters": {
@@ -22,21 +24,18 @@
"instance_type": "m5a.large",
"ssh_username": "{{user `ssh_username`}}",
"ami_name": "jenkins-custom-amd64-{{isotime \"2006-01-02-1504\"}}",
- "ami_regions": ["eu-central-1" ],
- "ami_users": [
- "987685672616"
- ],
- "snapshot_users": [
- "987685672616"
- ],
+ "ami_regions": ["eu-west-1" ],
"launch_block_device_mappings": [
{
"device_name": "/dev/sda1",
"volume_type": "gp2",
- "volume_size": "40",
+ "volume_size": "80",
"delete_on_termination": true
}
- ]
+ ],
+ "run_tags": {
+ "Name": "packer_builder"
+ }
}
],
"provisioners": [
diff --git a/packer_freebsd.json b/packer_freebsd.json
index ecc6724..1a1ebc3 100644
--- a/packer_freebsd.json
+++ b/packer_freebsd.json
@@ -1,14 +1,16 @@
{
"variables": {
- "vpc_region": "us-east-1",
- "ssh_username": "ec2-user"
+ "vpc_region": "eu-west-1",
+ "ssh_username": "ec2-user",
+ "vpc_id": "{{env `VPC_ID`}}",
+ "subnet_id": "{{env `SUBNET_ID`}}"
},
"builders": [
{
"type": "amazon-ebs",
"name": "freebsd-12.3-mbedtls",
- "vpc_id": "vpc-d28c0ca9",
- "subnet_id": "subnet-a0d573af ",
+ "vpc_id": "{{user `vpc_id`}}",
+ "subnet_id": "{{user `subnet_id`}}",
"region": "{{user `vpc_region`}}",
"source_ami_filter": {
"filters": {
@@ -21,13 +23,7 @@
"instance_type": "t3.medium",
"ssh_username": "{{user `ssh_username`}}",
"ami_name": "jenkins-freebsd-amd64-{{isotime \"2006-01-02-1504\"}}",
- "ami_regions": ["eu-central-1"],
- "ami_users": [
- "987685672616"
- ],
- "snapshot_users": [
- "987685672616"
- ],
+ "ami_regions": ["eu-west-1"],
"launch_block_device_mappings": [
{
"device_name": "/dev/sda1",
@@ -35,7 +31,10 @@
"volume_size": "30",
"delete_on_termination": true
}
- ]
+ ],
+ "run_tags": {
+ "Name": "packer_builder"
+ }
}
],
"provisioners": [
diff --git a/packer_ubuntu.json b/packer_ubuntu.json
index da2a1f7..ea446cb 100644
--- a/packer_ubuntu.json
+++ b/packer_ubuntu.json
@@ -1,14 +1,16 @@
{
"variables": {
- "vpc_region": "us-east-1",
- "ssh_username": "ubuntu"
+ "vpc_region": "eu-west-1",
+ "ssh_username": "ubuntu",
+ "vpc_id": "{{env `VPC_ID`}}",
+ "subnet_id": "{{env `SUBNET_ID`}}"
},
"builders": [
{
"type": "amazon-ebs",
"name": "ubuntu-20.04-mbedtls",
- "vpc_id": "vpc-d28c0ca9",
- "subnet_id": "subnet-a0d573af",
+ "vpc_id": "{{user `vpc_id`}}",
+ "subnet_id": "{{user `subnet_id`}}",
"region": "{{user `vpc_region`}}",
"source_ami_filter": {
"filters": {
@@ -22,13 +24,6 @@
"instance_type": "m5a.large",
"ssh_username": "{{user `ssh_username`}}",
"ami_name": "jenkins-amd64-{{isotime \"2006-01-02-1504\"}}",
- "ami_users": [
- "987685672616"
- ],
- "ami_regions": ["eu-central-1" ],
- "snapshot_users": [
- "987685672616"
- ],
"launch_block_device_mappings": [
{
"device_name": "/dev/sda1",
@@ -36,7 +31,10 @@
"volume_size": "50",
"delete_on_termination": true
}
- ]
+ ],
+ "run_tags": {
+ "Name": "packer_builder"
+ }
}
],
"provisioners": [