Skip to content
This repository was archived by the owner on Feb 20, 2020. It is now read-only.

Commit 012d1ce

Browse files
committed
Merge branch 'master' of https://github.com/taskcluster/generic-worker into no-more-nssm-merge-20190619
Resolved merge conflict: multiuser_windows.go
2 parents cb0e792 + 1981ee2 commit 012d1ce

30 files changed

Lines changed: 1299 additions & 152 deletions

.taskcluster.yml

Lines changed: 85 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ tasks:
7171
- C:\generic-worker\generic-worker-test-creds.cmd
7272
- copy "%TASK_USER_CREDENTIALS%" "%CD%\next-task-user.json"
7373
- 'go test -tags multiuser -timeout 45m -ldflags "-X github.com/taskcluster/generic-worker.revision=%revision%" -v -race ./...'
74-
- set GW_TESTS_RUN_AS_TASK_USER=true
74+
- set GW_TESTS_RUN_AS_CURRENT_USER=true
7575
- 'go test -tags multiuser -timeout 45m -ldflags "-X github.com/taskcluster/generic-worker.revision=%revision%" -v -race'
7676
- ineffassign .
7777
artifacts:
@@ -148,8 +148,10 @@ tasks:
148148
- set GORACE=history_size=7
149149
- C:\generic-worker\generic-worker-test-creds.cmd
150150
- copy "%TASK_USER_CREDENTIALS%" "%CD%\next-task-user.json"
151+
# This env var is not set on Windows Server 2012 R2 CI tasks; we must set here since this worker type runs tasks from Z: drive
152+
- set GW_SKIP_Z_DRIVE_TESTS=true
151153
- 'go test -tags multiuser -timeout 45m -ldflags "-X github.com/taskcluster/generic-worker.revision=%revision%" -v ./...'
152-
- set GW_TESTS_RUN_AS_TASK_USER=true
154+
- set GW_TESTS_RUN_AS_CURRENT_USER=true
153155
- 'go test -tags multiuser -timeout 45m -ldflags "-X github.com/taskcluster/generic-worker.revision=%revision%" -v'
154156
- ineffassign .
155157
artifacts:
@@ -232,8 +234,10 @@ tasks:
232234
- set GORACE=history_size=7
233235
- C:\generic-worker\generic-worker-test-creds.cmd
234236
- copy "%TASK_USER_CREDENTIALS%" "%CD%\next-task-user.json"
237+
# This env var is not set on Windows Server 2012 R2 CI tasks; we must set here since this worker type runs tasks from Z: drive
238+
- set GW_SKIP_Z_DRIVE_TESTS=true
235239
- 'go test -tags multiuser -timeout 45m -ldflags "-X github.com/taskcluster/generic-worker.revision=%revision%" -v -race ./...'
236-
- set GW_TESTS_RUN_AS_TASK_USER=true
240+
- set GW_TESTS_RUN_AS_CURRENT_USER=true
237241
- 'go test -tags multiuser -timeout 45m -ldflags "-X github.com/taskcluster/generic-worker.revision=%revision%" -v -race'
238242
- ineffassign .
239243
artifacts:
@@ -308,7 +312,7 @@ tasks:
308312
go install -tags simple -v -ldflags "-X main.revision=$(git rev-parse HEAD)" ./...
309313
# output of wc command can contain spaces on darwin, so no quotes around expression
310314
test $(git status --porcelain | wc -l) == 0
311-
GORACE=history_size=7 CGO_ENABLED=1 go test -tags simple -timeout 45m -ldflags "-X github.com/taskcluster/generic-worker.revision=$(git rev-parse HEAD)" -race -v ./...
315+
GORACE=history_size=7 CGO_ENABLED=1 go test -tags simple -timeout 45m -ldflags "-X github.com/taskcluster/generic-worker.revision=$(git rev-parse HEAD)" -v -race ./...
312316
ineffassign .
313317
artifacts:
314318
- name: public/build/generic-worker-darwin-amd64
@@ -378,8 +382,8 @@ tasks:
378382
# output of wc command can contain spaces on darwin, so no quotes around expression
379383
test $(git status --porcelain | wc -l) == 0
380384
cp "${TASK_USER_CREDENTIALS}" next-task-user.json
381-
GORACE=history_size=7 CGO_ENABLED=1 go test -tags multiuser -timeout 45m -ldflags "-X github.com/taskcluster/generic-worker.revision=$(git rev-parse HEAD)" -race -v ./...
382-
GW_TESTS_RUN_AS_TASK_USER=true GORACE=history_size=7 CGO_ENABLED=1 go test -tags multiuser -timeout 45m -ldflags "-X github.com/taskcluster/generic-worker.revision=$(git rev-parse HEAD)" -race -v
385+
GW_TESTS_RUN_AS_CURRENT_USER=true GORACE=history_size=7 CGO_ENABLED=1 go test -tags multiuser -timeout 45m -ldflags "-X github.com/taskcluster/generic-worker.revision=$(git rev-parse HEAD)" -v -race
386+
GORACE=history_size=7 CGO_ENABLED=1 go test -tags multiuser -timeout 45m -ldflags "-X github.com/taskcluster/generic-worker.revision=$(git rev-parse HEAD)" -v -race ./...
383387
ineffassign .
384388
artifacts:
385389
- name: public/build/generic-worker-darwin-amd64
@@ -469,6 +473,79 @@ tasks:
469473
# format: tar.gz
470474

471475

476+
##########################################################
477+
############## Linux amd64 Multiuser Build ###############
478+
##########################################################
479+
480+
- provisionerId: pmoore-manual
481+
workerType: linux-amd64
482+
metadata:
483+
name: "Build/test 64 bit generic-worker (multiuser engine) on Ubuntu 17.04 VM"
484+
description: "This builds the 64 bit linux version of generic-worker (multiuser engine)"
485+
owner: "{{ event.head.user.email }}" # the user who sent the pr/push e-mail will be inserted here
486+
source: "{{ event.head.repo.url }}" # the repo where the pr came from will be inserted here
487+
extra:
488+
github:
489+
# Events that will trigger this task
490+
events:
491+
- pull_request.opened
492+
- pull_request.synchronize
493+
- push
494+
scopes:
495+
- generic-worker:cache:generic-worker-checkout
496+
- secrets:get:repo:github.com/taskcluster/generic-worker
497+
payload:
498+
features:
499+
taskclusterProxy:
500+
true
501+
maxRunTime: 3600
502+
command:
503+
- - /bin/bash
504+
- -vxec
505+
- |
506+
export CGO_ENABLED=0
507+
export GOROOT="$(pwd)/go1.10.8/go"
508+
export GOPATH="$(pwd)/gopath1.10.8"
509+
export PATH="${GOPATH}/bin:${GOROOT}/bin:${PATH}"
510+
go version
511+
go env
512+
curl -s "${TASKCLUSTER_PROXY_URL}/secrets/v1/secret/repo:github.com/taskcluster/generic-worker" | sed -n 's/.*"b64_encoded_credentials_script": "\(.*\)".*/\1/p' | base64 -d > ~/env_private.sh
513+
source ~/env_private.sh
514+
mkdir -p "${GOPATH}/src/github.com/taskcluster"
515+
cd "${GOPATH}/src/github.com/taskcluster"
516+
if [ ! -d generic-worker/.git ]; then rm -rf generic-worker; git clone '{{ event.head.repo.url }}' 'generic-worker'; fi
517+
cd 'generic-worker'
518+
git fetch '{{ event.head.repo.url }}' "+{{ event.head.ref }}:refs/heads/X${TASK_ID}"
519+
git checkout -f "X${TASK_ID}"
520+
git reset --hard '{{ event.head.sha }}'
521+
git clean -fdx
522+
git checkout -B tmp -t "X${TASK_ID}"
523+
go get -v -u github.com/taskcluster/livelog github.com/taskcluster/taskcluster-proxy github.com/gordonklaus/ineffassign
524+
cd gw-codegen
525+
go get -v
526+
cd ..
527+
go generate
528+
go install -tags multiuser -v -ldflags "-X main.revision=$(git rev-parse HEAD)" ./...
529+
test "$(git status --porcelain | wc -l)" == 0
530+
# These lines should be enabled in bug 1499054:
531+
# GORACE=history_size=7 CGO_ENABLED=1 go test -tags multiuser -timeout 45m -ldflags "-X github.com/taskcluster/generic-worker.revision=$(git rev-parse HEAD)" -v -race ./...
532+
# GW_TESTS_RUN_AS_CURRENT_USER=true GORACE=history_size=7 CGO_ENABLED=1 go test -tags multiuser -timeout 45m -ldflags "-X github.com/taskcluster/generic-worker.revision=$(git rev-parse HEAD)" -race -v
533+
"${GOPATH}/bin/ineffassign" .
534+
artifacts:
535+
- name: public/build/generic-worker-linux-amd64
536+
path: gopath1.10.8/bin/generic-worker
537+
expires: "{{ '2 weeks' | $fromNow }}"
538+
type: file
539+
mounts:
540+
- cacheName: generic-worker-checkout
541+
directory: gopath1.10.8/src
542+
- content:
543+
url: https://storage.googleapis.com/golang/go1.10.8.linux-amd64.tar.gz
544+
sha256: d8626fb6f9a3ab397d88c483b576be41fa81eefcec2fd18562c87626dbb3c39e
545+
directory: go1.10.8
546+
format: tar.gz
547+
548+
472549
##########################################################
473550
################ Linux amd64 Simple Build ################
474551
##########################################################
@@ -505,7 +582,7 @@ tasks:
505582
export PATH="${GOPATH}/bin:${GOROOT}/bin:${PATH}"
506583
go version
507584
go env
508-
curl -s "${TASKCLUSTER_PROXY_URL}/secrets/v1/secret/repo:github.com/taskcluster/generic-worker" | sed -n 's/.*"b64_encoded_credentials_script": "\(.*\)".*/\1/p' | base64 -d > ~/env_private.sh
585+
wget -q -O- "${TASKCLUSTER_PROXY_URL}/secrets/v1/secret/repo:github.com/taskcluster/generic-worker" | sed -n 's/.*"b64_encoded_credentials_script": "\(.*\)".*/\1/p' | base64 -d > ~/env_private.sh
509586
source ~/env_private.sh
510587
mkdir -p "${GOPATH}/src/github.com/taskcluster"
511588
cd "${GOPATH}/src/github.com/taskcluster"
@@ -576,7 +653,7 @@ tasks:
576653
export PATH="${GOPATH}/bin:${GOROOT}/bin:${PATH}"
577654
go version
578655
go env
579-
curl -s "${TASKCLUSTER_PROXY_URL}/secrets/v1/secret/repo:github.com/taskcluster/generic-worker" | sed -n 's/.*"b64_encoded_credentials_script": "\(.*\)".*/\1/p' | base64 -d > ~/env_private.sh
656+
wget -q -O- "${TASKCLUSTER_PROXY_URL}/secrets/v1/secret/repo:github.com/taskcluster/generic-worker" | sed -n 's/.*"b64_encoded_credentials_script": "\(.*\)".*/\1/p' | base64 -d > ~/env_private.sh
580657
source ~/env_private.sh
581658
mkdir -p "${GOPATH}/src/github.com/taskcluster"
582659
cd "${GOPATH}/src/github.com/taskcluster"

.travis.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@ go:
33
- "1.10.8"
44

55
env:
6-
- "CGO_ENABLED=0 GIMME_OS=linux GIMME_ARCH=amd64 engine=docker"
7-
- "CGO_ENABLED=0 GIMME_OS=linux GIMME_ARCH=386 engine=simple"
8-
- "CGO_ENABLED=0 GIMME_OS=linux GIMME_ARCH=amd64 engine=simple"
9-
- "CGO_ENABLED=0 GIMME_OS=linux GIMME_ARCH=arm engine=simple"
10-
# currently broken
11-
# "CGO_ENABLED=0 GIMME_OS=linux GIMME_ARCH=arm64 engine=simple"
6+
- "CGO_ENABLED=0 GIMME_OS=linux GIMME_ARCH=amd64 engine=docker"
7+
- "CGO_ENABLED=0 GIMME_OS=linux GIMME_ARCH=amd64 engine=simple"
8+
- "CGO_ENABLED=0 GIMME_OS=linux GIMME_ARCH=386 engine=simple"
9+
- "CGO_ENABLED=0 GIMME_OS=linux GIMME_ARCH=arm engine=simple"
1210
- "CGO_ENABLED=0 GIMME_OS=darwin GIMME_ARCH=amd64 engine=simple"
1311
- "CGO_ENABLED=0 GIMME_OS=darwin GIMME_ARCH=amd64 engine=multiuser"
1412
- "CGO_ENABLED=0 GIMME_OS=windows GIMME_ARCH=amd64 engine=multiuser"
1513
- "CGO_ENABLED=0 GIMME_OS=windows GIMME_ARCH=386 engine=multiuser"
14+
# This should be enabled in bug 1499054:
15+
# - "CGO_ENABLED=0 GIMME_OS=linux GIMME_ARCH=amd64 engine=multiuser"
16+
#
17+
# Currently broken:
18+
# - "CGO_ENABLED=0 GIMME_OS=linux GIMME_ARCH=arm64 engine=simple"
1619

1720
install:
1821
- "test $GIMME_OS.$GIMME_ARCH != linux.amd64 || go get github.com/mattn/goveralls github.com/taskcluster/taskcluster-proxy github.com/taskcluster/livelog github.com/gordonklaus/ineffassign"

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,7 @@ and reports back results to the queue.
549549
posses this scope, no crash reports will be sent.
550550
Similarly, if this property is not specified or
551551
is the empty string, no reports will be sent.
552+
[default: generic-worker]
552553
shutdownMachineOnIdle If true, when the worker is deemed to have been
553554
idle for enough time (see idleTimeoutSecs) the
554555
worker will issue an OS shutdown command. If false,
@@ -665,6 +666,50 @@ Then cd into the source directory, and run:
665666
go test -v ./...
666667
```
667668
669+
There are a few environment variables that you can set to influence the tests:
670+
671+
### `GW_SKIP_INTEGRATION_TESTS`
672+
673+
Set to a non-empty string if you wish to skip all tests that submit tasks to a
674+
real taskcluster Queue service.
675+
676+
Otherwise you'll need to configure the taskcluster credentials for talking to
677+
the taskcluster Queue service:
678+
679+
* `TASKCLUSTER_CLIENT_ID`
680+
* `TASKCLUSTER_ACCESS_TOKEN`
681+
* `TASKCLUSTER_ROOT_URL`
682+
* `TASKCLUSTER_CERTIFICATE` (only if using temp credentials)
683+
684+
### `GW_SKIP_PERMA_CREDS_TESTS`
685+
686+
Set to a non-empty string if you wish to skip tests that require permanent
687+
taskcluster credentials (e.g. if you only have temp credentials, and don't feel
688+
like creating a permanent client, or don't have the scopes to do so).
689+
690+
### `GW_SKIP_Z_DRIVE_TESTS`
691+
692+
Only used in a single __Windows-specific__ test - if you don't have a Z: drive
693+
setup on your computer, or you do but you also run tests from the Z: drive, you
694+
can set this env var to a non-empty string to skip this test.
695+
696+
### `GW_TESTS_RUN_AS_CURRENT_USER`
697+
698+
This environment variable applies only to the __multiuser__ engine.
699+
700+
If `GW_TESTS_RUN_AS_CURRENT_USER` is not set, generic-worker will be tested
701+
running in its normal operational mode, i.e. running tasks as task users
702+
(config setting `runTasksAsCurrentUser` will be `false`).
703+
704+
If `GW_TESTS_RUN_AS_CURRENT_USER` is a non-empty string, generic-worker will be
705+
tested running tasks as the same user that runs `go test` (config setting
706+
`runTasksAsCurrentUser` will be `true`). This is how the CI multiuser workers
707+
are configured, in order that the generic-worker under test has the required
708+
privileges to function correctly. Set this environment variable to ensure that
709+
the generic-worker under test will function correctly as a generic-worker CI
710+
worker.
711+
```
712+
668713
# Making a new generic worker release
669714

670715
Run the `release.sh` script like so:

artifacts.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ func (task *TaskRun) uploadArtifact(artifact TaskArtifact) *CommandExecutionErro
439439
switch rootCause := t.RootCause.(type) {
440440
case httpbackoff.BadHttpResponseCode:
441441
if rootCause.HttpResponseCode/100 == 5 {
442-
return ResourceUnavailable(fmt.Errorf("TASK EXCEPTION due to response code %v from Queue when uploading artifact %#v with CreateArtifact payload %v", rootCause.HttpResponseCode, artifact, string(payload)))
442+
return ResourceUnavailable(fmt.Errorf("TASK EXCEPTION due to response code %v from Queue when uploading artifact %#v with CreateArtifact payload %v - HTTP response body: %v", rootCause.HttpResponseCode, artifact, string(payload), t.CallSummary.HTTPResponseBody))
443443
}
444444
// was artifact already uploaded ( => malformed payload)?
445445
if rootCause.HttpResponseCode == 409 {
@@ -461,7 +461,7 @@ func (task *TaskRun) uploadArtifact(artifact TaskArtifact) *CommandExecutionErro
461461
return nil
462462
}
463463
// assume a problem with the request == worker bug
464-
panic(fmt.Errorf("WORKER EXCEPTION due to response code %v from Queue when uploading artifact %#v with CreateArtifact payload %v", rootCause.HttpResponseCode, artifact, string(payload)))
464+
panic(fmt.Errorf("WORKER EXCEPTION due to response code %v from Queue when uploading artifact %#v with CreateArtifact payload %v - HTTP response body: %v", rootCause.HttpResponseCode, artifact, string(payload), t.CallSummary.HTTPResponseBody))
465465
case *url.Error:
466466
switch subCause := rootCause.Err.(type) {
467467
case *net.OpError:

build.sh

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,26 +59,23 @@ function install {
5959
}
6060

6161
if ${ALL_PLATFORMS}; then
62-
install docker linux amd64
63-
6462
install multiuser windows amd64
6563
install multiuser windows 386
6664

67-
install multiuser darwin amd64
68-
install multiuser darwin 386
69-
70-
install simple darwin amd64
71-
install simple darwin 386
65+
install multiuser darwin amd64
66+
install simple darwin amd64
7267

73-
install simple linux amd64
74-
install simple linux 386
75-
install simple linux arm
76-
install simple linux arm64
68+
install multiuser linux amd64
69+
install docker linux amd64
70+
install simple linux amd64
71+
install simple linux arm
72+
install simple linux arm64
7773
else
7874
MY_GOHOSTOS="$(go env GOHOSTOS)"
7975
MY_GOHOSTARCH="$(go env GOHOSTARCH)"
8076
case "${MY_GOHOSTOS}" in
8177
linux) install simple "${MY_GOHOSTOS}" "${MY_GOHOSTARCH}"
78+
install multiuser "${MY_GOHOSTOS}" "${MY_GOHOSTARCH}"
8279
install docker "${MY_GOHOSTOS}" "${MY_GOHOSTARCH}"
8380
;;
8481
darwin) install simple "${MY_GOHOSTOS}" "${MY_GOHOSTARCH}"
@@ -95,8 +92,9 @@ CGO_ENABLED=0 go get github.com/taskcluster/livelog
9592

9693
if $TEST; then
9794
go get github.com/taskcluster/taskcluster-proxy
98-
CGO_ENABLED=1 GORACE="history_size=7" /usr/bin/sudo "GW_TESTS_RUN_AS_TASK_USER=true" "TASKCLUSTER_CERTIFICATE=$TASKCLUSTER_CERTIFICATE" "TASKCLUSTER_ACCESS_TOKEN=$TASKCLUSTER_ACCESS_TOKEN" "TASKCLUSTER_CLIENT_ID=$TASKCLUSTER_CLIENT_ID" "TASKCLUSTER_ROOT_URL=$TASKCLUSTER_ROOT_URL" go test -v -tags multiuser -ldflags "-X github.com/taskcluster/generic-worker.revision=$(git rev-parse HEAD)" -race -timeout 1h ./...
99-
if [ "$(go env GOHOSTOS)" == "linux" ]; then
95+
CGO_ENABLED=1 GORACE="history_size=7" /usr/bin/sudo "GW_TESTS_RUN_AS_CURRENT_USER=" "TASKCLUSTER_CERTIFICATE=$TASKCLUSTER_CERTIFICATE" "TASKCLUSTER_ACCESS_TOKEN=$TASKCLUSTER_ACCESS_TOKEN" "TASKCLUSTER_CLIENT_ID=$TASKCLUSTER_CLIENT_ID" "TASKCLUSTER_ROOT_URL=$TASKCLUSTER_ROOT_URL" go test -v -tags multiuser -ldflags "-X github.com/taskcluster/generic-worker.revision=$(git rev-parse HEAD)" -race -timeout 1h ./...
96+
MYGOHOSTOS="$(go env GOHOSTOS)"
97+
if [ "${MYGOHOSTOS}" == "linux" ] || [ "${MYGOHOSTOS}" == "darwin" ]; then
10098
CGO_ENABLED=1 GORACE="history_size=7" go test -v -tags docker -ldflags "-X github.com/taskcluster/generic-worker.revision=$(git rev-parse HEAD)" -race -timeout 1h ./...
10199
fi
102100
fi

chain_of_trust.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ package main
44

55
import (
66
"encoding/json"
7+
"errors"
8+
"fmt"
79
"io/ioutil"
10+
"log"
811
"path/filepath"
912

1013
"golang.org/x/crypto/ed25519"
@@ -191,3 +194,16 @@ func (feature *ChainOfTrustTaskFeature) Stop(err *ExecutionErrors) {
191194
},
192195
))
193196
}
197+
198+
func (cot *ChainOfTrustTaskFeature) ensureTaskUserCantReadPrivateCotKey() error {
199+
c, err := cot.catCotKeyCommand()
200+
if err != nil {
201+
panic(fmt.Errorf("SERIOUS BUG: Could not create command (not even trying to execute it yet) to cat private chain of trust key %v - %v", config.Ed25519SigningKeyLocation, err))
202+
}
203+
r := c.Execute()
204+
if !r.Failed() {
205+
log.Print(r.String())
206+
return errors.New(ChainOfTrustKeyNotSecureMessage)
207+
}
208+
return nil
209+
}

chain_of_trust_posix.go

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,9 @@
33
package main
44

55
import (
6-
"fmt"
7-
"log"
8-
96
"github.com/taskcluster/generic-worker/process"
107
)
118

12-
func (cot *ChainOfTrustTaskFeature) ensureTaskUserCantReadPrivateCotKey() error {
13-
signingKeyPaths := [2]string{
14-
config.Ed25519SigningKeyLocation,
15-
}
16-
for _, path := range signingKeyPaths {
17-
c, err := process.NewCommand([]string{"/bin/cat", path}, cwd, cot.task.EnvVars(), taskContext.pd)
18-
if err != nil {
19-
panic(fmt.Errorf("SERIOUS BUG: Could not create command (not even trying to execute it yet) to cat private chain of trust key %v - %v", path, err))
20-
}
21-
r := c.Execute()
22-
if !r.Failed() {
23-
log.Print(r.String())
24-
return fmt.Errorf(ChainOfTrustKeyNotSecureMessage)
25-
}
26-
}
27-
return nil
9+
func (cot *ChainOfTrustTaskFeature) catCotKeyCommand() (*process.Command, error) {
10+
return process.NewCommand([]string{"/bin/cat", config.Ed25519SigningKeyLocation}, cwd, cot.task.EnvVars(), taskContext.pd)
2811
}

chain_of_trust_windows.go

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,9 @@
11
package main
22

33
import (
4-
"fmt"
5-
"log"
6-
74
"github.com/taskcluster/generic-worker/process"
85
)
96

10-
func (cot *ChainOfTrustTaskFeature) ensureTaskUserCantReadPrivateCotKey() error {
11-
signingKeyPaths := [2]string{
12-
config.Ed25519SigningKeyLocation,
13-
}
14-
for _, path := range signingKeyPaths {
15-
c, err := process.NewCommand([]string{"cmd.exe", "/c", "type", path}, cwd, nil, taskContext.pd)
16-
if err != nil {
17-
panic(fmt.Errorf("SERIOUS BUG: Could not create command (not even trying to execute it yet) to cat private chain of trust key %v - %v", path, err))
18-
}
19-
r := c.Execute()
20-
if !r.Failed() {
21-
log.Print(r.String())
22-
return fmt.Errorf(ChainOfTrustKeyNotSecureMessage)
23-
}
24-
}
25-
return nil
7+
func (cot *ChainOfTrustTaskFeature) catCotKeyCommand() (*process.Command, error) {
8+
return process.NewCommand([]string{"cmd.exe", "/c", "type", config.Ed25519SigningKeyLocation}, cwd, nil, taskContext.pd)
269
}

0 commit comments

Comments
 (0)