Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ common:debs-ci --config=ci
common:debs-ci --//debs:excludes=//debs:excludes.txt
common:debs-ci --//debs:token=//debs:token.txt

common:debs-publish --//debs:debs-publish=//debs:import

common:publish-ci --config=debs-ci
common:publish-ci --//tools/tarball:target=//:html
common:publish-ci --//tools/tarball:overwrite=//tools/tarball:true
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build

permissions:
contents: read

on:
pull_request:
push:
branches:
- main

concurrency:
group: >-
${{ github.event.inputs.head_ref || github.run_id }}


jobs:
build:
runs-on: ubuntu-latest-8-cores
if: ${{ github.repository_owner == 'envoyproxy' }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- run: |
mkdir ./debs/import
gsutil -mq rsync -r gs://envoy-apt-cache/debs ./debs/import/
ls -alh debs/import/

- run: |
sudo mkdir /opt/build
sudo chown runner:docker /opt/build
echo ${{ github.token }} > debs/token.txt
./build-repository.sh
du -ch /opt/build
du -ch ~/.cache
env:
CONTEXT: deploy-preview
GITHUB_TOKEN: ${{ github.token }}
4 changes: 1 addition & 3 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ jobs:
if: github.repository_owner == 'envoyproxy'
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- uses: envoyproxy/toolshed/gh-actions/[email protected]
- run: |
mkdir ./debs/import
gsutil -mq rsync -r gs://envoy-apt-cache/debs ./debs/import/
ls -alh debs/import/

- run: |
. ./build-repository.sh
import_public_key
Expand All @@ -33,7 +32,6 @@ jobs:
time bazel build "--sandbox_writable_path=${GNUPG_HOME}" --config=debs-ci //debs
env:
GITHUB_TOKEN: ${{ github.token }}

- uses: envoyproxy/toolshed/gh-actions/gcp/[email protected]
name: Setup GCP (cache)
if: ${{ github.event_name != 'pull_request' }}
Expand Down
9 changes: 7 additions & 2 deletions build-repository.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ UNDERLINE="\e[4m"
NORMAL="\e[0m"

EXCLUDE_FILE=debs/excludes.txt
DEBS_ROOT=/opt/build/cache/repository
DEBS_ROOT="${DEBS_ROOT:-/opt/build/cache/repository}"
OUTPUT_DIR="${OUTPUT_DIR:-/opt/build/repo/html}"
SIGNING_KEY_PASSPHRASE="${SIGNING_KEY_PASSPHRASE:-Hackme}"


Expand Down Expand Up @@ -103,8 +104,12 @@ main () {
fi
bazel run \
"${bazel_args[@]}" \
--config=debug-bazel \
--config=debs-publish \
--sandbox_writable_path=/opt/build \
--sandbox_writable_path=/home/runner/.gnupg/ \
//tools/tarball:unpack \
/opt/build/repo/html
$OUTPUT_DIR
}

if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
Expand Down
20 changes: 16 additions & 4 deletions debs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,26 @@ fetch_debs(
excludes = ":excludes",
)

filegroup(
name = "import",
srcs = glob(["import/v*/*"]),
)

PUBLISH_ENV = {
"APTLY_BIN": "$(location @aptly)",
"MAINTAINER_KEY": "$(location //:envoy-maintainers-public.key)",
"APTLY_CONF": "$(location //:aptly-config)",
"DEBS": "$(location :debs)",
"DEBS": "$(locations :debs-publish)",
"DEBS_ROOT": "$${APT_ROOT}/repository",
"SIGNING_TOKEN": "$(location :signing-token)",
}

label_flag(
name = "debs-publish",
build_setting_default = ":debs",
visibility = ["//visibility:public"],
)

sh_binary(
name = "publish",
srcs = ["publish.sh"],
Expand All @@ -159,7 +170,7 @@ sh_binary(
"@aptly",
"//:aptly-config",
"//:envoy-maintainers-public.key",
":debs",
":debs-publish",
":signing-token",
],
visibility = ["//visibility:public"],
Expand All @@ -169,9 +180,10 @@ HTML_BUILD_CMD = """
export APTLY_BIN="$(location @aptly)"
export MAINTAINER_KEY="$(location //:envoy-maintainers-public.key)"
export APTLY_CONF="$(location //:aptly-config)"
export DEBS="$(location :debs)"
export DEBS="$(locations :debs-publish)"
export DEBS_ROOT="$${APT_ROOT}/repository"
export SIGNING_TOKEN="$(location :signing-token)"
ls -alh /opt/build
$(location :publish)
tar hcf $@ -C $${APT_ROOT}/html .
"""
Expand All @@ -187,7 +199,7 @@ genrule(
"@aptly",
"//:aptly-config",
"//:envoy-maintainers-public.key",
":debs",
":debs-publish",
":publish",
":signing-token",
],
Expand Down
4 changes: 4 additions & 0 deletions debs/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ if [[ -z "$SIGNING_KEY" ]]; then
exit 1
fi

if [[ -n "$DEBS" ]]; then
DEBS="$(dirname $(dirname $(echo ${DEBS} | cut -d' ' -f1)))"
fi

_aptly () {
"${APTLY[@]}" -- "${@}"
Expand All @@ -41,6 +44,7 @@ create_dirs () {

unpack_debs () {
if [[ -d "$DEBS" ]]; then
DEBS_ROOT=$DEBS
return 0
elif [[ -s "$DEBS" ]]; then
tar xf "$DEBS" -C "$DEBS_ROOT"
Expand Down
1 change: 1 addition & 0 deletions netlify-should-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
exit 1
1 change: 1 addition & 0 deletions netlify.toml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[build]
publish = "html"
command = "./build-repository.sh"
ignore = "./netlify-should-run.sh"

[build.environment]
BAZELISK_HOME="/opt/build/cache/bazelisk"