Skip to content

Commit

Permalink
ci: build interop Docker image for pushes to master, and for releases (
Browse files Browse the repository at this point in the history
…#4035)

* ci: build interop Docker image for pushes to master, and tag releases

* use self-hosted runner to build Docker image

* Apply suggestions from code review

Co-authored-by: Piotr Galar <piotr.galar@gmail.com>

* Update .github/workflows/build-interop-docker.yml

Co-authored-by: Piotr Galar <piotr.galar@gmail.com>

* build the correct commit

* Update .github/workflows/build-interop-docker.yml

---------

Co-authored-by: Piotr Galar <piotr.galar@gmail.com>
  • Loading branch information
marten-seemann and galargh committed Aug 21, 2023
1 parent fe3c4f2 commit f689a5d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/build-interop-docker.yml
@@ -1,11 +1,14 @@
name: Build interop Docker image
on:
push:
branches: [ interop ]
branches:
- master
tags:
- 'v*'

jobs:
interop:
runs-on: ubuntu-latest
runs-on: ${{ fromJSON(vars['DOCKER_RUNNER_UBUNTU'] || '"ubuntu-latest"') }}
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
Expand All @@ -19,9 +22,23 @@ jobs:
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: set tag name
id: tag
# Tagged releases won't be picked up by the interop runner automatically,
# but they can be useful when debugging regressions.
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
echo "tag=${GITHUB_REF#refs/tags/}" | tee -a $GITHUB_OUTPUT;
echo "gitref=${GITHUB_REF#refs/tags/}" | tee -a $GITHUB_OUTPUT;
else
echo 'tag=latest' | tee -a $GITHUB_OUTPUT;
echo 'gitref=${{ github.sha }}' | tee -a $GITHUB_OUTPUT;
fi
- uses: docker/build-push-action@v4
with:
context: "{{defaultContext}}:interop"
platforms: linux/amd64,linux/arm64
push: true
tags: martenseemann/quic-go-interop:latest
build-args: |
GITREF=${{ steps.tag.outputs.gitref }}
tags: martenseemann/quic-go-interop:${{ steps.tag.outputs.tag }}
13 changes: 7 additions & 6 deletions interop/Dockerfile
Expand Up @@ -5,7 +5,7 @@ RUN echo "TARGETPLATFORM: ${TARGETPLATFORM}"

RUN apt-get update && apt-get install -y wget tar git

ENV GOVERSION=1.20.2
ENV GOVERSION=1.20.7

RUN platform=$(echo ${TARGETPLATFORM} | tr '/' '-') && \
filename="go${GOVERSION}.${platform}.tar.gz" && \
Expand All @@ -18,14 +18,15 @@ ENV PATH="/go/bin:${PATH}"
# build with --build-arg CACHEBUST=$(date +%s)
ARG CACHEBUST=1

RUN git clone https://github.com/quic-go/quic-go && \
cd quic-go && \
git fetch origin interop && git checkout -t origin/interop && \
go get ./...
# build other branches / commits / tags using --build-arg GITREF="<git reference>"
ARG GITREF="master"

RUN git clone https://github.com/quic-go/quic-go
WORKDIR /quic-go
RUN git checkout ${GITREF}
RUN go get ./...

RUN git rev-parse HEAD > commit.txt
RUN git rev-parse HEAD | tee commit.txt
RUN go build -o server -ldflags="-X github.com/quic-go/quic-go/qlog.quicGoVersion=$(git describe --always --long --dirty)" interop/server/main.go
RUN go build -o client -ldflags="-X github.com/quic-go/quic-go/qlog.quicGoVersion=$(git describe --always --long --dirty)" interop/client/main.go

Expand Down

0 comments on commit f689a5d

Please sign in to comment.