Skip to content

Commit 5a838ce

Browse files
committed
Relocate scripts for building machine images
This patch relocates all of the scripts for building machine images into the "build/images/hack" directory. The purpose of this change is to isolate the assets used to build machine images in order to make it easier to copy CAPV's image stamper to the upstream tool.
1 parent 74f274e commit 5a838ce

File tree

9 files changed

+9
-9
lines changed

9 files changed

+9
-9
lines changed

build/images/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ The `vmware-iso` builder supports building against a remote VMware ESX server, b
2121
- [Ansible](http://docs.ansible.com/ansible/latest/intro_installation.html) version >= 2.8.0
2222
- [goss](https://github.com/YaleUniversity/packer-provisioner-goss)
2323

24-
The program `../../hack/image-tools.sh` can be used to download and install the goss plug-in.
24+
The program `hack/image-tools.sh` can be used to download and install the goss plug-in.
2525

2626
## The `cloudinit` Directory
2727

28-
The `images` directory contains a child directory, `cloudinit`. The files in this directory:
28+
The `cloudinit` contains files that:
2929

3030
- **Are** example data used for testing
3131
- Are **not** included in any of the images
@@ -76,7 +76,7 @@ The images are uploaded to the GCS bucket `capv-images`. The path to the image d
7676
Uploading the images requires the `gcloud` and `gsutil` programs, an active Google Cloud account, or a service account with an associated key file. The latter may be specified via the environment variable `KEY_FILE`.
7777

7878
```shell
79-
../../hack/image-upload.py --key-file KEY_FILE BUILD_DIR
79+
hack/image-upload.py --key-file KEY_FILE BUILD_DIR
8080
```
8181

8282
First the images are checksummed (SHA256). If a matching checksum already exists remotely then the image is not re-uploaded. Otherwise the images are uploaded to the GCS bucket.
@@ -104,11 +104,11 @@ Images may be downloaded via HTTP:
104104

105105
#### Accessing Local VMs
106106

107-
After the images are built, the VMs from they are built are prepped for local testing. Simply boot the VM locally with Fusion or Workstation and the machine will be initialized with cloud-init data from the `cloudinit` directory. The VMs may be accessed via SSH by using the command `../../hack/image-ssh.sh BUILD_DIR`.
107+
After the images are built, the VMs from they are built are prepped for local testing. Simply boot the VM locally with Fusion or Workstation and the machine will be initialized with cloud-init data from the `cloudinit` directory. The VMs may be accessed via SSH by using the command `hack/image-ssh.sh BUILD_DIR`.
108108

109109
#### Accessing Remote VMs
110110

111-
After deploying an image to vSphere, use `../../hack/image-govc-cloudinit.sh VM` to snapshot the image and update it with cloud-init data from the `cloudinit` directory. The VM may now be accessed with `ssh -i cloudinit/id_rsa.capi SSH_USER@VM_IP`.
111+
After deploying an image to vSphere, use `hack/image-govc-cloudinit.sh VM` to snapshot the image and update it with cloud-init data from the `cloudinit` directory. The VM may now be accessed with `ssh -i cloudinit/id_rsa.capi SSH_USER@VM_IP`.
112112

113113
### Initialize a CNI
114114

File renamed without changes.
File renamed without changes.
File renamed without changes.

hack/image-post-create-config.sh renamed to build/images/hack/image-post-create-config.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ if grep -q 'guestinfo.userdata' "${VMX_FILE}"; then
6767
echo "image-post-create-config: skipping cloud-init data; already exists"
6868
else
6969
echo "image-post-create-config: insert cloud-init data"
70-
CIDATA_DIR="$(dirname "${BASH_SOURCE[0]}")/../build/images/cloudinit"
70+
CIDATA_DIR="$(dirname "${BASH_SOURCE[0]}")/../cloudinit"
7171
cat <<EOF >>"${VMX_FILE}"
7272
guestinfo.userdata = "$({ base64 -w0 || base64; } 2>/dev/null <"${CIDATA_DIR}/user-data")"
7373
guestinfo.userdata.encoding = "base64"

hack/image-ssh.sh renamed to build/images/hack/image-ssh.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@ fi
5858
IP_ADDR="$(vmrun getGuestIPAddress "${VMX_FILE}")"
5959

6060
# SSH into the VM with the provided user.
61-
SSH_KEY="$(dirname "${BASH_SOURCE[0]}")/../build/images/cloudinit/id_rsa.capi"
61+
SSH_KEY="$(dirname "${BASH_SOURCE[0]}")/../cloudinit/id_rsa.capi"
6262
echo "image-ssh: ssh -i ${SSH_KEY} ${SSH_USER}@${IP_ADDR}"
6363
exec ssh -o UserKnownHostsFile=/dev/null -i "${SSH_KEY}" "${SSH_USER}"@"${IP_ADDR}"
File renamed without changes.
File renamed without changes.

build/images/packer/packer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@
8686
},
8787
{
8888
"type": "shell-local",
89-
"command": "../../../hack/image-build-ova.py ./output/{{build_name}}+kube-{{user `kubernetes_semver`}}"
89+
"command": "../hack/image-build-ova.py ./output/{{build_name}}+kube-{{user `kubernetes_semver`}}"
9090
},
9191
{
9292
"type": "shell-local",
93-
"command": "../../../hack/image-post-create-config.sh ./output/{{build_name}}+kube-{{user `kubernetes_semver`}}"
93+
"command": "../hack/image-post-create-config.sh ./output/{{build_name}}+kube-{{user `kubernetes_semver`}}"
9494
}
9595
]
9696
}

0 commit comments

Comments
 (0)