Skip to content

Commit

Permalink
Use Dockerhub Mirror. (#9220)
Browse files Browse the repository at this point in the history
Dockerhub is going to rate limit unauthenticated pulls.

Use our HashiCorp internal mirror for builds run through CircleCI.

Co-authored-by: Mahmood Ali <[email protected]>
  • Loading branch information
Russell Rollins and Mahmood Ali authored Nov 2, 2020
1 parent 6e9ecf2 commit 93c7909
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 20 deletions.
16 changes: 8 additions & 8 deletions .circleci/config.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .circleci/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ executors:
go:
working_directory: /go/src/github.com/hashicorp/nomad
docker:
- image: golang:1.15.1
- image: docker.mirror.hashicorp.services/golang:1.15.1
environment:
<<: *common_envs
GOPATH: /go
Expand Down
2 changes: 1 addition & 1 deletion .circleci/config/jobs/algolia_index.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
docker:
- image: node:12
- image: docker.mirror.hashicorp.services/node:12
steps:
- checkout
- run:
Expand Down
4 changes: 2 additions & 2 deletions .circleci/config/jobs/test-ui.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
docker:
- image: circleci/node:10-browsers
- image: docker.mirror.hashicorp.services/circleci/node:10-browsers
environment:
# See https://git.io/vdao3 for details.
JOBS: 2
Expand Down Expand Up @@ -28,4 +28,4 @@ steps:
- store_test_results:
path: /tmp/test-reports
- store_artifacts:
path: /tmp/test-reports
path: /tmp/test-reports
2 changes: 1 addition & 1 deletion .circleci/config/jobs/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ steps:
make deps
- run:
name: Pre-download docker test image
command: docker pull hashicorpnomad/busybox-windows:server2016-0.1
command: docker pull docker.mirror.hashicorp.services/hashicorpnomad/busybox-windows:server2016-0.1
- run:
name: Build nomad
command: |
Expand Down
2 changes: 1 addition & 1 deletion .circleci/config/jobs/website-docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
docker:
- image: circleci/buildpack-deps
- image: docker.mirror.hashicorp.services/circleci/buildpack-deps
shell: /usr/bin/env bash -euo pipefail -c
steps:
- checkout
Expand Down
15 changes: 11 additions & 4 deletions drivers/docker/docklog/docker_logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,20 @@ import (
)

func testContainerDetails() (image string, imageName string, imageTag string) {
name := "busybox"
tag := "1"

if runtime.GOOS == "windows" {
return "hashicorpnomad/busybox-windows:server2016-0.1",
"hashicorpnomad/busybox-windows",
"server2016-0.1"
name = "hashicorpnomad/busybox-windows"
tag = "server2016-0.1"
}

if testutil.IsCI() {
// In CI, use HashiCorp Mirror to avoid DockerHub rate limiting
name = "docker.mirror.hashicorp.services/" + name
}

return "busybox:1", "busybox", "1"
return name + ":" + tag, name, tag
}

func TestDockerLogger_Success(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/docker/driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ func TestDockerDriver_Start_StoppedContainer(t *testing.T) {
if runtime.GOOS != "windows" {
imageID, err = d.Impl().(*Driver).loadImage(task, &taskCfg, client)
} else {
image, lErr := client.InspectImage("hashicorpnomad/busybox-windows:server2016-0.1")
image, lErr := client.InspectImage(taskCfg.Image)
err = lErr
if image != nil {
imageID = image.ID
Expand Down
6 changes: 6 additions & 0 deletions drivers/docker/driver_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@ import (
"testing"

"github.com/hashicorp/nomad/client/allocdir"
tu "github.com/hashicorp/nomad/testutil"
)

func newTaskConfig(variant string, command []string) TaskConfig {
// busyboxImageID is an id of an image containing nanoserver windows and
// a busybox exe.
busyboxImageID := "hashicorpnomad/busybox-windows:server2016-0.1"

if tu.IsCI() {
// In CI, use HashiCorp Mirror to avoid DockerHub rate limiting
busyboxImageID = "docker.mirror.hashicorp.services/" + busyboxImageID
}

return TaskConfig{
Image: busyboxImageID,
ImagePullTimeout: "5m",
Expand Down
2 changes: 1 addition & 1 deletion website/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:10.16.3-alpine
FROM docker.mirror.hashicorp.services/node:10.16.3-alpine
RUN apk add --update --no-cache git make g++ automake autoconf libtool nasm libpng-dev

COPY ./package.json /website/package.json
Expand Down

0 comments on commit 93c7909

Please sign in to comment.