mirror of
https://github.com/gravitational/teleport
synced 2024-10-19 16:53:57 +00:00
Add Rust to dronegen (#30822)
* Add Rust to dronegen * Update build.assets/windows/build.ps1 Co-authored-by: Noah Stride <noah.stride@goteleport.com> --------- Co-authored-by: Noah Stride <noah.stride@goteleport.com>
This commit is contained in:
parent
b6bf8120c2
commit
9d57eb4642
28
.drone.yml
28
.drone.yml
|
@ -378,6 +378,19 @@ steps:
|
|||
GITHUB_PRIVATE_KEY:
|
||||
from_secret: GITHUB_PRIVATE_KEY
|
||||
WORKSPACE_DIR: C:/Drone/Workspace/push-build-native-windows-amd64
|
||||
- name: Install Rust Toolchain
|
||||
commands:
|
||||
- $ProgressPreference = 'SilentlyContinue'
|
||||
- $ErrorActionPreference = 'Stop'
|
||||
- $Workspace = "$Env:WORKSPACE_DIR/$Env:DRONE_BUILD_NUMBER"
|
||||
- $TeleportSrc = "$Workspace/go/src/github.com/gravitational/teleport"
|
||||
- . "$TeleportSrc/build.assets/windows/build.ps1"
|
||||
- Push-Location "$TeleportSrc/build.assets"
|
||||
- $RustVersion = $(make print-rust-version).Trim()
|
||||
- Pop-Location
|
||||
- Install-Rust -RustVersion $RustVersion -ToolchainDir "$Workspace/toolchains"
|
||||
environment:
|
||||
WORKSPACE_DIR: C:/Drone/Workspace/push-build-native-windows-amd64
|
||||
- name: Install Node Toolchain
|
||||
commands:
|
||||
- $ProgressPreference = 'SilentlyContinue'
|
||||
|
@ -691,6 +704,19 @@ steps:
|
|||
GITHUB_PRIVATE_KEY:
|
||||
from_secret: GITHUB_PRIVATE_KEY
|
||||
WORKSPACE_DIR: C:/Drone/Workspace/build-native-windows-amd64
|
||||
- name: Install Rust Toolchain
|
||||
commands:
|
||||
- $ProgressPreference = 'SilentlyContinue'
|
||||
- $ErrorActionPreference = 'Stop'
|
||||
- $Workspace = "$Env:WORKSPACE_DIR/$Env:DRONE_BUILD_NUMBER"
|
||||
- $TeleportSrc = "$Workspace/go/src/github.com/gravitational/teleport"
|
||||
- . "$TeleportSrc/build.assets/windows/build.ps1"
|
||||
- Push-Location "$TeleportSrc/build.assets"
|
||||
- $RustVersion = $(make print-rust-version).Trim()
|
||||
- Pop-Location
|
||||
- Install-Rust -RustVersion $RustVersion -ToolchainDir "$Workspace/toolchains"
|
||||
environment:
|
||||
WORKSPACE_DIR: C:/Drone/Workspace/build-native-windows-amd64
|
||||
- name: Install Node Toolchain
|
||||
commands:
|
||||
- $ProgressPreference = 'SilentlyContinue'
|
||||
|
@ -17093,6 +17119,6 @@ image_pull_secrets:
|
|||
- DOCKERHUB_CREDENTIALS
|
||||
---
|
||||
kind: signature
|
||||
hmac: b2987beec79eb0ab1b984082213c4d15dadab830f15ddae3dfefd5eba1025ca1
|
||||
hmac: fe4b25966946166fea1be9a05da31480baa5963de4caf62ae985ff4327b55ce9
|
||||
|
||||
...
|
||||
|
|
|
@ -114,6 +114,41 @@ function Enable-Go {
|
|||
}
|
||||
}
|
||||
|
||||
function Install-Rust {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Downloads and installs Rust into the supplied toolchain dir
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[string] $ToolchainDir,
|
||||
[string] $RustVersion
|
||||
)
|
||||
begin {
|
||||
New-Item -Path "$ToolchainDir" -ItemType Directory -Force | Out-Null
|
||||
$RustupFile = "$ToolchainDir/rustup-init.exe"
|
||||
Invoke-WebRequest -Uri https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-gnu/rustup-init.exe -OutFile $RustupFile
|
||||
$Env:RUSTUP_HOME = "$ToolchainDir/rustup"
|
||||
$Env:CARGO_HOME = "$ToolchainDir/cargo"
|
||||
& "$ToolchainDir\rustup-init.exe" --profile minimal -y --default-toolchain "$RustVersion-x86_64-pc-windows-gnu"
|
||||
Enable-Rust -ToolchainDir $ToolchainDir
|
||||
}
|
||||
}
|
||||
|
||||
function Enable-Rust {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Adds the Rust toolchain to the system search path
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[string] $ToolchainDir
|
||||
)
|
||||
begin {
|
||||
$Env:Path = "$ToolchainDir/cargo/bin;$Env:Path"
|
||||
}
|
||||
}
|
||||
|
||||
function Install-Node {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
|
|
@ -46,6 +46,7 @@ func windowsTagPipeline() pipeline {
|
|||
p.Steps = []step{
|
||||
cloneWindowsRepositoriesStep(p.Workspace.Path),
|
||||
updateWindowsSubreposStep(p.Workspace.Path),
|
||||
installWindowsRustToolchainStep(p.Workspace.Path),
|
||||
installWindowsNodeToolchainStep(p.Workspace.Path),
|
||||
installWindowsGoToolchainStep(p.Workspace.Path),
|
||||
buildWindowsAuthenticationPackageStep(p.Workspace.Path),
|
||||
|
@ -111,6 +112,7 @@ func windowsPushPipeline() pipeline {
|
|||
p.Steps = []step{
|
||||
cloneWindowsRepositoriesStep(p.Workspace.Path),
|
||||
updateWindowsSubreposStep(p.Workspace.Path),
|
||||
installWindowsRustToolchainStep(p.Workspace.Path),
|
||||
installWindowsNodeToolchainStep(p.Workspace.Path),
|
||||
installWindowsGoToolchainStep(p.Workspace.Path),
|
||||
buildWindowsTshStep(p.Workspace.Path),
|
||||
|
@ -176,6 +178,24 @@ func updateWindowsSubreposStep(workspace string) step {
|
|||
}
|
||||
}
|
||||
|
||||
func installWindowsRustToolchainStep(workspacePath string) step {
|
||||
return step{
|
||||
Name: "Install Rust Toolchain",
|
||||
Environment: map[string]value{"WORKSPACE_DIR": {raw: workspacePath}},
|
||||
Commands: []string{
|
||||
`$ProgressPreference = 'SilentlyContinue'`,
|
||||
`$ErrorActionPreference = 'Stop'`,
|
||||
`$Workspace = "` + perBuildWorkspace + `"`,
|
||||
`$TeleportSrc = "$Workspace` + teleportSrc + `"`,
|
||||
`. "$TeleportSrc/build.assets/windows/build.ps1"`,
|
||||
`Push-Location "$TeleportSrc/build.assets"`,
|
||||
`$RustVersion = $(make print-rust-version).Trim()`,
|
||||
`Pop-Location`,
|
||||
`Install-Rust -RustVersion $RustVersion -ToolchainDir "$Workspace` + toolchainDir + `"`,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func installWindowsNodeToolchainStep(workspacePath string) step {
|
||||
return step{
|
||||
Name: "Install Node Toolchain",
|
||||
|
|
Loading…
Reference in a new issue