Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor builds #536

Merged
merged 44 commits into from
Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
027d662
Fix multi-arch builds
austinlparker Oct 23, 2022
93deef4
re-add logins
austinlparker Oct 23, 2022
4bebc33
run on builds but dont push
austinlparker Oct 23, 2022
17a5bd5
skip logins on branch builds
austinlparker Oct 23, 2022
1507957
test for null version
austinlparker Oct 23, 2022
5a1adce
pass versions in currencyservice dockerfile
austinlparker Oct 24, 2022
972dfee
test
austinlparker Oct 24, 2022
fb2e672
pls work
austinlparker Oct 24, 2022
796bb1d
add debug logging
austinlparker Oct 24, 2022
d4e2b6f
reduce buildx parallelism
austinlparker Oct 24, 2022
67edc44
workaround memory w/swap?
austinlparker Oct 24, 2022
24a79fd
downgrade otp?
austinlparker Oct 24, 2022
b9fb7fe
fix shippingservice
austinlparker Oct 24, 2022
768cf62
Merge branch 'open-telemetry:main' into buildxRefactor
austinlparker Oct 31, 2022
19635cd
self-hosted test
austinlparker Oct 31, 2022
02e0cb6
remove swap
austinlparker Oct 31, 2022
baddd33
increase parallelism
austinlparker Oct 31, 2022
4063dba
remove self-hosted
austinlparker Oct 31, 2022
61c5828
Merge branch 'main' into buildxRefactor
cartersocha Nov 7, 2022
8074353
try larger runner
austinlparker Nov 9, 2022
8633d59
target new runner
austinlparker Nov 9, 2022
32c9185
kick build
austinlparker Nov 9, 2022
8a5f37e
kicking new run
austinlparker Nov 9, 2022
74d8bcd
increase max parallelism
austinlparker Nov 9, 2022
2546ee8
Merge branch 'main' into buildxRefactor
austinlparker Nov 12, 2022
d5bc1e4
re-target to free runners
austinlparker Nov 12, 2022
b1a6bd3
fix lint
austinlparker Nov 12, 2022
aa5b865
disable parallelism
austinlparker Nov 12, 2022
d01cae9
only build amd64
austinlparker Nov 13, 2022
daee9bc
improving cpp build time
austinlparker Nov 14, 2022
5a2135a
switch caching to github
austinlparker Nov 14, 2022
e578eac
update build action
austinlparker Nov 14, 2022
23d50e9
fix check
austinlparker Nov 14, 2022
9b64671
set max cache layers
austinlparker Nov 14, 2022
25c1a99
test caching
austinlparker Nov 14, 2022
266494f
enable inline caching for multi-stage
austinlparker Nov 14, 2022
132431a
remove mold from currencyservice
austinlparker Nov 14, 2022
169728b
fix
austinlparker Nov 14, 2022
ae72bac
try local caching with inline
austinlparker Nov 14, 2022
36fee14
test
austinlparker Nov 14, 2022
d8fdcb9
remove inline caching step
austinlparker Nov 14, 2022
efcff23
Merge branch 'main' into buildxRefactor
austinlparker Nov 14, 2022
e2f45fd
remove PR check
austinlparker Nov 14, 2022
6fe73c6
Merge branch 'main' into buildxRefactor
austinlparker Nov 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 84 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: "Release"
name: "Build and Publish"

on:
release:
types: [published]
pull_request:
branches: [main]

jobs:
build_and_push_images:
Expand All @@ -16,36 +18,104 @@ jobs:
DOCKERHUB_REPO: "otel/demo"
GHCR_REPO: "ghcr.io/open-telemetry/demo"

strategy:
matrix:
file_tag:
- file: ./src/adservice/Dockerfile
tag_suffix: adservice
context: ./
- file: ./src/cartservice/src/Dockerfile
tag_suffix: cartservice
context: ./
- file: ./src/checkoutservice/Dockerfile
tag_suffix: checkoutservice
context: ./
- file: ./src/currencyservice/Dockerfile
tag_suffix: currencyservice
context: ./src/currencyservice
- file: ./src/emailservice/Dockerfile
tag_suffix: emailservice
context: ./src/emailservice
- file: ./src/frontend/Dockerfile
tag_suffix: frontend
context: ./
- file: ./src/frontendproxy/Dockerfile
tag_suffix: frontendproxy
context: ./
- file: ./src/paymentservice/Dockerfile
tag_suffix: paymentservice
context: ./
- file: ./src/productcatalogservice/Dockerfile
tag_suffix: productcatalogservice
context: ./
- file: ./src/quoteservice/Dockerfile
tag_suffix: quoteservice
context: ./
- file: ./src/shippingservice/Dockerfile
tag_suffix: shippingservice
context: ./
- file: ./src/featureflagservice/Dockerfile
tag_suffix: featureflagservice
context: ./src/featureflagservice
- file: ./src/loadgenerator/Dockerfile
tag_suffix: loadgenerator
context: ./
- file: ./src/recommendationservice/Dockerfile
tag_suffix: recommendationservice
context: ./
- file: ./src/frontend/Dockerfile.cypress
tag_suffix: frontend-tests
context: ./
- file: ./test/Dockerfile
tag_suffix: integrationTests
context: ./
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

# limit docker push image concurrency to 1
# to avoid github package return 429 ratelimit error
- name: Set docker upload concurrent
run: |
echo $'{"max-concurrent-uploads": 1}' | sudo dd status=none of=/etc/docker/daemon.json
sudo service docker restart

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
if: github.event_name != 'pull_request'

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
if: github.event_name != 'pull_request'

- name: prepare build env
run: make build-env-file
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: build and push ghcr docker image
run: make build-and-push-ghcr
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
config-inline: |
[worker.oci]
max-parallelism = 2

- name: build and push dockerhub image
run: make build-and-push-dockerhub
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-

- name: Matrix Build and push demo images
uses: docker/build-push-action@v3.1.1
with:
context: ${{ matrix.file_tag.context }}
file: ${{ matrix.file_tag.file }}
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ env.DOCKERHUB_REPO }}:${{ env.RELEASE_VERSION || 'pr' }}-${{matrix.file_tag.tag_suffix }}
${{ env.GHCR_REPO }}:${{ env.RELEASE_VERSION || 'pr' }}-${{ matrix.file_tag.tag_suffix }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
4 changes: 2 additions & 2 deletions src/currencyservice/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ RUN apt-get install -qq -y --ignore-missing \
cmake

# The following arguments would be passed from docker-compose.yml
ARG GRPC_VERSION
ARG OPENTELEMETRY_VERSION
ARG GRPC_VERSION=1.46.0
ARG OPENTELEMETRY_VERSION=1.5.0

# Install GRPC
RUN git clone --shallow-submodules --depth 1 --recurse-submodules -b v${GRPC_VERSION} \
Expand Down
6 changes: 3 additions & 3 deletions src/featureflagservice/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# - Ex: hexpm/elixir:1.13.3-erlang-25.0-debian-bullseye-20210902-slim
#
ARG ELIXIR_VERSION=1.13.3
ARG OTP_VERSION=25.0
ARG OTP_VERSION=23.0
ARG DEBIAN_VERSION=bullseye-20210902-slim

ARG BUILDER_IMAGE="hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-debian-${DEBIAN_VERSION}"
Expand All @@ -29,8 +29,8 @@ RUN apt-get update -y && apt-get install -y build-essential git \
WORKDIR /app

# install hex + rebar
RUN mix local.hex --force && \
mix local.rebar --force
RUN mix local.hex --force --verbose
RUN mix local.rebar --force --verbose

# set build ENV
ENV MIX_ENV="prod"
Expand Down
5 changes: 3 additions & 2 deletions src/shippingservice/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ RUN apk add --no-cache ca-certificates git protobuf-dev protoc cmake clang clang
WORKDIR /app/

# build app
COPY ./src/shippingservice/ /app/
COPY ./pb/ /app/proto/
COPY /src/shippingservice/ /app/
COPY /pb/ /app/proto/

RUN cargo build -r --features="dockerproto"

FROM alpine as release
Expand Down
2 changes: 1 addition & 1 deletion src/shippingservice/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
#[cfg(feature = "dockerproto")]
tonic_build::compile_protos("proto/demo.proto")?;
tonic_build::compile_protos("/app/proto/demo.proto")?;
#[cfg(not(feature = "dockerproto"))]
tonic_build::compile_protos("../../pb/demo.proto")?;
Ok(())
Expand Down