Skip to content

Commit c057d7a

Browse files
authored
ci: Improve/make extensible (#727)
Signed-off-by: Ryan Northey <ryan@synca.io>
1 parent a886c02 commit c057d7a

16 files changed

Lines changed: 157 additions & 39 deletions

.bazelrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ common:ci --test_output=errors
66

77
common:examples --action_env=DEV_CONTAINER_ID
88
common:examples --host_action_env=DEV_CONTAINER_ID
9+
common:examples --action_env=DEV_CONTAINER_ID
10+
common:examples --host_action_env=DEV_CONTAINER_ID
11+
common:examples --action_env=DOCKER_BUILDKIT
12+
common:examples --host_action_env=DOCKER_BUILDKIT
13+
common:examples --action_env=COMPOSE_BAKE
14+
common:examples --host_action_env=COMPOSE_BAKE
15+
common:examples --action_env=BUILDKIT_PROGRESS
16+
common:examples --host_action_env=BUILDKIT_PROGRESS
17+
common:examples --sandbox_writable_path=/var/run/docker.sock
918

1019
try-import %workspace%/user.bazelrc
1120
try-import %workspace%/repo.bazelrc
Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
1-
name: Verify
1+
name: Verify/Examples
22

33
permissions:
44
contents: read
55

66
on:
7-
pull_request:
8-
push:
9-
branches:
10-
- main
11-
12-
concurrency:
13-
group: >-
14-
${{ github.event.inputs.head_ref || github.run_id }}
7+
workflow_call:
158

169

1710
jobs:
18-
verify:
11+
examples:
1912
runs-on: ubuntu-24.04
2013
steps:
2114
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -30,18 +23,10 @@ jobs:
3023
path: /cache/docker
3124
key: ${{ runner.os }}-docker-${{ hashFiles('**/Dockerfile*') }}
3225
- run: |
33-
sudo systemctl stop docker docker.socket
34-
sudo rm -rf /var/lib/docker/{*,.*}
3526
TEMPDIR=/cache/docker
36-
zstd --stdout -d "${TEMPDIR}/docker.tar.zst" | sudo tar --warning=no-timestamp -xf - -C /var/lib/docker
27+
zstd --stdout -d "${TEMPDIR}/docker.tar.zst" | sudo tar --warning=no-timestamp -xf - -C /var/lib/docker-examples
3728
sudo umount "$TEMPDIR"
38-
sudo systemctl start docker
3929
if: steps.cache.outputs.cache-hit == 'true'
40-
- run: |
41-
sudo systemctl stop docker docker.socket
42-
sudo rm -rf /var/lib/docker/{*,.*}
43-
sudo systemctl start docker
44-
if: steps.cache.outputs.cache-hit != 'true' && github.event_name != 'pull_request'
4530
4631
- run: |
4732
TEMPDIR=/cache/docker
@@ -53,24 +38,22 @@ jobs:
5338
path: /home/runner/.cache
5439
key: ${{ runner.os }}-bazel-${{ hashFiles('**/BUILD', '**/*bzl', 'WORKSPACE') }}
5540

56-
- run: |
57-
sudo apt-get update
58-
sudo apt-get -qq install -y --no-install-recommends expect gettext yq whois
5941
- run: |
6042
docker pull envoyproxy/envoy:dev
6143
DEV_CONTAINER_ID=$(docker inspect --format='{{.Id}}' envoyproxy/envoy:dev)
6244
echo "DEV_CONTAINER_ID=${DEV_CONTAINER_ID}" >> $GITHUB_ENV
6345
- run: |
64-
echo "common:examples --sandbox_writable_path=$HOME/.docker/" > repo.bazelrc
65-
echo "common:examples --sandbox_writable_path=$HOME" >> repo.bazelrc
66-
bazel run --config=ci \
67-
--config=examples \
68-
//:verify_examples
46+
export UID
47+
echo "common --config=ci" >> repo.bazelrc
48+
docker compose run --quiet --quiet-pull --quiet-build examples
49+
env:
50+
DOCKER_BUILDKIT: 1
51+
COMPOSE_BAKE: true
52+
BUILDKIT_PROGRESS: quiet
6953
7054
- run: |
71-
sudo systemctl stop docker docker.socket
7255
TEMPDIR=/cache/docker
73-
sudo tar cf - -C /var/lib/docker . | zstd - -q -T0 -o "${TEMPDIR}/docker.tar.zst"
56+
sudo tar cf - -C /var/lib/docker-examples . | zstd - -q -T0 -o "${TEMPDIR}/docker.tar.zst"
7457
ls -alh "${TEMPDIR}/docker.tar.zst"
7558
if: steps.cache.outputs.cache-hit != 'true' && github.event_name != 'pull_request'
7659
- uses: actions/cache/save@v4

.github/workflows/docs.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ concurrency:
1616
1717
jobs:
1818
docs:
19-
runs-on: ubuntu-22.04
19+
runs-on: ubuntu-24.04
2020
steps:
2121
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2222
with:
@@ -26,5 +26,14 @@ jobs:
2626
with:
2727
path: examples
2828
- run: |
29-
bazel build --override_repository=envoy_examples=../examples --config=ci //docs
30-
working-directory: envoy
29+
export UID
30+
docker compose run --quiet --quiet-pull --quiet-build docs
31+
working-directory: examples
32+
env:
33+
BAZEL_BUILD_EXTRA_OPTIONS: >-
34+
--override_repository=envoy_examples=../examples
35+
--config=ci
36+
--@rules_python//python/config_settings:bootstrap_impl=script
37+
DOCKER_BUILDKIT: 1
38+
COMPOSE_BAKE: true
39+
BUILDKIT_PROGRESS: quiet

.github/workflows/verify.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Verify
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
pull_request:
8+
push:
9+
branches:
10+
- main
11+
12+
concurrency:
13+
group: >-
14+
${{ github.event.inputs.head_ref || github.run_id }}
15+
16+
17+
jobs:
18+
examples:
19+
uses: ./.github/workflows/_verify_examples.yml

.yamllint

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ ignore:
2929
- "**/*template.yaml"
3030
- examples/single-page-app/_github-clusters.yml
3131
- test/config/integration/server_xds.cds.with_unknown_field.yaml
32+
- "**/node_modules/**"

_docker/Dockerfile-docs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FROM envoyproxy/envoy-build:llvm-a3be5281b88359ab536d052218a30a951c97d751@sha256:5e29f02effdc49483d1e8bc3093c54ed54fa8821bb4aa228d7b2f9769647d18e

_docker/Dockerfile-examples

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FROM envoyproxy/envoy-build:docker-a3be5281b88359ab536d052218a30a951c97d751@sha256:ca020f5e40f928fc2ad1c03be1888b314a3b085d60bea59ef2941219c4669c5a

_docker/docs-entrypoint-extra.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
set -e -o pipefail
4+
5+
su - envoybuild -c "git config --global --add safe.directory /workspace/envoy"
6+
mkdir -p /workspace/envoy/generated/docs
7+
chown envoybuild:envoybuild /workspace/envoy/generated/docs

_docker/examples-cleanup.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
set -e -o pipefail
4+
5+
rm -f repo.bazelrc
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
set -e -o pipefail
4+
5+
echo "common:examples --sandbox_writable_path=/home/envoybuild" >> repo.bazelrc
6+
echo "common:examples --sandbox_writable_path=/home/envoybuild/.docker" >> repo.bazelrc

0 commit comments

Comments
 (0)