Use Dockerhub Mirror. (#9220)

Dockerhub is going to rate limit unauthenticated pulls.

Use our HashiCorp internal mirror for builds run through CircleCI.

Co-authored-by: Mahmood Ali <mahmood@hashicorp.com>
This commit is contained in:
Russell Rollins 2020-11-02 09:28:02 -05:00 committed by GitHub
parent d62d8a8587
commit 538aa90d92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 33 additions and 20 deletions

16
.circleci/config.yml generated
View File

@ -551,7 +551,7 @@ jobs:
make deps
name: Install golang dependencies
- run:
command: docker pull hashicorpnomad/busybox-windows:server2016-0.1
command: docker pull docker.mirror.hashicorp.services/hashicorpnomad/busybox-windows:server2016-0.1
name: Pre-download docker test image
- run:
command: |
@ -703,7 +703,7 @@ jobs:
docker:
- environment:
JOBS: 2
image: circleci/node:10-browsers
image: docker.mirror.hashicorp.services/circleci/node:10-browsers
steps:
- checkout
- restore_cache:
@ -732,7 +732,7 @@ jobs:
path: /tmp/test-reports
lint-go:
docker:
- image: golang:1.15.1
- image: docker.mirror.hashicorp.services/golang:1.15.1
working_directory: /go/src/github.com/hashicorp/nomad
steps:
- checkout
@ -767,7 +767,7 @@ jobs:
- PAGER: cat
website-docker-image:
docker:
- image: circleci/buildpack-deps
- image: docker.mirror.hashicorp.services/circleci/buildpack-deps
shell: /usr/bin/env bash -euo pipefail -c
steps:
- checkout
@ -912,7 +912,7 @@ jobs:
path: /tmp/test-reports
test-devices:
docker:
- image: golang:1.15.1
- image: docker.mirror.hashicorp.services/golang:1.15.1
working_directory: /go/src/github.com/hashicorp/nomad
environment:
- GIT_PAGER: cat
@ -1050,7 +1050,7 @@ jobs:
- PAGER: cat
algolia_index:
docker:
- image: node:12
- image: docker.mirror.hashicorp.services/node:12
steps:
- checkout
- run:
@ -1184,7 +1184,7 @@ jobs:
path: /tmp/test-reports
build-binaries:
docker:
- image: golang:1.15.1
- image: docker.mirror.hashicorp.services/golang:1.15.1
working_directory: /go/src/github.com/hashicorp/nomad
environment:
- GIT_PAGER: cat
@ -1218,7 +1218,7 @@ jobs:
path: pkg/linux_amd64.zip
test-e2e:
docker:
- image: golang:1.15.1
- image: docker.mirror.hashicorp.services/golang:1.15.1
working_directory: /go/src/github.com/hashicorp/nomad
steps:
- checkout

View File

@ -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

View File

@ -1,5 +1,5 @@
docker:
- image: node:12
- image: docker.mirror.hashicorp.services/node:12
steps:
- checkout
- run:

View File

@ -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
@ -28,4 +28,4 @@ steps:
- store_test_results:
path: /tmp/test-reports
- store_artifacts:
path: /tmp/test-reports
path: /tmp/test-reports

View File

@ -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: |

View File

@ -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

View File

@ -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"
}
return "busybox:1", "busybox", "1"
if testutil.IsCI() {
// In CI, use HashiCorp Mirror to avoid DockerHub rate limiting
name = "docker.mirror.hashicorp.services/" + name
}
return name + ":" + tag, name, tag
}
func TestDockerLogger_Success(t *testing.T) {

View File

@ -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

View File

@ -6,6 +6,7 @@ import (
"testing"
"github.com/hashicorp/nomad/client/allocdir"
tu "github.com/hashicorp/nomad/testutil"
)
func newTaskConfig(variant string, command []string) TaskConfig {
@ -13,6 +14,11 @@ func newTaskConfig(variant string, command []string) TaskConfig {
// 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",

View File

@ -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