Skip to content

Commit

Permalink
Merge pull request #1491 from buildpacks/windows-wcow
Browse files Browse the repository at this point in the history
Updates windows-wcow runner to be GitHub-hosted vs self-hosted
  • Loading branch information
jromero authored Jul 29, 2022
2 parents 7ff6918 + de39959 commit ab92e10
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 11 deletions.
32 changes: 31 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
pack_bin: pack.exe
- config: windows-wcow
os: windows
runner: [self-hosted, windows, wcow]
runner: [windows-2019]
no_docker: "false"
pack_bin: pack.exe
runs-on: ${{ matrix.runner }}
Expand Down Expand Up @@ -89,6 +89,36 @@ jobs:
shell: powershell
- name: Verify
run: make verify
- name: Register runner IP
if: matrix.config == 'windows-wcow'
shell: powershell
run: |
# Get IP from default gateway interface
$IPAddress=(Get-NetIPAddress -InterfaceAlias ((Get-NetRoute "0.0.0.0/0").InterfaceAlias) -AddressFamily IPv4)[0].IPAddress
# Allow container-to-host registry traffic (from public interface, to the same interface)
New-NetfirewallRule -DisplayName test-registry -LocalAddress $IPAddress -RemoteAddress $IPAddress
# create or update daemon config to allow host as insecure-registry
$config=@{}
if (Test-Path C:\ProgramData\docker\config\daemon.json) {
$config=(Get-Content C:\ProgramData\docker\config\daemon.json | ConvertFrom-json)
}
$config."insecure-registries" = @("$IPAddress/32")
ConvertTo-json $config | Out-File -Encoding ASCII C:\ProgramData\docker\config\daemon.json
Restart-Service docker
# dump docker info for auditing
docker version
docker info
# Modify etc\hosts to include runner IP
$IPAddress=(Get-NetIPAddress -InterfaceAlias ((Get-NetRoute "0.0.0.0/0").InterfaceAlias) -AddressFamily IPv4)[0].IPAddress
"# Modified by CNB: https://github.com/buildpacks/ci/tree/main/gh-runners/windows
${IPAddress} host.docker.internal
${IPAddress} gateway.docker.internal
" | Out-File -Filepath C:\Windows\System32\drivers\etc\hosts -Encoding utf8
- name: Test
env:
TEST_COVERAGE: 1
Expand Down
10 changes: 1 addition & 9 deletions internal/sshdialer/ssh_dialer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -920,17 +920,9 @@ func (b badAgent) Signers() ([]ssh.Signer, error) {
func withFixedUpSSHCLI(t *testing.T) func() {
t.Helper()

which := "which"
if runtime.GOOS == "windows" {
which = "where"
}

out, err := exec.Command(which, "ssh").CombinedOutput()
sshAbsPath, err := exec.LookPath("ssh")
th.AssertNil(t, err)

sshAbsPath := string(out)
sshAbsPath = strings.Trim(sshAbsPath, "\r\n")

sshScript := `#!/bin/sh
SSH_BIN -o PasswordAuthentication=no -o ConnectTimeout=3 -o UserKnownHostsFile="$HOME/.ssh/known_hosts" $@
`
Expand Down
2 changes: 1 addition & 1 deletion internal/sshdialer/windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func fixupPrivateKeyMod(path string) {
err = acl.Apply(path,
true,
false,
acl.GrantName(((mode&0700)<<23)|((mode&0200)<<9), usr.Name))
acl.GrantName(((mode&0700)<<23)|((mode&0200)<<9), usr.Username))

// See https://github.com/hectane/go-acl/issues/1
if err != nil && err.Error() != "The operation completed successfully." {
Expand Down

0 comments on commit ab92e10

Please sign in to comment.