Skip to content

Commit 4866eb2

Browse files
authored
ci: Run docker builds on linkerd-docker host (#376)
Replicate our integration test configuration to also run docker builds on our remote host. Furthermore, run these builds in unoptimized mode (since we don't consume the results).
1 parent d213c13 commit 4866eb2

File tree

3 files changed

+50
-2
lines changed

3 files changed

+50
-2
lines changed

.github/workflows/docker.yml

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Ensures that the local development dockerfile builds properly.
2+
#
3+
# The resulting Docker image is discarded.
14
name: Docker
25

36
on:
@@ -12,9 +15,50 @@ on:
1215
- 'Cargo.lock'
1316
- 'Dockerfile'
1417

18+
env:
19+
DOCKER_UNOPTIMIZED: "1"
20+
1521
jobs:
1622
docker:
1723
runs-on: ubuntu-latest
1824
steps:
1925
- uses: actions/checkout@v1
20-
- run: make docker
26+
27+
# Create a build image on a Linkerd build host.
28+
- name: Setup (Origin)
29+
if: '!github.event.pull_request.head.repo.fork'
30+
run: |
31+
mkdir -p ~/.ssh
32+
# Create an identity file and protect before writing contents to it.
33+
touch ~/.ssh/id && chmod 600 ~/.ssh/id
34+
echo "${{ secrets.DOCKER_PRIVATE_KEY }}" >~/.ssh/id
35+
# Use well-known public keys for the host to prevent middlemen.
36+
echo "${{ secrets.DOCKER_KNOWN_HOSTS }}" >~/.ssh/known_hosts
37+
# Configure host with ServerAliveInterval to ensure that the client
38+
# stays alive even when the server is busy emitting nothing.
39+
# ServerAliveCountMax ensures that server responds to these pings
40+
# within ~5 minutes.
41+
(
42+
echo "Host linkerd-docker"
43+
echo " User github"
44+
echo " Hostname ${{ secrets.DOCKER_ADDRESS }}"
45+
echo " IdentityFile ~/.ssh/id"
46+
echo " BatchMode yes"
47+
echo " ServerAliveInterval 60"
48+
echo " ServerAliveCountMax 5"
49+
) >~/.ssh/config
50+
# Confirm that the SSH configuration works.
51+
ssh linkerd-docker docker version
52+
53+
- name: Docker (Origin)
54+
if: '!github.event.pull_request.head.repo.fork'
55+
env:
56+
DOCKER_HOST: "ssh://linkerd-docker"
57+
run: |
58+
export DOCKER_TAG="proxy-ci:$(dd bs=64 count=1 if=/dev/urandom status=none | tr -dc 'a-zA-Z0-9')"
59+
make docker
60+
docker image rm -f "$DOCKER_TAG"
61+
62+
- name: Docker (Fork)
63+
if: github.event.pull_request.head.repo.fork
64+
run: make docker

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99

1010
# rather than updating this manually, run update-rust-version.sh
1111
ARG RUST_IMAGE=rust:1.37.0-buster
12-
ARG RUNTIME_IMAGE=gcr.io/linkerd-io/proxy:edge-19.8.7
12+
ARG RUNTIME_IMAGE=gcr.io/linkerd-io/proxy:edge-19.10.2
13+
ARG PROXY_UNOPTIMIZED
1314

1415
## Builds the proxy as incrementally as possible.
1516
FROM $RUST_IMAGE as build

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ DOCKER_BUILD = docker build
2626
ifdef DOCKER_TAG
2727
DOCKER_BUILD = docker build -t $(DOCKER_TAG)
2828
endif
29+
ifdef DOCKER_UNOPTIMIZED
30+
DOCKER_BUILD += --build-arg="PROXY_UNOPTIMIZED=$(DOCKER_UNOPTIMIZED)"
31+
endif
2932

3033
RUSTCFLAGS ?=
3134
ifdef CARGO_DEBUG

0 commit comments

Comments
 (0)