Skip to content

Commit

Permalink
New approach: use minikube, arm64-only
Browse files Browse the repository at this point in the history
  • Loading branch information
briandealwis committed Jun 28, 2021
1 parent 36bced4 commit ff8acb3
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 43 deletions.
34 changes: 10 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
sudo: false
dist: focal
arch: [amd64, arm64]
arch: [arm64] #[amd64,arm64]
language: go
go: "1.15.x"

Expand All @@ -9,54 +9,40 @@ addons:
apt:
packages: [jq]

env:
- DOCKER_BUILDKIT=0

before_install:
# ensure we're using recent docker with containerd >= 1.3.4 so as to be able to use gcr mirror
#- sh hack/update-docker.sh

# enable buildkit plus configure gcr mirror
#- sh hack/enable-docker-buildkit.sh
- sh hack/use-gcr-mirror.sh
- sudo service docker restart || (systemctl status docker.service; journalctl -xe)
#- sh hack/use-gcr-mirror.sh
#- sudo service docker restart || (systemctl status docker.service; journalctl -xe)
- docker info

# Remove buildkit'isms from Dockerfiles
- sh hack/strip-buildkitisms.sh
#- sh hack/strip-buildkitisms.sh

install:
- mkdir -p $HOME/bin
- curl -Lo $HOME/bin/skaffold https://storage.googleapis.com/skaffold/builds/latest/skaffold-linux-${TRAVIS_CPU_ARCH}
- curl -Lo $HOME/bin/container-structure-test https://storage.googleapis.com/container-structure-test/latest/container-structure-test-linux-${TRAVIS_CPU_ARCH}
- curl -Lo $HOME/bin/kind https://github.com/kubernetes-sigs/kind/releases/download/v0.11.1/kind-linux-${TRAVIS_CPU_ARCH}
#- curl -Lo $HOME/bin/kind https://github.com/kubernetes-sigs/kind/releases/download/v0.11.1/kind-linux-${TRAVIS_CPU_ARCH}
- curl -Lo $HOME/bin/minikube https://storage.googleapis.com/minikube-builds/master/minikube-linux-${TRAVIS_CPU_ARCH}

- curl -Lo $HOME/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/linux/${TRAVIS_CPU_ARCH}/kubectl
- chmod +x $HOME/bin/*
- export PATH=$HOME/bin:$PATH
- skaffold config set --global collect-metrics false

script:
- minikube start || travis_terminate $?

- (cd nodejs/helper-image; go test .)
- (cd python/helper-image/launcher; go test .)

# try building before integration tests
- skaffold build -p local -v info -p integration || travis_terminate $?

# Create a kind configuration to use the docker daemon's configured
# registry-mirrors.
- |
docker system info --format '{{printf "apiVersion: kind.x-k8s.io/v1alpha4\nkind: Cluster\ncontainerdConfigPatches:\n"}}{{range $reg, $config := .RegistryConfig.IndexConfigs}}{{if $config.Mirrors}}{{printf "- |-\n [plugins.\"io.containerd.grpc.v1.cri\".registry.mirrors.\"%s\"]\n endpoint = [" $reg}}{{range $index, $mirror := $config.Mirrors}}{{if $index}},{{end}}{{printf "%q" $mirror}}{{end}}{{printf "]\n"}}{{end}}{{end}}' | tee /tmp/kind.config
# `kind create cluster` is very verbose
- (kind create cluster --retain -v 1 --config /tmp/kind.config && kind get kubeconfig > /tmp/kube.config)
|| (kind export logs;
docker ps -a --format '{{.Image}} {{.ID}} {{.Names}}' |
while read image cid name; do
echo "=== $image ($cid) $name ===";
docker logs $cid | sed 's/^/> /';
done;
travis_terminate $?)

# we had `run-its.sh` in `after_success` but it doesn't cause failures
- KUBECONFIG=/tmp/kube.config bash ./run-its.sh -p local
- bash ./run-its.sh -p local

8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,11 @@ form produced by `skaffold debug`. To run:
```sh
sh run-its.sh
```

# Troubleshooting

## Development

We use buildx to avoid 'failed to load cache key' and
'failed size validation' errors <https://stackoverflow.com/a/64776416/600339>

8 changes: 4 additions & 4 deletions go/helper-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ARG GOVERSION=1.16
FROM --platform=$BUILDPLATFORM golang:${GOVERSION} as delve
ARG BUILDPLATFORM
ARG TARGETOS
ARG TARGETARCH
FROM golang:${GOVERSION} as delve
ARG BUILDPLATFORM=linux/arm64
ARG TARGETOS=linux
ARG TARGETARCH=arm64

ARG DELVE_VERSION=1.6.0

Expand Down
10 changes: 5 additions & 5 deletions go/test/goapp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ARG GOVERSION
FROM --platform=$BUILDPLATFORM golang:$GOVERSION as builder
ARG BUILDPLATFORM
ARG TARGETOS
ARG TARGETARCH
FROM golang:$GOVERSION as builder
ARG BUILDPLATFORM=linux/arm64
ARG TARGETOS=linux
ARG TARGETARCH=arm64

COPY main.go .
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build -gcflags="all=-N -l" -o /app main.go

FROM --platform=$BUILDPLATFORM gcr.io/distroless/base
FROM gcr.io/distroless/base
CMD ["./app"]
ENV GOTRACEBACK=single
COPY --from=builder /app .
8 changes: 4 additions & 4 deletions integration/kubectl/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Simple multi-platform image that includes kubectl and curl
FROM --platform=$BUILDPLATFORM curlimages/curl
ARG BUILDPLATFORM
ARG TARGETOS
ARG TARGETARCH
FROM curlimages/curl
ARG BUILDPLATFORM=linux/arm64
ARG TARGETOS=linux
ARG TARGETARCH=arm64

# curlimages/curl runs as curl-user and cannot install into /usr/bin
USER root
Expand Down
2 changes: 1 addition & 1 deletion netcore/helper-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN apt-get update \
# Now populate the duct-tape image with the language runtime debugging support files
# The debian image is about 95MB bigger
FROM busybox
ARG BUILDPLATFORM
ARG BUILDPLATFORM=linux/arm64

# The install script copies all files in /duct-tape to /dbg
COPY install.sh /
Expand Down
8 changes: 4 additions & 4 deletions nodejs/helper-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ARG GOVERSION=1.16
FROM --platform=$BUILDPLATFORM golang:${GOVERSION} as build
ARG BUILDPLATFORM
ARG TARGETOS
ARG TARGETARCH
FROM golang:${GOVERSION} as build
ARG BUILDPLATFORM=linux/arm64
ARG TARGETOS=linux
ARG TARGETARCH=arm64

COPY . .
# Produce an as-static-as-possible dlv binary to work on musl and glibc
Expand Down
2 changes: 1 addition & 1 deletion python/helper-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ RUN GOPATH="" CGO_ENABLED=0 go build -o launcher -ldflags '-s -w -extldflags "-s
# Now populate the duct-tape image with the language runtime debugging support files
# The debian image is about 95MB bigger
FROM busybox
ARG BUILDPLATFORM
ARG BUILDPLATFORM=linux/arm64

# The install script copies all files in /duct-tape to /dbg
COPY install.sh /
Expand Down

0 comments on commit ff8acb3

Please sign in to comment.