Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalie committed May 23, 2023
1 parent c7df18b commit b840303
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 13 deletions.
32 changes: 28 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ go: 1.17.x

dist: xenial

git:
depth: 10

# Build master and PRs which merge into those branches
# We don't automatically build other branches when they're pushed; create a PR to cause the CI to run.
branches:
only:
- master

cache:
directories:
- vendor
Expand All @@ -26,25 +35,33 @@ env:
- REDIS_URL="redis://"

stages:
- test
- name: test
if: (type = push OR type = pull_request) AND branch = master

before_cache:
- make clean

jobs:
include:
- stage: test
name: linux
go: 1.17.x
name: lint

script:
- make deps
- make lintall

- stage: test
name: linux

script:
- make deps
- GO111MODULE=on make build
- mkdir -p build/linux/amd64
- cp ${GOPATH%%:*}/bin/travis-worker build/linux/amd64
- make test-no-cover
- make test-cover
- make smoke

addons:
apt:
packages:
Expand All @@ -56,11 +73,13 @@ jobs:
- travis-ci/worker/$TRAVIS_BUILD_NUMBER/$TRAVIS_JOB_NUMBER
- travis-ci/worker/$(git describe --always --dirty --tags)
- travis-ci/worker/$TRAVIS_BRANCH

- stage: test
name: crossbuild
go: 1.17.x

script:
- GO111MODULE=on make build/darwin/amd64/travis-worker

addons:
artifacts:
paths:
Expand All @@ -69,9 +88,11 @@ jobs:
- travis-ci/worker/$TRAVIS_BUILD_NUMBER/$TRAVIS_JOB_NUMBER
- travis-ci/worker/$(git describe --always --dirty --tags)
- travis-ci/worker/$TRAVIS_BRANCH

- stage: test
name: docker
if: type != 'pull_request' && env(VAULT_PASS) is present && env(VAULT_USERNAME) is present

script:
- vault login -method=userpass username=$VAULT_USERNAME password=$VAULT_PASS
- vault kv get -field=secret gcp/gcr-sa-key > /tmp/gcr_key.json;
Expand All @@ -80,6 +101,7 @@ jobs:
- gcloud auth configure-docker
- make docker-build
- make docker-push

addons:
snaps:
- name: google-cloud-sdk
Expand All @@ -89,8 +111,10 @@ jobs:
update: true
packages:
- docker-ce

- stage: test
name: http-job-test

script:
- GO111MODULE=on make build
- mkdir -p build/linux/amd64
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ deps: .ensure-shfmt .ensure-golangci-lint .deps-fetched

.PHONY: .ensure-golangci-lint
.ensure-golangci-lint:
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(HOME)/bin v1.23.6
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(HOME)/bin
if ! command -v $(go env GOPATH)/bin/golangci-lint &>/dev/null; then \
$(HOME)/bin/golangci-lint --version; \
fi
Expand Down
6 changes: 3 additions & 3 deletions backend/gce.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ var (
"UPLOAD_RETRY_SLEEP": fmt.Sprintf("sleep interval between script upload attempts (default %v)", defaultGCEUploadRetrySleep),
"WARMER_URL": "URL for warmer service",
"WARMER_TIMEOUT": fmt.Sprintf("timeout for requests to warmer service (default %v)", defaultGCEWarmerTimeout),
"WARMER_SSH_PASSPHRASE": fmt.Sprintf("The passphrase used to decipher instace SSH keys"),
"WARMER_SSH_PASSPHRASE": "The passphrase used to decipher instace SSH keys",
"ZONE": fmt.Sprintf("[DEPRECATED] Use ZONES instead. Zone name (default %q)", defaultGCEZone),
"ZONES": fmt.Sprintf("comma-delimited list of zone names (default %q)", defaultGCEZone),
}
Expand Down Expand Up @@ -907,7 +907,7 @@ func buildGoogleComputeService(cfg *config.ProviderConfig) (*compute.Service, er
if err != nil {
return nil, errors.Wrap(err, "could not build default client")
}
return compute.New(client)
return compute.New(client) //nolint:staticcheck
}

a, err := loadGoogleAccountJSON(cfg.Get("ACCOUNT_JSON"))
Expand All @@ -931,7 +931,7 @@ func buildGoogleComputeService(cfg *config.ProviderConfig) (*compute.Service, er
client.Transport = gceCustomHTTPTransport
}

return compute.New(client)
return compute.New(client) //nolint:staticcheck
}

func loadGoogleAccountJSON(filenameOrJSON string) (*gceAccountJSON, error) {
Expand Down
6 changes: 3 additions & 3 deletions backend/lxd.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ var (
"CPUS": fmt.Sprintf("CPU count to allocate to each container (default %q)", lxdLimitCPU),
"CPUS_BURST": fmt.Sprintf("allow using all CPUs when not in use (default %v)", lxdLimitCPUBurst),
"NETWORK": fmt.Sprintf("network bandwidth (default %q)", lxdLimitNetwork),
"POOL": fmt.Sprintf("storage pool to use for the instances"),
"POOL": "storage pool to use for the instances",
"DISK": fmt.Sprintf("disk size (default %q)", lxdLimitDisk),
"PROCESS": fmt.Sprintf("maximum number of processes (default %q)", lxdLimitProcess),
"IMAGE": fmt.Sprintf("image to use for the containers (default %q)", lxdImage),
"IMAGE_AUTO_DOWNLOAD": fmt.Sprintf("automatically try to download lxc image if it's missing (default %v)", lxdImageAutoDownload),
"IMAGE_SERVER_URL": fmt.Sprintf("base URL for images auto download"),
"IMAGE_SERVER_URL": "base URL for images auto download",
"IMAGE_SELECTOR_TYPE": fmt.Sprintf("image selector type (\"env\" or \"api\", default %q)", defaultLxdImageSelectorType),
"IMAGE_SELECTOR_URL": fmt.Sprintf("URL for image selector API, used only when image selector is \"api\""),
"IMAGE_SELECTOR_URL": "URL for image selector API, used only when image selector is \"api\"",
"DOCKER_POOL": fmt.Sprintf("storage pool to use for Docker (default %q)", lxdDockerPool),
"DOCKER_DISK": fmt.Sprintf("disk size to use for Docker (default %q)", lxdDockerDisk),
"NETWORK_STATIC": fmt.Sprintf("whether to statically set network configuration (default %v)", lxdNetworkStatic),
Expand Down
2 changes: 1 addition & 1 deletion context/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func WithTimings(ctx context.Context) context.Context {
func TimeSince(ctx context.Context, name string, since time.Time) {
if timings, ok := ctx.Value(timingsKey).(map[string]time.Duration); ok {
elapsed := time.Since(since)
if _, ok := timings[name]; ok {
if _, ok := timings[name]; ok { //nolint:gosimple
timings[name] += elapsed
} else {
timings[name] = elapsed
Expand Down
2 changes: 1 addition & 1 deletion script/list-packages
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ main() {
cd "$(dirname "$(dirname "${BASH_SOURCE[0]}")")"

find . -maxdepth 1 -type d | grep -v '^\.$' | sed 's@./@@' | while read -r pkg; do
if [[ "x$(bash -c "shopt -s nullglob; echo ${pkg}/*.go")" == "x" ]]; then
if [[ "_$(bash -c "shopt -s nullglob; echo ${pkg}/*.go")" == "_" ]]; then
continue
fi
echo "github.com/travis-ci/worker/${pkg}"
Expand Down

0 comments on commit b840303

Please sign in to comment.