Skip to content

Commit e8659fe

Browse files
authored
Packer: add rust and cargo toolchain (#4310)
Signed-off-by: Ryan Aslett <[email protected]>
1 parent cf2bb47 commit e8659fe

2 files changed

Lines changed: 26 additions & 4 deletions

File tree

orka/templates/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Once installed, you can verify the installation by running the following command
1010
packer --version
1111
```
1212

13-
While writing this document, the latest version of Packer is `1.14.2`.
13+
While writing this document, the latest version of Packer is `1.15.1`.
1414

1515
## Install dependencies
1616

@@ -49,9 +49,9 @@ We need the private key for node-www for the release images, as well as the appl
4949
2. Go to the `build/release` folder in the secrets repo
5050
3. Extract from secrets/build/release and put it in this repo (adjust the orka path in this command): `dotgpg cat Apple\ Developer\ ID\ Node.js\ Foundation.p12.base64 | base64 -D > orka/templates/files/secrets/Apple\ Developer\ ID\ Node.js\ Foundation.p12`
5151

52-
## Download Xcode to the shared vm storage
52+
## Download Xcode to the shared vm storage
5353

54-
1. Full Xcode installation
54+
1. Full Xcode installation (if adding a new xcode version)
5555

5656
Xcode Command-line tools are not enough to perform a full notarization cycle, full Xcode must be fully installed on the release images.
5757

orka/templates/macos-test.pkr.hcl

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ variable "xcode_version" {
3636
default = "16.4"
3737
}
3838

39+
variable "rust_version" {
40+
type = string
41+
default = "1.82"
42+
description = "Rust toolchain version to install via rustup. Matches RUSTC_VERSION in nodejs/node test-macos.yml."
43+
}
44+
3945

4046
variable "ssh_default_username" {
4147
type = string
@@ -158,7 +164,7 @@ build {
158164
"chmod 700 /Users/${var.ssh_default_username}/.ssh",
159165
"chmod 600 /Users/${var.ssh_default_username}/.ssh/authorized_keys"
160166
]
161-
}
167+
}
162168
// Add GitHub host key to known hosts.
163169
provisioner "shell" {
164170
inline = [
@@ -244,13 +250,29 @@ build {
244250
"${local.homebrew_path}/bin/brew install --cask temurin@17",
245251
]
246252
}
253+
// Install Rust via rustup (matches nodejs/node test-macos.yml RUSTC_VERSION).
254+
provisioner "shell" {
255+
environment_vars = ["HOME=/Users/admin", "USER=admin"]
256+
inline = [
257+
"echo 'Installing rustup...'",
258+
"eval \"$(${local.homebrew_path}/bin/brew shellenv)\"",
259+
"${local.homebrew_path}/bin/brew install rustup",
260+
"echo 'Installing Rust ${var.rust_version} toolchain...'",
261+
"rustup-init -y --no-modify-path --default-toolchain ${var.rust_version} --profile minimal",
262+
"echo 'export PATH=\"/Users/admin/.cargo/bin:$PATH\"' >> /Users/admin/.zprofile",
263+
"/Users/admin/.cargo/bin/rustup --version",
264+
"/Users/admin/.cargo/bin/rustc --version",
265+
"/Users/admin/.cargo/bin/cargo --version"
266+
]
267+
}
247268
// Print the version of the installed packages.
248269
provisioner "shell" {
249270
inline = [
250271
"echo 'Printing the version of the installed packages...'",
251272
"eval \"$(${local.homebrew_path}/bin/brew shellenv)\"",
252273
"${local.homebrew_path}/bin/brew list --versions",
253274
"java -version",
275+
"source /Users/admin/.zprofile && rustc --version && cargo --version",
254276
// @TODO: Solve the problem with the Xcode version.
255277
//"xcodebuild -version"
256278
]

0 commit comments

Comments
 (0)