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

Commit 54e57dd

Browse files
committed
Merge branch 'master' of https://github.com/taskcluster/generic-worker into bug1534223
2 parents 56e23d0 + d7f29ed commit 54e57dd

File tree

16 files changed

+106
-31
lines changed

16 files changed

+106
-31
lines changed

.taskcluster.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ tasks:
120120
features:
121121
taskclusterProxy: true
122122
maxRunTime: 3600
123+
env:
124+
# Python 2 is needed for TestDesktopResizeAndMovePointer
125+
# Powershell is needed for TestMounts
126+
# System32 is needed for e.g. cmd.exe, icacls.exe, ...
127+
PATH: C:\Windows\System32;C:\Windows\System32\WindowsPowerShell\v1.0;C:\mozilla-build\python
123128
command:
124129
- set CGO_ENABLED=0
125130
- set GOPATH=%CD%\gopath1.10.8

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ If you prefer not to use a prepackaged binary, or want to have the latest unrele
2626
* Run `go get github.com/taskcluster/livelog`
2727
* Run `go get github.com/taskcluster/taskcluster-proxy`
2828

29+
Run `go get -tags nativeEngine github.com/taskcluster/generic-worker` (all platforms) and/or `go get -tags dockerEngine github.com/taskcluster/generic-worker` (linux only). This should also build binaries for your platform.
30+
31+
Run `./build.sh` to check go version, generate code, build binaries, compile (but not run) tests, perform linting, and ensure there are no ineffective assignments in go code.
32+
33+
`./build.sh` takes optional arguments, `-a` to build all platforms, and `-t` to run tests. By default tests are not run and only the current platform is built.
34+
2935
All being well, the binaries will be built under `${GOPATH}/bin`.
3036

3137
# Acquire taskcluster credentials for running tests
@@ -86,7 +92,7 @@ Once you have been granted the above scope:
8692
To see a full description of all the config options available to you, run `generic-worker --help`:
8793

8894
```
89-
generic-worker 14.1.0
95+
generic-worker 14.1.1
9096
9197
generic-worker is a taskcluster worker that can run on any platform that supports go (golang).
9298
See http://taskcluster.github.io/generic-worker/ for more details. Essentially, the worker is
@@ -340,7 +346,7 @@ and reports back results to the queue.
340346
taskclusterProxyPort Port number for taskcluster-proxy HTTP requests.
341347
[default: 80]
342348
tasksDir The location where task directories should be
343-
created on the worker. [default: /home]
349+
created on the worker. [default: /Users]
344350
workerGroup Typically this would be an aws region - an
345351
identifier to uniquely identify which pool of
346352
workers this worker logically belongs to.
@@ -441,7 +447,7 @@ go test -v ./...
441447
Run the `release.sh` script like so:
442448

443449
```
444-
$ ./release.sh 14.1.0
450+
$ ./release.sh 14.1.1
445451
```
446452

447453
This will perform some checks, tag the repo, push the tag to github, which will then trigger travis-ci to run tests, and publish the new release.
@@ -452,9 +458,17 @@ See [worker_types README.md](https://github.com/taskcluster/generic-worker/blob/
452458

453459
# Release notes
454460

461+
In v14.1.1 since v14.1.0
462+
========================
463+
464+
* [Bug 1548829 - generic-worker: log header should mention provisionerId](https://bugzil.la/1548829)
465+
* [Bug 1551164 - [mounts] Not able to rename dir caches/*** as tasks/task_***/***: rename caches/*** tasks/task_***/***: file exists](https://bugzil.la/1551164)
466+
455467
In v14.1.0 since v14.0.2
456468
========================
457469

470+
__Please don't use release 14.1.0 on macOS/linux due to [bug 1551164](https://bugzil.la/1551164) which will be fixed in v14.1.1.__
471+
458472
* [Bug 1436195 - Add support for live-logs via websocktunnel](https://bugzil.la/1436195) (note that existing livelog support via stateless DNS still works)
459473

460474
To enable websocktunnel, include configuration options `wstAudience` and `wstServerURL` to correspond to the websocktunnel server the worker should use.

main.go

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ var (
5656
logName = "public/logs/live_backing.log"
5757
logPath = filepath.Join("generic-worker", "live_backing.log")
5858

59-
version = "14.1.0"
59+
version = "14.1.1"
6060
revision = "" // this is set during build with `-ldflags "-X main.revision=$(git rev-parse HEAD)"`
6161
)
6262

@@ -431,11 +431,6 @@ func RunWorker() (exitCode ExitCode) {
431431
return INTERNAL_ERROR
432432
}
433433

434-
reboot := PrepareTaskEnvironment()
435-
if reboot {
436-
return REBOOT_REQUIRED
437-
}
438-
439434
// number of tasks resolved since worker first ran
440435
// stored in a json file, since we may reboot between tasks etc
441436
tasksResolved := ReadTasksResolvedFile()
@@ -446,11 +441,7 @@ func RunWorker() (exitCode ExitCode) {
446441
panic(err)
447442
}
448443
}(&tasksResolved)
449-
err = purgeOldTasks()
450-
// errors are not fatal
451-
if err != nil {
452-
log.Printf("WARNING: failed to remove old task directories/users: %v", err)
453-
}
444+
454445
// Queue is the object we will use for accessing queue api
455446
queue = config.Queue()
456447
provisioner = config.AWSProvisioner()
@@ -476,6 +467,17 @@ func RunWorker() (exitCode ExitCode) {
476467
signal.Notify(sigInterrupt, os.Interrupt)
477468
for {
478469

470+
reboot := PrepareTaskEnvironment()
471+
if reboot {
472+
return REBOOT_REQUIRED
473+
}
474+
475+
err = purgeOldTasks()
476+
// errors are not fatal
477+
if err != nil {
478+
log.Printf("WARNING: failed to remove old task directories/users: %v", err)
479+
}
480+
479481
// See https://bugzil.la/1298010 - routinely check if this worker type is
480482
// outdated, and shut down if a new deployment is required.
481483
// Round(0) forces wall time calculation instead of monotonic time in case machine slept etc

mounts_broken_on_docker_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package main
55
import (
66
"encoding/json"
77
"io/ioutil"
8+
"os"
89
"path/filepath"
910
"runtime"
1011
"strconv"
@@ -115,7 +116,12 @@ func TestMounts(t *testing.T) {
115116
payload := GenericWorkerPayload{
116117
Mounts: toMountArray(t, &mounts),
117118
// since this checks that SHA values of files as the task user, is also ensures they are readable by task user
118-
Command: checkSHASums(),
119+
Command: checkSHASums(),
120+
// Don't assume powershell is in the default system PATH, but rather
121+
// require that powershell is in the PATH of the test process.
122+
Env: map[string]string{
123+
"PATH": os.Getenv("PATH"),
124+
},
119125
MaxRunTime: 180,
120126
}
121127

mozilla-try-scripts/gecko-try.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash -exv
1+
#!/bin/bash -e
22

33
######
44
# This script allows you to test a new generic-worker Windows release on
@@ -34,7 +34,7 @@ if [ -z "${NEW_GW_VERSION}" ] || [ -z "${NEW_TP_VERSION}" ]; then
3434
fi
3535

3636
echo "Checking system dependencies..."
37-
for command in curl jq grep sleep file git hg cat sed rm mktemp python go patch basename tr; do
37+
for command in curl jq grep sleep file git hg cat sed rm mktemp python2 go patch basename tr; do
3838
if ! which "${command}" >/dev/null; then
3939
echo -e " \xE2\x9D\x8C ${command}"
4040
echo "${0} requires ${command} to be installed and available in your PATH - please fix and rerun" >&2
@@ -75,7 +75,7 @@ function add_github {
7575
"${THIS_SCRIPT_DIR}/lib/tooltool.py" add --visibility internal "${LOCAL_FILE}"
7676
# Bug 1460178 - sanity check binary downloads of generic-worker before publishing to tooltool...
7777
if ! file "${LOCAL_FILE}" | grep -F "${FILETYPE}" | grep -F 'for MS Windows'; then
78-
echo "Downloaded file doesn't appear to be '${FILETYPE}':" >&2
78+
echo "Downloaded file '${LOCAL_FILE}' (from dir '$(pwd)') doesn't appear to be '${FILETYPE}':" >&2
7979
file "${LOCAL_FILE}" >&2
8080
exit 69
8181
fi
@@ -102,7 +102,7 @@ cat manifest.tt
102102

103103
git clone [email protected]:mozilla-releng/OpenCloudConfig.git
104104
cd OpenCloudConfig/userdata/Manifest
105-
for MANIFEST in *-b.json *-cu.json *-beta.json; do
105+
for MANIFEST in gecko-t-win10-64-gpu-b gecko-t-win7-32-gpu-b gecko-t-win10-64-cu gecko-t-win7-32-cu gecko-1-b-win2012-beta gecko-t-win10-64-beta gecko-t-win7-32-beta; do
106106
cat "${MANIFEST}" > "${MANIFEST}.bak"
107107
cat "${MANIFEST}.bak" \
108108
| sed "s_\\(generic-worker/releases/download/v\\)[^/]*\\(/generic-worker-nativeEngine-windows-\\)_\\1${NEW_GW_VERSION}\\2_" | sed "s_\\(\"generic-worker \\)[^ ]*\\(.*\\)\$_\\1${NEW_GW_VERSION}\\2_" \
@@ -111,7 +111,7 @@ for MANIFEST in *-b.json *-cu.json *-beta.json; do
111111
cat "${MANIFEST}" > "${MANIFEST}.bak"
112112
THIS_ARCH="$(cat "${MANIFEST}" | sed -n 's/.*\/generic-worker-nativeEngine-windows-\(.*\)\.exe.*/\1/p' | sort -u)"
113113
if [ "${THIS_ARCH}" != "386" ] && [ "${THIS_ARCH}" != "amd64" ]; then
114-
echo "NOOOOOOO - cannot recognise ARCH '${THIS_ARCH}'" >&2
114+
echo "NOOOOOOO - cannot recognise ARCH '${THIS_ARCH}' of generic-worker binary in manifest '${MANIFEST}' (from dir '$(pwd)')" >&2
115115
exit 67
116116
fi
117117
updateSHA512 "generic-worker-nativeEngine-windows-${THIS_ARCH}.exe" "GenericWorkerDownload"
@@ -130,7 +130,7 @@ This change does _not_ affect any production workers. Commit made with:
130130
131131
${0} $(echo ${@})
132132
133-
See https://github.com/taskcluster/generic-worker/blob/$THIS_REV/$THIS_FILE -m \"${DEPLOY}\""
133+
See https://github.com/taskcluster/generic-worker/blob/$THIS_REV/$THIS_FILE" -m "${DEPLOY}"
134134
OCC_COMMIT="$(git rev-parse HEAD)"
135135
git push
136136

mozilla-try-scripts/lib/tooltool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python2
22

33
# tooltool is a lookaside cache implemented in Python
44
# Copyright (C) 2011 John H. Ford <[email protected]>

plat_all-unix-style_test.go

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22

33
package main
44

5-
import "testing"
5+
import (
6+
"fmt"
7+
"log"
8+
"os"
9+
"path/filepath"
10+
"testing"
11+
)
612

713
func TestSeparateTaskUsersNotSupported(t *testing.T) {
814
defer setup(t)()
@@ -12,3 +18,39 @@ func TestSeparateTaskUsersNotSupported(t *testing.T) {
1218
t.Fatalf("Got exit code %v but was expecting exit code %v", exitCode, INVALID_CONFIG)
1319
}
1420
}
21+
22+
func TestNewTaskDirectoryForEachTask(t *testing.T) {
23+
defer setup(t)()
24+
config.NumberOfTasksToRun = 3
25+
payload := GenericWorkerPayload{
26+
Command: returnExitCode(0),
27+
MaxRunTime: 10,
28+
}
29+
td := testTask(t)
30+
for i := uint(0); i < config.NumberOfTasksToRun; i++ {
31+
_ = scheduleTask(t, td, payload)
32+
}
33+
34+
execute(t, TASKS_COMPLETE)
35+
36+
// scan task directories, to make sure there are three unique backing log files,
37+
// implying that each task ran in its own directory
38+
39+
var backingLogsFound uint = 0
40+
err := filepath.Walk(config.TasksDir, func(path string, info os.FileInfo, err error) error {
41+
if info.IsDir() {
42+
return nil
43+
}
44+
if info.Name() != "live_backing.log" {
45+
return fmt.Errorf("Discovered file %q but was expecting %q", info.Name(), "live_backing.log")
46+
}
47+
backingLogsFound++
48+
return nil
49+
})
50+
if err != nil {
51+
log.Fatal(err)
52+
}
53+
if backingLogsFound != config.NumberOfTasksToRun {
54+
log.Fatalf("Expected to find %v backing logs, but found %v", config.NumberOfTasksToRun, backingLogsFound)
55+
}
56+
}

plat_windows_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package main
22

33
import (
4+
"os"
45
"testing"
56
)
67

@@ -101,6 +102,11 @@ func TestDesktopResizeAndMovePointer(t *testing.T) {
101102
payload := GenericWorkerPayload{
102103
Command: commands,
103104
MaxRunTime: 90,
105+
// Don't assume python 2 is in the default system PATH, but rather
106+
// require that python 2 is in the PATH of the test process.
107+
Env: map[string]string{
108+
"PATH": os.Getenv("PATH"),
109+
},
104110
}
105111
td := testTask(t)
106112

worker_types/deepspeech-win-gpu-b/userdata

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Expand-ZIPFile -File "C:\nssm-2.24.zip" -Destination "C:\" -Url "http://www.nssm
8484

8585
# download generic-worker
8686
md C:\generic-worker
87-
$client.DownloadFile("https://github.com/taskcluster/generic-worker/releases/download/v14.1.0/generic-worker-nativeEngine-windows-amd64.exe", "C:\generic-worker\generic-worker.exe")
87+
$client.DownloadFile("https://github.com/taskcluster/generic-worker/releases/download/v14.1.1/generic-worker-nativeEngine-windows-amd64.exe", "C:\generic-worker\generic-worker.exe")
8888

8989
# download livelog
9090
$client.DownloadFile("https://github.com/taskcluster/livelog/releases/download/v1.1.0/livelog-windows-amd64.exe", "C:\generic-worker\livelog.exe")

worker_types/deepspeech-win-gpu/userdata

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Expand-ZIPFile -File "C:\nssm-2.24.zip" -Destination "C:\" -Url "http://www.nssm
130130

131131
# download generic-worker
132132
md C:\generic-worker
133-
$client.DownloadFile("https://github.com/taskcluster/generic-worker/releases/download/v14.1.0/generic-worker-nativeEngine-windows-amd64.exe", "C:\generic-worker\generic-worker.exe")
133+
$client.DownloadFile("https://github.com/taskcluster/generic-worker/releases/download/v14.1.1/generic-worker-nativeEngine-windows-amd64.exe", "C:\generic-worker\generic-worker.exe")
134134

135135
# download livelog
136136
$client.DownloadFile("https://github.com/taskcluster/livelog/releases/download/v1.1.0/livelog-windows-amd64.exe", "C:\generic-worker\livelog.exe")

0 commit comments

Comments
 (0)