extra_vars and image_name parametrization added
PROD-18791
Change-Id: Ic685ada838833a121b574272fee03796991cbe14
diff --git a/Jenkinsfile b/Jenkinsfile
index 6769e0e..1b45d1f 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -134,6 +134,8 @@
}else{
throw new Exception("Qemu image convert failed")
}
+ } else {
+ throw new Exception("No Qemu images with '-qemu-' in its path")
}
}
if (buildTypes.contains("docker")) {
@@ -146,6 +148,8 @@
}else{
throw new Exception("pbzip2 image convert failed")
}
+ } else {
+ throw new Exception("No Docker images with '-docker-' in its path")
}
}
diff --git a/centos-7/template.json b/centos-7/template.json
index 22497b0..d0047b9 100644
--- a/centos-7/template.json
+++ b/centos-7/template.json
@@ -4,6 +4,7 @@
"password": "ho5uo7Uome5d",
"do_api_token": "{{ env `DO_API_TOKEN` }}",
"distro": "centos-7-x64",
+ "image_name": "{{ env `IMAGE_NAME` }}",
"disk_size": "8000"
},
"provisioners": [
@@ -61,7 +62,7 @@
{
"type": "vagrant",
"keep_input_artifact": true,
- "output": "images/{{ user `distro` }}-{{.Provider}}-{{ isotime \"200601021504\" }}.box",
+ "output": "images/{{ user `image_name` }}-{{.Provider}}-{{ isotime \"200601021504\" }}.box",
"except": [ "docker" ]
},
{
@@ -72,7 +73,7 @@
},
{
"type": "docker-save",
- "path": "images/{{ user `distro` }}-docker-{{ isotime \"200601021504\" }}.tar",
+ "path": "images/{{ user `image_name` }}-docker-{{ isotime \"200601021504\" }}.tar",
"only": ["docker"]
}
],
@@ -107,7 +108,7 @@
"qemuargs": [
[ "-m", "1024M" ]
],
- "vm_name": "{{ user `distro` }}-{{ isotime \"200601021504\" }}",
+ "vm_name": "{{ user `image_name` }}-{{ isotime \"200601021504\" }}",
"output_directory": "images/{{ user `distro` }}-qemu-{{ isotime \"200601021504\" }}",
"format": "qcow2",
"accelerator": "kvm",
diff --git a/day01-image/scripts/cleanup.sh b/day01-image/scripts/cleanup.sh
index 059fe44..cf27058 100644
--- a/day01-image/scripts/cleanup.sh
+++ b/day01-image/scripts/cleanup.sh
@@ -1,12 +1,13 @@
#!/bin/bash -xe
-#apt-get purge salt-formula-* -y
+chmod +x /var/lib/maas/.maas_login.sh
+
+apt-get purge salt-formula-* -y
apt-get -y autoremove --purge
apt-get -y clean
-#rm -rf /var/lib/apt/lists/*
-#rm -rf /etc/apt/sources.list.d/*
-#echo "" > /etc/apt/sources.list
-#rm -rf '/srv/salt/reclass/classes/!(service)'
-chmod +x /var/lib/maas/.maas_login.sh
+rm -rf /var/lib/apt/lists/*
+rm -rf /etc/apt/sources.list.d/*
+echo "" > /etc/apt/sources.list
+rm -rf '/srv/salt/reclass/classes/!(service)'
rm -f /usr/sbin/policy-rc.d || true
echo "cleaning up hostname"
diff --git a/day01-image/template.json b/day01-image/template.json
index 0b957a4..ceb046c 100644
--- a/day01-image/template.json
+++ b/day01-image/template.json
@@ -4,7 +4,7 @@
"password": "r00tme",
"do_api_token": "{{ env `DO_API_TOKEN` }}",
"image_name": "{{ env `IMAGE_NAME` }}",
- "disk_size": "150000"
+ "disk_size": "50000"
},
"provisioners": [
diff --git a/debian-8/template.json b/debian-8/template.json
index bfdea6d..f8b07b2 100644
--- a/debian-8/template.json
+++ b/debian-8/template.json
@@ -2,8 +2,9 @@
"variables": {
"user": "root",
"password": "ho5uo7Uome5d",
- "do_api_token": "{{ env `DO_API_TOKEN` }}",
- "distro": "debian-8-x64",
+ "do_api_token": "{{ env `DO_API_TOKEN` }}",
+ "distro": "debian-8-x64",
+ "image_name": "{{ env `IMAGE_NAME` }}",
"disk_size": "8000"
},
@@ -75,7 +76,7 @@
{
"type": "vagrant",
"keep_input_artifact": true,
- "output": "images/{{ user `distro` }}-{{.Provider}}-{{ isotime \"200601021504\" }}.box",
+ "output": "images/{{ user `image_name` }}-{{.Provider}}-{{ isotime \"200601021504\" }}.box",
"except": [ "digitalocean", "docker" ]
},
{
@@ -86,7 +87,7 @@
},
{
"type": "docker-save",
- "path": "images/{{ user `distro` }}-docker-{{ isotime \"200601021504\" }}.tar",
+ "path": "images/{{ user `image_name` }}-docker-{{ isotime \"200601021504\" }}.tar",
"only": ["docker"]
}
],
@@ -164,7 +165,7 @@
"boot_wait": "5s",
"disk_size": "{{ user `disk_size`}}",
"disk_type_id": 4,
- "vmdk_name": "{{ user `distro`}}",
+ "vmdk_name": "{{ user `image_name`}}",
"output_directory": "images/{{ user `distro` }}-vmware-{{ isotime \"200601021504\" }}",
"guest_os_type": "linux",
"http_directory": "http",
@@ -187,7 +188,7 @@
"qemuargs": [
[ "-m", "1024M" ]
],
- "vm_name": "{{ user `distro` }}-{{ isotime \"200601021504\" }}",
+ "vm_name": "{{ user `image_name` }}-{{ isotime \"200601021504\" }}",
"output_directory": "images/{{ user `distro` }}-qemu-{{ isotime \"200601021504\" }}",
"format": "qcow2",
"accelerator": "kvm",
@@ -233,8 +234,8 @@
{
"type": "digitalocean",
"api_token": "{{user `do_api_token`}}",
- "image": "{{user `distro`}}",
- "snapshot_name": "{{ user `distro` }}-{{ isotime \"200601021504\" }}",
+ "image": "{{user `image_name`}}",
+ "snapshot_name": "{{ user `image_name` }}-{{ isotime \"200601021504\" }}",
"region" : "ams2",
"size" : "1gb"
}
diff --git a/ubuntu-14.04/template.json b/ubuntu-14.04/template.json
index 13d878c..b91fa95 100644
--- a/ubuntu-14.04/template.json
+++ b/ubuntu-14.04/template.json
@@ -4,6 +4,7 @@
"password": "ho5uo7Uome5d",
"do_api_token": "{{ env `DO_API_TOKEN` }}",
"distro": "ubuntu-14-04-x64",
+ "image_name": "{{ env `IMAGE_NAME` }}",
"disk_size": "8000"
},
"provisioners": [
@@ -74,7 +75,7 @@
{
"type": "vagrant",
"keep_input_artifact": true,
- "output": "images/{{ user `distro` }}-{{.Provider}}-{{ isotime \"200601021504\" }}.box",
+ "output": "images/{{ user `image_name` }}-{{.Provider}}-{{ isotime \"200601021504\" }}.box",
"except": [
"digitalocean",
"docker"
@@ -90,7 +91,7 @@
},
{
"type": "docker-save",
- "path": "images/{{ user `distro` }}-docker-{{ isotime \"200601021504\" }}.tar",
+ "path": "images/{{ user `image_name` }}-docker-{{ isotime \"200601021504\" }}.tar",
"only": [
"docker"
]
@@ -203,7 +204,7 @@
"boot_wait": "5s",
"disk_size": "{{ user `disk_size`}}",
"disk_type_id": 4,
- "vmdk_name": "{{ user `distro`}}",
+ "vmdk_name": "{{ user `image_name`}}",
"output_directory": "images/{{ user `distro` }}-vmware-{{ isotime \"200601021504\" }}",
"guest_os_type": "linux",
"http_directory": "http",
@@ -229,7 +230,7 @@
"1024M"
]
],
- "vm_name": "{{ user `distro` }}-{{ isotime \"200601021504\" }}",
+ "vm_name": "{{ user `image_name` }}-{{ isotime \"200601021504\" }}",
"output_directory": "images/{{ user `distro` }}-qemu-{{ isotime \"200601021504\" }}",
"format": "qcow2",
"accelerator": "kvm",
@@ -279,8 +280,8 @@
{
"type": "digitalocean",
"api_token": "{{user `do_api_token`}}",
- "image": "{{user `distro`}}",
- "snapshot_name": "{{ user `distro` }}-{{ isotime \"200601021504\" }}",
+ "image": "{{user `image_name`}}",
+ "snapshot_name": "{{ user `image_name` }}-{{ isotime \"200601021504\" }}",
"region": "ams2",
"size": "1gb"
}
diff --git a/ubuntu-16.04/template.json b/ubuntu-16.04/template.json
index bdfa4c1..6d0e1fc 100644
--- a/ubuntu-16.04/template.json
+++ b/ubuntu-16.04/template.json
@@ -7,7 +7,7 @@
"ubuntu_baseurl": "https://mirror.mirantis.com/proposed/ubuntu/",
"saltstack_repo": "deb [arch=amd64] https://mirror.mirantis.com/proposed/saltstack-2016.3/xenial/ xenial main",
"do_api_token": "{{ env `DO_API_TOKEN` }}",
- "image_name": "ubuntu-16-04-x64",
+ "image_name": "{{ env `IMAGE_NAME` }}",
"os_username": "{{ env `OS_USERNAME` }}",
"os_password": "{{ env `OS_PASSWORD` }}",
"os_image": "7451fac0-0ce5-4d30-ae36-cd9a90e7948e",
@@ -110,7 +110,7 @@
{
"type": "vagrant",
"keep_input_artifact": true,
- "output": "images/{{ user `distro` }}-{{.Provider}}-{{ isotime \"200601021504\" }}.box",
+ "output": "images/{{ user `image_name` }}-{{.Provider}}-{{ isotime \"200601021504\" }}.box",
"except": [
"digitalocean",
"docker"
@@ -126,7 +126,7 @@
},
{
"type": "docker-save",
- "path": "images/{{ user `distro` }}-docker-{{ isotime \"200601021504\" }}.tar",
+ "path": "images/{{ user `image_name` }}-docker-{{ isotime \"200601021504\" }}.tar",
"only": [
"docker"
]
@@ -239,7 +239,7 @@
"boot_wait": "5s",
"disk_size": "{{ user `disk_size`}}",
"disk_type_id": 4,
- "vmdk_name": "{{ user `distro`}}",
+ "vmdk_name": "{{ user `image_name`}}",
"output_directory": "images/{{ user `distro` }}-vmware-{{ isotime \"200601021504\" }}",
"guest_os_type": "linux",
"http_directory": "http",
@@ -265,8 +265,8 @@
{
"type": "digitalocean",
"api_token": "{{user `do_api_token`}}",
- "image": "{{user `distro`}}",
- "snapshot_name": "{{ user `distro` }}-{{ isotime \"200601021504\" }}",
+ "image": "{{user `image_name`}}",
+ "snapshot_name": "{{ user `image_name` }}-{{ isotime \"200601021504\" }}",
"region": "ams2",
"size": "1gb"
},