-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update construction of StemcellAutomation.zip
This updates the construction of StemcellAutomation.zip to require user-provided files. This is closer to how the official binaries for `stembuild` are built, and should be safer than the previous way assets were being downloaded. A script has been added to build the zip file when provided with the appropriate assets.
- Loading branch information
Showing
4 changed files
with
92 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,8 @@ stembuild construct -vm-ip <IP of VM> -vm-username <vm username> -vm-password <v | |
``` | ||
|
||
### Requirements | ||
- LGPO.zip in current working directory | ||
- LGPO.zip in current working directory. This is a zip of LGPO.exe from Microsoft that is compatible with the current version of Windows. https://www.microsoft.com/en-us/download/details.aspx?id=55319 | ||
- Constructed assets/StemcellAutomation.zip (contents described below) | ||
- Running Windows VM with: | ||
- Up-to-date Operating System | ||
- Reachable by IP over port 5985 | ||
|
@@ -113,14 +114,14 @@ Flags: | |
``` | ||
|
||
### Compiling & Running Stembuild Locally | ||
### Running Stembuild Locally | ||
|
||
Assuming you've followed [these instructions](https://bosh.io/docs/windows-stemcell-create/) and you've created a Windows VM at 10.9.9.115 whose Administrator's password is "c1oudc0w". | ||
|
||
```bash | ||
export TARGET_VM_PASSWORD=c1oudc0w VCENTER_PASSWORD='Admin!23' | ||
BOSH_AGENT_REPO=~/workspace/bosh-agent STEMBUILD_VERSION=2019.2 make | ||
GOVC_INSECURE=true out/stembuild -debug \ | ||
export TARGET_VM_PASSWORD=c1oudc0w VCENTER_PASSWORD='Admin!23' | ||
|
||
GOVC_INSECURE=true stembuild -debug \ | ||
construct \ | ||
-vm-ip 10.9.9.115 \ | ||
-vm-username Administrator \ | ||
|
@@ -129,7 +130,8 @@ GOVC_INSECURE=true out/stembuild -debug \ | |
-vcenter-username [email protected] \ | ||
-vcenter-password $VCENTER_PASSWORD \ | ||
-vm-inventory-path "/dc/vm/Discovered virtual machine/w2019-stemcell" | ||
GOVC_INSECURE=true out/stembuild -debug \ | ||
|
||
GOVC_INSECURE=true stembuild -debug \ | ||
package \ | ||
-vcenter-url vcenter-70.nono.io \ | ||
-vcenter-username [email protected] \ | ||
|
@@ -227,23 +229,66 @@ The output should be nothing if there are no out-of-sync dependencies. | |
|
||
## Compile stembuild locally | ||
|
||
Some of the make targets require the use of curl and [xq](https://github.com/sibprogrammer/xq?tab=readme-ov-file#installation) | ||
to download the latest dependencies from S3 to create the embedded StemcellAutomation.zip resource. The dependencies | ||
downloaded from s3 are the same ones used by [stembuild CI](https://github.com/cloudfoundry/greenhouse-ci/). | ||
|
||
Download or clone the bosh-agent repository | ||
``` | ||
git clone https://github.com/cloudfoundry/bosh-agent.git | ||
``` | ||
|
||
Download or clone the stembuild repository and navigate to it | ||
``` | ||
git clone https://github.com/cloudfoundry/stembuild.git | ||
cd stembuild | ||
``` | ||
|
||
Use `make build` to build stembuild, providing the corresponding values for the bosh-agent path and stemcell version you | ||
You will need to construct `assets/StemcellAutomation.zip`. This file represents various BOSH executables necessary to build a working stemcell. | ||
|
||
**assets/StemcellAutomation.zip files:** | ||
| File | Source / Description | | ||
|-|-| | ||
| OpenSSH-Win64.zip | https://github.com/PowerShell/Win32-OpenSSH/releases | | ||
| bosh-psmodules.zip | https://github.com/cloudfoundry/bosh-psmodules/tree/master/modules | | ||
| agent.zip | A zip constructed using various BOSH executables. See list of necessary files below. | | ||
| deps.json | A JSON file with the SHA256 checksums and optionally the version for each component in this zip. See format below. | | ||
|
||
**agent.zip files:** | ||
| File | Source / Description | | ||
|-|-| | ||
| bosh-agent.exe | https://github.com/cloudfoundry/bosh-agent/ | | ||
| sha | Git commit SHA from the bosh-agent repo | | ||
| deps/pipe.exe | https://github.com/cloudfoundry/bosh-agent/tree/main/jobsupervisor/pipe | | ||
| deps/bosh-blobstore-gcs.exe | https://github.com/cloudfoundry/bosh-gcscli | | ||
| deps/bosh-blobstore-dav.exe | https://github.com/cloudfoundry/bosh-davcli | | ||
| deps/bosh-blobstore-s3.exe | https://github.com/cloudfoundry/bosh-s3cli | | ||
| deps/tar.exe | https://github.com/cloudfoundry/bsdtar/ | | ||
| deps/job-service-wrapper.exe | https://github.com/bosh-dep-forks/winsw | | ||
| service_wrapper.exe | https://github.com/bosh-dep-forks/winsw | | ||
| service_wrapper.xml | https://github.com/cloudfoundry/bosh-agent/blob/main/integration/windows/fixtures/service_wrapper.xml | | ||
|
||
**deps.json format:** | ||
```json | ||
{ | ||
"OpenSSH-Win64.zip": { | ||
"sha": "SOME-SHA256", | ||
}, | ||
"bosh-psmodules.zip": { | ||
"sha": "SOME-SHA256", | ||
}, | ||
"agent.zip": { | ||
"sha": "SOME-SHA256", | ||
}, | ||
"LGPO.zip": { | ||
"sha": "SOME-SHA256", | ||
"version": "3" | ||
} | ||
} | ||
``` | ||
|
||
Once you have these files, run `./bin/build-stemcell-automation-zip.sh`: | ||
```bash | ||
OPENSSH_ZIP=OpenSSH-Win64.zip \ | ||
BOSH_PSMODULES_ZIP="bosh-psmodules.zip" \ | ||
AGENT_ZIP="agent.zip" \ | ||
DEPS_JSON="deps.json" \ | ||
./bin/build-stemcell-automation-zip.sh | ||
``` | ||
|
||
Use `make build` to build stembuild, providing the corresponding values for the stemcell version you | ||
would like to build, for example: | ||
``` | ||
BOSH_AGENT_REPO=../bosh-agent STEMBUILD_VERSION=2019.70 make build | ||
STEMBUILD_VERSION=2019.70 make build | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
set -eu -o pipefail | ||
|
||
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" | ||
STEMCELL_AUTOMATION_PS1=$(ls "${ROOT_DIR}"/stemcell-automation/*ps1 | grep -iv Test) | ||
|
||
: ${OPENSSH_ZIP?"Please see README.md on where to obtain this."} | ||
: ${BOSH_PSMODULES_ZIP?"Please see README.md on where to obtain this."} | ||
: ${AGENT_ZIP?"Please see README.md on how to construct this."} | ||
: ${DEPS_JSON?"Please see README.md on how to construct this."} | ||
|
||
TEMP_DIR=$(mktemp -d) | ||
|
||
cp "${OPENSSH_ZIP}" "${TEMP_DIR}/OpenSSH-Win64.zip" | ||
cp "${BOSH_PSMODULES_ZIP}" "${TEMP_DIR}/bosh-psmodules.zip" | ||
cp "${AGENT_ZIP}" "${TEMP_DIR}/agent.zip" | ||
cp "${DEPS_JSON}" "${TEMP_DIR}/deps.json" | ||
cp ${STEMCELL_AUTOMATION_PS1} "$TEMP_DIR" | ||
|
||
rm "${ROOT_DIR}/assets/StemcellAutomation.zip" | ||
|
||
zip -rj "${ROOT_DIR}/assets/StemcellAutomation.zip" "$TEMP_DIR" | ||
|
||
rm -r "$TEMP_DIR" |
This file was deleted.
Oops, something went wrong.