Cleanup Packer directory after VHD build (#3964)

This commit is contained in:
Cecile Robert-Michon 2018-10-05 13:42:28 -07:00 коммит произвёл Jack Francis
Родитель 23d532b07d
Коммит caa5c00c5b
3 изменённых файлов: 7 добавлений и 5 удалений

Просмотреть файл

@ -67,7 +67,7 @@
"inline": [ "inline": [
"sudo BUILD_NUMBER={{user `build_number`}} BUILD_ID={{user `build_id`}} COMMIT={{user `commit`}} /bin/bash -ux /home/packer/install-dependencies.sh", "sudo BUILD_NUMBER={{user `build_number`}} BUILD_ID={{user `build_id`}} COMMIT={{user `commit`}} /bin/bash -ux /home/packer/install-dependencies.sh",
"sudo /bin/bash -eux /home/packer/cleanup-vhd.sh", "sudo /bin/bash -eux /home/packer/cleanup-vhd.sh",
"rm /home/packer/*.sh" "rm -rf /home/packer"
] ]
} }
] ]

Просмотреть файл

@ -26,6 +26,7 @@ fi
if [ -f /var/log/azure/golden-image-install.complete ]; then if [ -f /var/log/azure/golden-image-install.complete ]; then
echo "detected golden image pre-install" echo "detected golden image pre-install"
FULL_INSTALL_REQUIRED=false FULL_INSTALL_REQUIRED=false
rm -rf /home/packer
else else
FULL_INSTALL_REQUIRED=true FULL_INSTALL_REQUIRED=true
fi fi

Просмотреть файл

@ -195,12 +195,12 @@ function pullHyperkube() {
path=$(find /home/rootfs-${KUBERNETES_VERSION} -name "hyperkube") path=$(find /home/rootfs-${KUBERNETES_VERSION} -name "hyperkube")
if [[ $OS == $COREOS_OS_NAME ]]; then if [[ $OS == $COREOS_OS_NAME ]]; then
cp "$path" "/opt/kubelet" mv "$path" "/opt/kubelet"
cp "$path" "/opt/kubectl" mv "$path" "/opt/kubectl"
chmod a+x /opt/kubelet /opt/kubectl chmod a+x /opt/kubelet /opt/kubectl
else else
cp "$path" "/usr/local/bin/kubelet-${KUBERNETES_VERSION}" mv "$path" "/usr/local/bin/kubelet-${KUBERNETES_VERSION}"
cp "$path" "/usr/local/bin/kubectl-${KUBERNETES_VERSION}" mv "$path" "/usr/local/bin/kubectl-${KUBERNETES_VERSION}"
fi fi
} }
@ -213,6 +213,7 @@ function extractHyperkube() {
mv "/usr/local/bin/kubectl-${KUBERNETES_VERSION}" "/usr/local/bin/kubectl" mv "/usr/local/bin/kubectl-${KUBERNETES_VERSION}" "/usr/local/bin/kubectl"
chmod a+x /usr/local/bin/kubelet /usr/local/bin/kubectl chmod a+x /usr/local/bin/kubelet /usr/local/bin/kubectl
rm -rf /usr/local/bin/kubelet-* /usr/local/bin/kubectl-* rm -rf /usr/local/bin/kubelet-* /usr/local/bin/kubectl-*
rm -rf /home/rootfs-*
} }
function pullContainerImage() { function pullContainerImage() {